I recently undertook the task of building a LFS (Linux From Scratch) installation.
LFS is widely regarded as the ultimate, well, “from scratch” Linux distro. So much so in fact, that it’s really not a distro- it’s a book.
Building an LFS system begins with a host Linux system. A new partition must be created for the LFS system, and source code for GCC, Coreutils, Binutils, and several other programs, to create a toolchain on the new partition. After that, you must compile the tools again (Pass 2) so that you are able to compile the final system against the new kernel headers, and linked to binaries on the new filesystem (that you also create). Then it’s time to write bootscripts and config scripts; configure and compile the kernel, install GRUB (if applicable) and boot into the new system! Seems simple enough. 🙂
I used LFS 7.3 (stable), and built it in a VirtualBox VM with Debian 7 (stable) as the host. I found LFS to be a fairly long and challenging build. It took me about a week all told, and I probably have about 20 hours invested in the system. The main part of it is the endless compiling; I was lucky to be doing this with a recent Intel i7 processor and therefore the actual compiling never went for more than a couple hours. However the book is very clear and gives correct config and make options for each package and I never encountered an error that wasn’t directly related to a typo of my own.
A very useful reference that isn’t emphasized much in the book are the LFS Build Logs. These are the STDOUT logs for each compilation exercise, and show what normal output should look like. On a couple packages I noticed errors after compilation that I found I was able to ignore after checking the logs (relief!). It is absolutely essential that each package compile successfully. The key to a successful installation is being über-OCD.
As it turned out for me, the most difficult part was configuring a bootable kernel. Locating correct modules for my hardware was a bit of challenge; but after the third attempt I was greeted with a login and a bash prompt. 🙂
Not real pretty, not real shiny, but, well, real. 🙂
I plan to make several clones of the functioning LFS system and from there try adding a few things such as X (per instructions in the Beyond Linux From Scratch book).
To anyone considering building LFS; I would definitely recommend it! It was my first time doing much in the way of compiling at all; and my first source-based distro. The trick is just to take it slow; focus; and NEVER skip a step.