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