| 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
 | 
|---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
 | 
|---|
| 3 |   "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
 | 
|---|
| 4 |   <!ENTITY % general-entities SYSTEM "../../general.ent">
 | 
|---|
| 5 |   %general-entities;
 | 
|---|
| 6 | ]>
 | 
|---|
| 7 | 
 | 
|---|
| 8 | <sect1 id="ch-intro-how">
 | 
|---|
| 9 |   <?dbhtml filename="how.html"?>
 | 
|---|
| 10 | 
 | 
|---|
| 11 |   <title>How to Build an LFS System</title>
 | 
|---|
| 12 | 
 | 
|---|
| 13 |   <para>The LFS system will be built by using a previously installed
 | 
|---|
| 14 |   Linux distribution (such as Debian, Mandrake, Red Hat, or SuSE). This
 | 
|---|
| 15 |   existing Linux system (the host) will be used as a starting point to
 | 
|---|
| 16 |   provide necessary programs, including a compiler, linker, and shell,
 | 
|---|
| 17 |   to build the new system. Select the <quote>development</quote> option
 | 
|---|
| 18 |   during the distribution installation to be able to access these
 | 
|---|
| 19 |   tools.</para>
 | 
|---|
| 20 | 
 | 
|---|
| 21 |   <para>As an alternative to installing an entire separate distribution
 | 
|---|
| 22 |   onto your machine, and if your host machine is x86 based, you may wish to
 | 
|---|
| 23 |   use the Linux From Scratch LiveCD. The CD works well as a host system,
 | 
|---|
| 24 |   providing all the tools you need to successfully follow the instructions
 | 
|---|
| 25 |   in this book. Additionally, it contains all the source packages, patches
 | 
|---|
| 26 |   and a copy of this book. So once you have the CD, no network connection
 | 
|---|
| 27 |   or additional downloads are necessary. For more information about the
 | 
|---|
| 28 |   LFS LiveCD or to download a copy, visit <ulink url="&livecd-root;"/></para>
 | 
|---|
| 29 | 
 | 
|---|
| 30 |   <!-- -->
 | 
|---|
| 31 |   <para>THE TEXT BELOW NEEDS TO BE REWRITTEN</para>
 | 
|---|
| 32 | 
 | 
|---|
| 33 |   <para><xref linkend="chapter-partitioning"/> of this book describes how
 | 
|---|
| 34 |   to create a new Linux native partition and file system, the place
 | 
|---|
| 35 |   where the new LFS system will be compiled and installed. <xref
 | 
|---|
| 36 |   linkend="chapter-getting-materials"/> explains which packages and
 | 
|---|
| 37 |   patches need to be downloaded to build an LFS system and how to store
 | 
|---|
| 38 |   them on the new file system. <xref linkend="chapter-final-preps"/>
 | 
|---|
| 39 |   discusses the setup for an appropriate working environment. Please read
 | 
|---|
| 40 |   <xref linkend="chapter-final-preps"/> carefully as it explains several
 | 
|---|
| 41 |   important issues the developer should be aware of before beginning to
 | 
|---|
| 42 |   work through <xref linkend="chapter-cross-tools"/> and
 | 
|---|
| 43 |   beyond.</para>
 | 
|---|
| 44 | 
 | 
|---|
| 45 |   <para><xref linkend="chapter-temp-system"/> explains the
 | 
|---|
| 46 |   installation of a number of packages that will form the basic
 | 
|---|
| 47 |   development suite (or toolchain) which is used to build the actual
 | 
|---|
| 48 |   system in <xref linkend="chapter-building-system"/>. Some of these
 | 
|---|
| 49 |   packages are needed to resolve circular dependencies—for example,
 | 
|---|
| 50 |   to compile a compiler, you need a compiler.</para>
 | 
|---|
| 51 | 
 | 
|---|
| 52 |   <para><xref linkend="chapter-temp-system"/> also shows the user
 | 
|---|
| 53 |   how to build a first pass of the toolchain, including Binutils and GCC
 | 
|---|
| 54 |   (first pass basically means these two core packages will be re-installed
 | 
|---|
| 55 |   a second time). The next step is to build Glibc, the C library. Glibc
 | 
|---|
| 56 |   will be compiled by the toolchain programs built in the first pass. Then,
 | 
|---|
| 57 |   a second pass of the toolchain will be built. This time, the toolchain
 | 
|---|
| 58 |   will be dynamically linked against the newly built Glibc. The remaining
 | 
|---|
| 59 |   <xref linkend="chapter-temp-system"/> packages are built using this
 | 
|---|
| 60 |   second pass toolchain. When this is done, the LFS installation process
 | 
|---|
| 61 |   will no longer depend on the host distribution, with the exception of the
 | 
|---|
| 62 |   running kernel. </para>
 | 
|---|
| 63 | 
 | 
|---|
| 64 |   <para>This effort to isolate the new system from the host distribution
 | 
|---|
| 65 |   may seem excessive, but a full technical explanation is provided at the
 | 
|---|
| 66 |   beginning of <xref linkend="chapter-temp-system"/>.</para>
 | 
|---|
| 67 | 
 | 
|---|
| 68 |   <para>In <xref linkend="chapter-building-system"/>, the full LFS system is
 | 
|---|
| 69 |   built. The <command>chroot</command> (change root) program is used to enter
 | 
|---|
| 70 |   a virtual environment and start a new shell whose root directory will be set
 | 
|---|
| 71 |   to the LFS partition. This is very similar to rebooting and instructing the
 | 
|---|
| 72 |   kernel to mount the LFS partition as the root partition. The system does not
 | 
|---|
| 73 |   actually reboot, but instead <command>chroot</command>'s because creating a
 | 
|---|
| 74 |   bootable system requires additional work which is not necessary just yet.
 | 
|---|
| 75 |   The major advantage is that <quote>chrooting</quote> allows the builder to
 | 
|---|
| 76 |   continue using the host while LFS is being built. While waiting for package
 | 
|---|
| 77 |   compilation to complete, a user can switch to a different virtual console
 | 
|---|
| 78 |   (VC) or X desktop and continue using the computer as normal.</para>
 | 
|---|
| 79 | 
 | 
|---|
| 80 |   <para>To finish the installation, the LFS-Bootscripts are set up in <xref
 | 
|---|
| 81 |   linkend="chapter-bootscripts"/>, and the kernel and boot loader are set
 | 
|---|
| 82 |   up in <xref linkend="chapter-bootable"/>. <xref
 | 
|---|
| 83 |   linkend="chapter-finalizing"/> contains information on furthering the
 | 
|---|
| 84 |   LFS experience beyond this book.  After the steps in this book have
 | 
|---|
| 85 |   been implemented, the computer will be ready to reboot into the new
 | 
|---|
| 86 |   LFS system.</para>
 | 
|---|
| 87 |   <!-- -->
 | 
|---|
| 88 | 
 | 
|---|
| 89 |   <para>This is the process in a nutshell. Detailed information on each
 | 
|---|
| 90 |   step is discussed in the following chapters and package descriptions.
 | 
|---|
| 91 |   Items that may seem complicated will be clarified, and everything will
 | 
|---|
| 92 |   fall into place as the reader embarks on the LFS adventure.</para>
 | 
|---|
| 93 | 
 | 
|---|
| 94 | </sect1>
 | 
|---|