LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 01-24-2019, 09:24 AM   #1
tharpa
LQ Newbie
 
Registered: Oct 2004
Location: North America
Distribution: Salix
Posts: 20

Rep: Reputation: 3
Why do you have to start from Linux


This is a pre-noob question. With LFS, you have to start by already having installed a Linux distro (such as Debian, OpenMandriva, Fedora, or openSUSE). So it's kind of like de-hydrated water. You add water, and you get water! You start with Linux, go through Linux From Scratch, and you end up with Linux!

I figure there's a reason for it, probably that actually starting from scratch (just BIOS pre-installed, or whatever) would be too difficult. I also figure that I'm not the first to ask this question. Is there anywhere this question is already addressed?

Thanks.
 
Old 01-24-2019, 09:51 AM   #2
sevendogsbsd
Senior Member
 
Registered: Sep 2017
Distribution: FreeBSD
Posts: 2,252

Rep: Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011
A few LFS users on here can probably better answer your question but I always thought LFS was for learning how Linux is put together. I do think it can actually be used for daily work, but no clue how - the closest I ever got was Gentoo (stage 1) which (was) far more complex to install than all other distros, LFS aside.
 
Old 01-24-2019, 10:04 AM   #3
Pastychomper
Member
 
Registered: Sep 2011
Location: Scotland
Distribution: Slackware, Devuan, Android
Posts: 132

Rep: Reputation: 243Reputation: 243Reputation: 243
The literal answer is "because you have to start from somewhere". A modern PC has enough built-in to check a few storage devices for something to boot from and display an error if it doesn't find one, but the "something" has to be ready-compiled. I understand some early computers would let you enter a program via toggle switches on the front panel, but if you tried to do that with a modern Linux kernel you'd still be there next Christmas.

In practise I suspect any operating system that can run a suitable compiler could be used to build LFS, but most LFS users will already have used Linux and probably have a distro (or another LFS) already installed. Plus, starting from Linux means you'll have good support for whatever filesystem you want to use, and the option to chroot into the part-built system if needed.

As sevendogsbsd has indicated, the point of LFS is to end up with a Linux system you've built yourself, learning as you go, plus having it exactly as you like it rather than a distro that would be based on somebody else's preferences. And like sevendogsbsd, the closest I've ever got was part way through a Gentoo install. (I was impressed with how smoothly it worked, but not dedicated enough to spend the time on it.)
 
Old 01-24-2019, 10:11 AM   #4
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,153

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
The main idea in LFS aside from the learning process, is to create an OS that it completly tailored to your own needs, you decise what you want to install, and what you don't need to install, you choose your desktop ( if any ), init system etc etc, also of course the latest LFS book uses pretty much the most recent software.

As for using it for every day use, of course you can, it's just like any other distro, once you have the basic system you just build from there, I ( and many others on this sub forum ) use LFS as their main/only day to day distro, I for instance run a full custom desktop ( https://github.com/KeithDHedger/LFSDesktopProject ), LFS is also ideally suited to products like the Pi, I have one myself running my website, kodi media centre, retroarch for occasional gaming, etc all built on LFS.

The only limitations on LFS is what you decide you want and how much effort you want to put into it.

P.S.
This is the main thread, probably need to update it and add some more screen shots.
https://www.linuxquestions.org/quest...ct-4175542914/

Last edited by Keith Hedger; 01-24-2019 at 10:18 AM.
 
1 members found this post helpful.
Old 01-24-2019, 10:22 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,759

Rep: Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931
What came first the chicken or the egg?

linux was originally developed using minix which is another Unix like operating system. So these days it takes an existing operating system to build another one. Learning about the history of computers and how programs were originally developed might help you answer your question.
 
Old 01-24-2019, 10:41 AM   #6
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,153

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
Just a quick screen shot showing what can be achieved:
Click image for larger version

Name:	Screenshot - 240119 - 16:19:55.jpg
Views:	104
Size:	185.8 KB
ID:	29575
 
1 members found this post helpful.
Old 01-24-2019, 10:51 AM   #7
tharpa
LQ Newbie
 
Registered: Oct 2004
Location: North America
Distribution: Salix
Posts: 20

Original Poster
Rep: Reputation: 3
Some of the responses so far have slightly touched on my question, and one of them was so far off that I wasn't even sure it wasn't meant to be a reply to another question. (My question had nothing to with daily use, one way or the other.)

Clearly, if the instructions specify that you must have Linux already installed before beginning, it's not just a matter of "you have to start somewhere". To give a concrete example, a store like Goodwill might sell a used computer, but they remove the hard-drive before selling it.

Thanks for the mention of Gentoo, sevendogs. That might be a good preparatory place for me to start before trying LFS.

Last edited by tharpa; 01-24-2019 at 11:02 AM. Reason: Corrected - I see now that Goodwill removes the hard drives, not just the OS. This partially invalidates my point.
 
