Monday, 02 September, 2002

Linux From Scratch Progress

I had hoped that by this evening I would have a bootable Linux From Scratch system.  Unfortunately, building the system is taking quite a bit longer than I expected.  Saturday I downloaded the LFS software archive (105 MB), and Sunday I started building the system.  In a nutshell, here's how it works.

  1. Install Linux from one of the widely available distributions, being sure to include the "development" packages (gcc, make, patch, etc.).  When you install the system, be sure to leave some empty (non-partitioned) space (as much as possible) on the hard drive.  On my system, I created an 800 MB partition for SuSE Linux, and a 200 MB swap partition.
  2. Following the instructions from the Linux From Scratch book, create your LFS partition, and download the software to the directory that they recommend.
  3. Here's where it gets kind of interesting.  You unpack and build the minimum software required to unpack and build a fully working Linux system.  It's similar to bootstrapping.  The idea is to build a minimal development environment that's segregated from your "real" Linux system.  They call this the "static" system, because all of the tools have the libraries statically linked, rather than using the dynamic libraries that are more common with Linux systems.  Seethis page for a discussion of why they use static linking.
  4. You then use the chroot command to start the shell using your static system's partition as the root partition.  This, in effect, gives you a totally new environment in which to work.  All of your commands (ls, gcc, etc.) are being executed from the static binaries that you created in Chapter 3.
  5. Build the software required to create a minimal bootable Linux system.  In this step, you will re-build all of the tools that you created in step 3, but dynamically linked.  You will also build other tools, and the kernel.
  6. Configure some software and make the system bootable.

Right now, I'm about halfway through step 5 above.  Some of those packages take a very long time to build on my old P200.

I can hear it already:  "Why would you want to do that?"  After all, there are plenty of perfectly good Linux distributions available.  Why go through all the work of installing one of them, only to build a bunch of software twice and end up with a system that is less functional than the one I started with?  In my case the answer is simple:  education.  There's nothing like building something from the ground up if you're wondering what makes it tick.  It's better even than taking something apart to figure it out.  Other people like the LFS approach because they end up with a system that has exactly what they want—no more and no less.  There's something to be said for knowing every little thing that's installed on your system, especially if that system is critical in some way:  a DNS, HTTP, or mail server, for example.  There's no chance of some weird package interfering with the server's operation or causing some security breach.

At any rate, I've been taking copious notes, both on my experiences as I install stuff and some thoughts about improvement to the LFS documents.  I'll summarize those here at some point—after I get the system up and running.