Constructing a temporary system

Introduction

In this chapter we will compile and install a minimal Linux system. This system will contain just enough tools to be able to start constructing the final LFS system in the next chapter and allow a working environment with a little more user convenience than a minimum environment.

The building of this minimal system is done in two steps: first we build a brand-new and host-independent toolchain (compiler, assembler, linker, libraries, and a few useful utilities), and then use this to build all the other essential tools.

The files compiled in this chapter will be installed under the $LFS/tools directory to keep them separate from the files installed in the next chapter and your host's production directories. Since the packages compiled here are merely temporary, we don't want them to pollute the soon-to-be LFS system.

Before issuing the build instructions for a package, you are expected to have already unpacked it (explained shortly) as user lfs, and to have performed a cd into the created directory. The build instructions assume that you are using the bash shell.

Several of the packages are patched before compilation, but only when the patch is needed to circumvent a problem. Often the patch is needed in both this and the next chapter, but sometimes in only one of them. Therefore, don't worry when instructions for a downloaded patch seem to be missing. Also, when applying a patch, you'll occasionally see warning messages about offset or fuzz. These warnings are nothing to worry about, as the patch was still successfully applied.

During the compilation of most packages you will see many warnings scroll by on your screen. These are normal and can safely be ignored. They are just what they say they are: warnings -- mostly about deprecated, but not invalid, use of the C or C++ syntax. It's just that C standards have changed rather often and some packages still use the older standard, which is not really a problem.

After installing each package you should delete its source and build directories, unless told otherwise. Deleting the sources saves space, but also prevents mis-configuration when the same package is reinstalled further on. Only for three packages you will need to keep the source and build directories around for a while, so their contents can be used by later commands. Do not miss the reminders.

Now first check that your LFS environment variable is set up properly:

echo $LFS

Make sure the output shows the path to your LFS partition's mount point, which is /mnt/lfs if you followed our example.