[673b0d8] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[c2133bc] | 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">
|
---|
[6e35438] | 7 | <title>How to Build an LFS System</title>
|
---|
[673b0d8] | 8 | <?dbhtml filename="how.html"?>
|
---|
[6370fa6] | 9 |
|
---|
[6e35438] | 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>
|
---|
[6370fa6] | 17 |
|
---|
[6e35438] | 18 | <para><xref linkend="chapter-partitioning"/> of this book describes how
|
---|
| 19 | to create a new Linux native partition and file system, the place
|
---|
| 20 | where the new LFS system will be compiled and installed. <xref
|
---|
| 21 | linkend="chapter-getting-materials"/> explains which packages and
|
---|
[69993f4] | 22 | patches need to be downloaded to build an LFS system and how to store
|
---|
[6e35438] | 23 | them on the new file system. <xref linkend="chapter-final-preps"/>
|
---|
| 24 | discusses the setup for an appropriate work environment. Please read
|
---|
| 25 | <xref linkend="chapter-final-preps"/> carefully as it explains several
|
---|
| 26 | important issues the developer should be aware of before beginning to
|
---|
| 27 | work through <xref linkend="chapter-temporary-tools"/> and
|
---|
| 28 | beyond.</para>
|
---|
[c61dd1e] | 29 |
|
---|
[6e35438] | 30 | <para><xref linkend="chapter-temporary-tools"/> explains the
|
---|
| 31 | installation of a number of packages that will form the basic
|
---|
| 32 | development suite (or toolchain) which is used to build the actual
|
---|
| 33 | system in <xref linkend="chapter-building-system"/>. Some of these
|
---|
[69993f4] | 34 | packages are needed to resolve circular dependencies—for example,
|
---|
[6e35438] | 35 | to compile a compiler, you need a compiler.</para>
|
---|
[60ed866] | 36 |
|
---|
[6e35438] | 37 | <para><xref linkend="chapter-temporary-tools"/> also shows the user how
|
---|
| 38 | to build a first pass of the toolchain, including Binutils and GCC
|
---|
| 39 | (first pass basically means these two core packages will be
|
---|
| 40 | re-installed a second time). The programs from these packages will be
|
---|
| 41 | linked statically in order to be used independently of the host
|
---|
| 42 | system. The next step is to build Glibc, the C library. Glibc will be
|
---|
| 43 | compiled by the toolchain programs built in the first pass. Then, a
|
---|
| 44 | second pass of the toolchain will be built. This time, the toolchain
|
---|
| 45 | will be dynamically linked against the newly built Glibc. The
|
---|
| 46 | remaining <xref linkend="chapter-temporary-tools"/> packages are built
|
---|
| 47 | using this second pass toolchain. When this is done, the LFS
|
---|
| 48 | installation process will no longer depend on the host distribution,
|
---|
| 49 | with the exception of the running kernel.</para>
|
---|
[c61dd1e] | 50 |
|
---|
[6e35438] | 51 | <para>While this may initially seem like a lot of work to get away
|
---|
| 52 | from a host distribution, a full technical explanation is provided at
|
---|
[b59625f] | 53 | the beginning of <xref linkend="chapter-temporary-tools"/>,
|
---|
| 54 | including notes on the differences between
|
---|
[6e35438] | 55 | statically and dynamically-linked programs.</para>
|
---|
[cc7e27a] | 56 |
|
---|
[6e35438] | 57 | <para>In <xref linkend="chapter-building-system"/>, the full LFS system is
|
---|
| 58 | built. The chroot (change root) program is used to enter a virtual
|
---|
| 59 | environment and start a new shell whose root directory will be set to
|
---|
| 60 | the LFS partition. This is very similar to rebooting and instructing
|
---|
| 61 | the kernel to mount the LFS partition as the root partition. The
|
---|
[69993f4] | 62 | system does not actually reboot, but instead chroots because creating a
|
---|
| 63 | bootable system requires additional work which is not necessary just
|
---|
[6e35438] | 64 | yet. The major advantage is that <quote>chrooting</quote> allows the
|
---|
| 65 | builder to continue using the host while LFS is being built. While
|
---|
| 66 | waiting for package compilation to complete, a user can switch to a
|
---|
| 67 | different virtual console (VC) or X desktop and continue using the
|
---|
| 68 | computer as normal.</para>
|
---|
[32489b5] | 69 |
|
---|
[6e35438] | 70 | <para>To finish the installation, the bootscripts are set up in <xref
|
---|
[fb34768] | 71 | linkend="chapter-bootscripts"/>, and the kernel and boot loader are set
|
---|
[6e35438] | 72 | up in <xref linkend="chapter-bootable"/>. <xref
|
---|
| 73 | linkend="chapter-finalizing"/> contains information on furthering the
|
---|
| 74 | LFS experience beyond this book. After the steps in this book have
|
---|
| 75 | been implemented, the computer will be ready to reboot into the new
|
---|
| 76 | LFS system.</para>
|
---|
[32489b5] | 77 |
|
---|
[6e35438] | 78 | <para>This is the process in a nutshell. Detailed information on each
|
---|
| 79 | step is discussed in the following chapters and package descriptions.
|
---|
| 80 | Items that may seem complicated will be clarified, and everything will
|
---|
| 81 | fall into place as the developer embarks on the LFS adventure.</para>
|
---|
[6370fa6] | 82 |
|
---|
| 83 | </sect1>
|
---|
[6e35438] | 84 |
|
---|