< Back to index

Linux From Scratch (LFS) is the name of a book written by Gerard Beekmans and others. In that book the reader is given instructions on how to build a Linux system from source. The book is available freely from the Linux From Scratch website and is currently in version 6.2. To keep LFS small and focused, the Beyond Linux From Scratch book was created which presents instructions on how to further develop the basic Linux system that was created in LFS.

In addition to LFS and BLFS books Cross Linux From Scratch describes cross compiling technique and Hardened Linux From Scratch focuses on security enhancements like use of Stack-smashing protection, PaX and Address space layout randomization using Grsecurity.

Linux From Scratch is a way to install a working Linux system by building all components of it manually. This is, by design, much more labour-intensive than installing a pre-built distribution (see Linux distribution). The idea is that installing the individual packages one-by-one will lead to an understanding of the internals of a working Linux system. In addition, of course, compiling all of the software specifically for the system on which it will run tends to result in smaller and faster programs. Finally, it is easier to customize the installed packages when each is installed manually – "Your distro, your rules".

Procedure


A clean partition and a working Linux system are required to build LFS. Instead of installing another Linux system, one can use the [http://www.linuxfromscratch.org/livecd/ Linux From Scratch LiveCD]. The LiveCD contains all the source packages, the LFS book, automated building tools and a XFCE GUI environment to work in. First a toolchain must be compiled consisting of the tools used to compile LFS like GCC, glibc, binutils and other necessary utilities. Then the root directory must be changed (using chroot) to the toolchain's partition to start building the final system. One of the first packages to compile is glibc; after that, the toolchain's linker must be adjusted to link against the newly built glibc, so that all other packages that will make up the finished system can be linked against it as well. During the chroot phase, bash's hashing feature is turned off and the temporary toolchain's bin directory moved to the end of PATH. This way the newly compiled programs come first in PATH and the new system builds on its own new components.
This entry uses material from from Wikipedia, the leading user-contributed encyclopedia. It is licensed under the GNU Free Documentation License. Disclaimer.