Old 01-24-2019, 11:00 AM   #8
sevendogsbsd
Senior Member
 
Registered: Sep 2017
Distribution: FreeBSD
Posts: 2,252

Rep: Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011
Gentoo now only has stage 3 installs but not sure what was gained by 1 and 2. With stage 3, you still build the entire system with the compiler you compiled and optimizations so it's fairly custom. I always installed Gentoo using the "systemrescuecd" which is theirs and allows you to boot to a graphical environment with a browser up and several terminals so you can read through the docs and type at the same time. Or you can do it the masochistic way and boot to Gentoo's live cd at the cli use a tty and links (browser) with the docs up and switch between ttys...I did this before the existence of systemrescuecd. Not really any fun.
 
Old 01-24-2019, 11:04 AM   #9
cynwulf
Senior Member
 
Registered: Apr 2005
Posts: 2,727

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
To build and OS you need a toolchain, source code, compiler, etc and for that you need an OS. The short answer is that you need an OS to build an OS...

The first Linux kernel was cross compiled on MINIX.

https://groups.google.com/forum/#!ms...c/Dpv00xjb5koJ
 
1 members found this post helpful.
Old 01-24-2019, 11:16 AM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,759

Rep: Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931
The basic function of the BIOS is to initialize the PC and provide a basic boot loader so that an operating system can load and run from a drive or optical disc. It is stored in EEPROM and not easily erased and if it was the computer would be nothing more then a door stop.

The kernel is a essentially a program that is written in c and needs a compiler to convert it into machine language so that it can actually run. And since the kernel is very complex and large it takes an existing operating system to compile it.

In the early days of computing a program was entered into the computer using toggle switches. From there punch cards and tape drives were used to store and load programs. Then came assembly and eventually high level languages were developed but the compilers were originally in machine code or assembly. I left out a few details...

Your question is more of how a PC/operating system works then how to build a LFS system.

Last edited by michaelk; 01-24-2019 at 11:33 AM.
 
Old 01-24-2019, 11:16 AM   #11
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,637
Blog Entries: 19

Rep: Reputation: 4469Reputation: 4469Reputation: 4469Reputation: 4469Reputation: 4469Reputation: 4469Reputation: 4469Reputation: 4469Reputation: 4469Reputation: 4469Reputation: 4469
LFS used to provide a CD that allowed you to build an LFS system on a machine that didn't have Linux on it. This was still a Linux system of course, just a semi-detached one. I think there is still an LFS CD but you can't build from it any more.

The problem as The Book itself points out is that "to build a compiler, you need a compiler". In fact, to build the gcc compiler, you need gcc. There are parts of gcc that no other compiler will build correctly.

One way you can build an LFS system for a new computer is to use CLFS (Cross-LFS) and build the Chapter 5 toolkit on another machine, perhaps with a different architecture. CLFS guides you in adding a kernel and bootloader and then you can put the whole thing on a memory stick and boot the new machine from that.

Last edited by hazel; 01-24-2019 at 11:27 AM.
 
1 members found this post helpful.
Old 01-24-2019, 12:27 PM   #12
sevendogsbsd
Senior Member
 
Registered: Sep 2017
Distribution: FreeBSD
Posts: 2,252

Rep: Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011
Even Gentoo does it this way: you boot into a live cd then use the precompiled gcc binary to build your customized (cpu specific) gcc and toolchain.
 
Old 01-24-2019, 02:47 PM   #13
2damncommon
Senior Member
 
Registered: Feb 2003
Location: Calif, USA
Distribution: PCLINUXOS
Posts: 2,918

Rep: Reputation: 103Reputation: 103
Hi tharpa. Apparently you like metaphors.
I want to build a car from scratch but the only way to get the parts to me is with motor vehicles. That doesn't make any sense that I need motor vehicles to build a motor vehicle.

Put another way why, "...You start with Linux, go through Linux From Scratch, and you end up with Linux..." is because LFS is instructions to compile and build a Linux system-not invent Linux. The "start from" and "end up with" statements are worth a laugh and one is free to miss or pretend to miss what is actually being done.

Apparently someone is trying to do LFS from Windows if you're interested.

Also check out CLFS.

Last edited by 2damncommon; 01-24-2019 at 02:59 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why did you come back to Slackware/ why do you use Slackware again? SCerovec Slackware 67 10-03-2018 06:33 PM
LXer: 5 Reasons Why You Should Switch to Windows 7 (And 5 More Reasons Why You Should LXer Syndicated Linux News 0 10-24-2009 11:50 AM
i have installed linux but dont know were 2 start 4m n have a gud hold on linux jovel_allalone Linux - Newbie 4 05-19-2009 10:14 AM
Why Do You Use Linux or Why Did You Switch? jeremy General 35 07-06-2007 11:11 PM
Why Do You Use Linux or Why Did You Switch? wilsnyder General 2186 01-18-2007 01:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 07:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration