1.1. How to Cross Build an LFS System

The LFS system will be built by using an already installed UNIX-like system (such as Debian Linux or Mac OS X). This existing UNIX-like system (the host) will be used as a starting point to provide necessary programs, including a compiler, linker, and shell, to build the new system. Select the development option during the distribution installation to include these tools.

[Note]

Note

There are many ways to install a Linux distribution and the defaults are usually not optimal for building an LFS system. For suggestions on setting up a commercial distribution see: https://www.linuxfromscratch.org/hints/downloads/files/partitioning-for-lfs.txt.

As an alternative to installing a separate distribution on your machine, you may wish to use a LiveCD from a commercial distribution.

Chapter 2 of this book describes how to create a new Linux native partition and file system, where the new LFS system will be compiled and installed. Chapter 3 explains which packages and patches must be downloaded to build an LFS system, and how to store them on the new file system. Chapter 4 discusses the setup of an appropriate working environment. Please read Chapter 4 carefully as it explains several important issues you should be aware of before you begin to work your way through Chapter 5 and beyond.

Chapter 5 explains the installation of the initial tool chain, (binutils, gcc, and glibc) using cross-compilation techniques to isolate the new tools from the host system.

Chapter 6 shows you how to cross-compile basic utilities using the just built cross-toolchain.

Chapter 7 then boots the minimal Linux environment on the target machine, where we use the new tools to build all the rest of the tools needed to create the LFS system. Note that in the book the minimal Linux environment may be referred as chroot environment only to keep the consistency with the original LFS book.

This effort to isolate the new system from the host distribution may seem excessive. A full technical explanation as to why this is done is provided in Toolchain Technical Notes.

In Chapter 8 the full LFS system is built.

To finish the installation, the basic system configuration is set up in Chapter 9, and the kernel and boot loader are created in Chapter 10. Chapter 11 contains information on continuing the LFS experience beyond this book. After the steps in this chapter have been implemented, the computer is ready to boot into the new LFS system.

This is the process in a nutshell. Detailed information on each step is presented in the following chapters. Items that seem complicated now will be clarified, and everything will fall into place as you commence your LFS adventure.