Linux From Scratch: Version 5.0-pre2
Prev | Chapter 1. Introduction | Next

# How things are going to be done

You are going to build your LFS system by using a previously installed Linux distribution such as Debian, Mandrake, Red Hat, etc. The existing Linux system (host) will be used as a starting point, because you will need programs like a compiler, linker, text editor, and other development tools to build the new system. Ordinarily, the required tools are available by default if you selected "development" as one of your installation options when you installed your Linux distribution.

After you have downloaded the packages that make up an LFS system, you will create a new Linux native partition and filesystem. This new Linux partition and filesystem is where your new LFS system will be compiled and installed onto.

Chapter 5 will then discuss the installation of a number of packages that will form the basic development suite (or tool-set) which is used to build the actual system in Chapter 6. Some of these packages are needed to resolve circular dependencies. For example, to compile a compiler you need a compiler.

The first thing to be done in Chapter 5 is build a first pass of the toolchain, which is made up of Binutils and GCC. The programs from these packages will be linked statically in order for them to be used independently of the host system. The second thing to do is build Glibc, the C library. Glibc will be compiled by the toolchain programs we just built in the first pass.

The third thing to do is build a second pass of the toolchain. This time the toolchain will be dynamically linked against the newly built Glibc. The remaining Chapter 5 packages are all built using this second pass toolchain and dynamically linked against the new host-independent Glibc. When this is done, the LFS installation process will no longer depend on the host distribution, with the exception of the running kernel. This is known as "self contained" and "self hosted". There is a discussion of the differences between statically and dynamically linked programs at the beginning of Chapter 5.

You may be asking yourself "that seems like a lot of work, just to get away from my host distribution". Let us take a few minutes to discuss this question. The work involved in building the packages in Chapter 5 is to ensure that as little information as possible from your host makes it into your brand new LFS system. When you build the first two packages in Chapter 5, Binutils and GCC, they will be compiled statically. This means that the version of the C library on your host distribution will be embedded inside all the binary programs you just compiled. This has the potential to cause problems for you down the road. The host's Glibc is usually an unknown quantity and might even contain bugs or anything else we don't know about until it is too late. A well known issue is that statically linked binaries compiled on a Glibc-2.2.x based system that contain calls to the getpwuid() function crash when run on a Glibc-2.3.x based system. Seeing as we are about to build a Glibc-2.3.x based system, we need to shield ourselves from problems of this nature. The procedure employed in Chapter 5 achieves this goal. With all these things in mind, you can see that the extra effort to compile Binutils and GCC twice is well worth it.

In Chapter 6 your real LFS system will be built. The chroot (change root) program is used to enter a virtual environment and start a new shell whose root directory will be set to the LFS partition. This is very similar to rebooting and instructing the kernel to mount the LFS partition as the root partition. The reason that you don't actually reboot, but instead chroot, is that creating a bootable system requires additional work which isn't necessary just yet. Another advantage is that chrooting allows you to continue using the host while LFS is being built. While waiting for package compilation to complete, you can simply switch to a different VC (Virtual Console) or X desktop and continue using the computer as you normally would.

When all the software from Chapter 6 is installed, the temporary tools built in Chapter 5 will be removed. Chapters 7, 8 and 9 will finalize the installation. The bootscripts are setup in Chapter 7, the kernel and boot loader are setup in Chapter 8 and Chapter 9 has some pointers to help you after you finish with the book. Then, finally, you reboot your computer into your new LFS system.

This is the process in a nutshell. Detailed information on the steps you will take are discussed in the chapters and package descriptions as you progress through them. If something isn't completely clear now, don't worry, everything will fall into place soon.

Please read Chapter 2 carefully as it explains a few important things you should be aware of before you begin to work through Chapters 5 and beyond.

Prev | Home | Next
Introduction | Up | Conventions used in this book