Linux From Scratch

Linux has come a long way from the old days when you had to bootstrap it from DOS. Now you just put a CD in the drive, guess your way through the install menu, and in no time you have a fully configured Linux. Having all of the configuration done for you sure makes it easy to install, but it doesn't make it easy to know what to do when something goes wrong. You can learn a lot from reading the AnimalBooks? (O'Reilly) and surfing HOWTOs and FAQs. But there's a very quick and effective way to really learn how a Linux is put together:

http://www.linuxfromscratch.org

This innovative web site documents how to make your own Linux distribution from scratch. Well, almost from scratch. You have to have a running operating system to "bootstrap" your new Linux from, only now you don't use DOS -- you use an existing Linux installation such as Redhat or Debian.

After only a day or two of futzing around, you'll have your new Linux to the point where you can boot it. Another day or two of futzing around and you should have PPP so you can dial the net without having to boot back into your "old" linux. It's quite a thrill, and best of all, you'll understand a lot more of what's going on behind the scenes of your Linux.


For a real thrill, ignore the versions that the document calls for and instead download the latest stable versions.

People who do this and don't know how to fix the errors they get cause themselves and the LFS support volunteers considerable pain. Please stick with the book unless you know C well enough to debug interactions between large, complex pieces of software. -- SethKlein, former LFS FAQ maintainer

Yeah, that sounds too brave for me, too. But I can imagine why there might be people attracted to that thrill. Perhaps, rather than ignoring the version which the document suggests, and using the latest of each package, a safer (yet still thrilling) approach may be to download the latest "unstable" version of the book which usually has the latest versions of nearly all of the packages. --EricHerman


What is the advantage to installing linux from scratch though?

As it says above - you'll understand a lot more of what's going on behind the scenes of your Linux.

One of the things that got me interested in LinuxFromScratch was a problem I had a while back making a change to an OpenSource game called NetHack. Even though the patch was easy to write, getting a clean compile out of nethack was impossible (for me anyway, but I still have hope). Since I couldn't build it myself, I couldn't really use the patch. So, it's fun to think "I use OpenSource thus I'm free to make changes" but the reality is that unless I'm using software which I can build from source myself, I won't really be able to make, test, and use any changes of my own. --EricHerman

Nethack is a pain to build. It can compile, link, and run on many architectures, so the build configuration (in the form of Makefiles) is a little complex. However, there are many open source projects that handle Makefiles most reasonably. With Nethack, you basically have to manually edit a few Makefiles. Most OSS projects I've build from source use the automake style builds (run ./configure w/ optional parameters as needed). At the time of this writing, I just failed to cross compile nethack for my NSLU2 (arm based architecture) because I needed another library (ncurses, also crosscompiled). I chased a binary runtime of the ncurses library (a .ipk file), but I still needed some header files, which I wasn't able to locate or generate successfully. That said, building from source is about control, but not everyone is able to do it - atleast its an option. I've been compiling nethack on redhat/fedora core (just ncurses text interface since 3.4.1) with and without various patches written by others. If you are up for this challenge, don't give up. To finally address the question above...building from scratch allows you customization. Using patches written by others or 'hacks' of your own, allow you to alter the software in a way that you see fit/appropriate. This type of customization is what makes the software industry work like a service industry rather than a product industry. It is now *more* possible or cheaper to get a customized piece of software because you can build from source, not scratch. In the case of LinuxFromScratch, you pick and choose what you want and how you want it built. As you do that, you *will have the opportunity* to learn. While I can see the potential value in that, I see more value in customization at a higher level - applications.


I've only skimmed through the Linux From Scratch "book," but it looks like it answers many of the questions I've had about bootstrapping yourself from the sources. The only thing I don't believe it addresses are what needs to happen if you are targetting an entirely different platform.

That is, I would like to be able to - from scratch - build on my Pentium-based Linux system a complete Linux for a embedded system. Specifically, a Motorola ColdFire?-based system with no hard drive, floppies, or CD-ROM drive; it just has a large amount of Flash memory where the filesystem should eventually reside. I'm not asking how to build and use a cross-compiler and related tools and libraries; I know how to do that. Instead, I'm looking for a "cookbook" document (like Linux From Scratch) that can point out some of the things someone might experience when doing a cross-platform installation from scratch.

-- JohnPassaniti

Perhaps you should look into the work on the World's smallest WebServer, some of the attempts use Linux. A good place to start would be http://www.mycal.net/wsweb/ (BrokenLink 20005-08-24) -- AndreSlabber

This is not a BrokenLink, but content seems to have changed radically.

Once you get to their(LFS) web site look for the section called "hints" I believe. There is one on building for a different platform.

It is not as well documented as LinuxFromScratch, but BuildRoot? at http://buildroot.uclibc.org/ is designed for automating the cross-compiling of Linux for an embedded system. The installation scripts are very informative.


CategoryUnix CategoryLinux

EditText of this page (last edited February 12, 2009) or FindPage with title or text search