[673b0d8] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[b06ca36] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[673b0d8] | 4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
[6370fa6] | 7 |
|
---|
[13a9dc2] | 8 | <sect1 id="ch-intro-how">
|
---|
| 9 | <?dbhtml filename="how.html"?>
|
---|
[81fd230] | 10 |
|
---|
[13a9dc2] | 11 | <title>How to Build an LFS System</title>
|
---|
[0eb01c0f] | 12 |
|
---|
[cff800e] | 13 | <para>The LFS system will be built by using an already installed
|
---|
[448e226] | 14 | Linux distribution (such as Debian, OpenMandriva, Fedora, or openSUSE). This
|
---|
[13a9dc2] | 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>
|
---|
[81fd230] | 20 |
|
---|
[a91be49] | 21 | <para>As an alternative to installing a separate distribution onto your
|
---|
[9fb74db] | 22 | machine, you may wish to use <!-- the Linux From Scratch LiveCD or --> a LiveCD from a
|
---|
| 23 | commercial distribution. <!-- The LFS LiveCD works well as a host system,
|
---|
[a91be49] | 24 | providing all the tools you need to successfully follow the instructions in
|
---|
[e5fda02] | 25 | this book. The LiveCD version is behind the current book, but is still useful
|
---|
[7928e023] | 26 | as a host for building the current book. The <quote>-nosrc</quote> or
|
---|
| 27 | <quote>-min</quote> editions of the LiveCD are the most appropriate for
|
---|
| 28 | building a current LFS system. For more information about the LFS LiveCD or
|
---|
[9fb74db] | 29 | to download a copy, visit <ulink url="&livecd-root;"/>. --></para>
|
---|
[81fd230] | 30 |
|
---|
[9fb74db] | 31 | <!--
|
---|
[0e62210] | 32 | <note>
|
---|
| 33 | <para>The LFS LiveCD might not work on newer hardware configurations,
|
---|
[31d9112] | 34 | failing to boot or failing to detect some devices such as some SATA hard
|
---|
[0e62210] | 35 | drives.</para>
|
---|
[9fb74db] | 36 | </note> -->
|
---|
[0e62210] | 37 |
|
---|
[13a9dc2] | 38 | <para><xref linkend="chapter-partitioning"/> of this book describes how
|
---|
[fd40de87] | 39 | to create a new Linux native partition and file system. This is the place
|
---|
[13a9dc2] | 40 | where the new LFS system will be compiled and installed. <xref
|
---|
| 41 | linkend="chapter-getting-materials"/> explains which packages and
|
---|
| 42 | patches need to be downloaded to build an LFS system and how to store
|
---|
| 43 | them on the new file system. <xref linkend="chapter-final-preps"/>
|
---|
[fdb65bd] | 44 | discusses the setup of an appropriate working environment. Please read
|
---|
[13a9dc2] | 45 | <xref linkend="chapter-final-preps"/> carefully as it explains several
|
---|
[cff800e] | 46 | important issues you need be aware of before beginning to
|
---|
| 47 | work your way through <xref linkend="chapter-temporary-tools"/> and beyond.</para>
|
---|
[81fd230] | 48 |
|
---|
[efcb393] | 49 | <para><xref linkend="chapter-temporary-tools"/> explains the installation of
|
---|
| 50 | a number of packages that are needed to resolve circular
|
---|
| 51 | dependencies—for example, to compile a compiler, you need a compiler.
|
---|
| 52 | or to unpack the tar package, you need tar.</para>
|
---|
[81fd230] | 53 |
|
---|
[cff800e] | 54 | <para><xref linkend="chapter-temporary-tools"/> also shows you how to
|
---|
[3a56c9a] | 55 | build a C cross-compiling toolchain as a first step, including binutils
|
---|
| 56 | and GCC. Cross-compiling is not absolutely needed since the machine we'll
|
---|
| 57 | run LFS on is the same as the one we build on, but it has the advantage
|
---|
| 58 | of clearly separating the already installed system and the future LFS one.
|
---|
[13a9dc2] | 59 | The next step is to build Glibc, the C library. Glibc will be compiled by
|
---|
[3a56c9a] | 60 | the toolchain programs built previously. Then, the missing bits for a
|
---|
| 61 | C++ cross-compiling toolchain will be built. It is then possible to build
|
---|
| 62 | packages that are needed to resolve circular dependencies in such a way
|
---|
| 63 | that the produced executables and libraries are completely independent
|
---|
| 64 | from the installed distribution.</para>
|
---|
| 65 |
|
---|
| 66 | <para>The remainder of <xref linkend="chapter-temporary-tools"/> adds
|
---|
| 67 | the packages necessary to get a complete build environment. This is done
|
---|
| 68 | after running the <command>chroot</command> (change root) program to enter
|
---|
| 69 | a virtual environment and start a new shell whose root directory will be
|
---|
| 70 | set to the LFS partition. This is very similar to rebooting and instructing
|
---|
| 71 | the kernel to mount the LFS partition as the root partition. The system
|
---|
| 72 | does not actually reboot, but instead uses <command>chroot</command>
|
---|
| 73 | because creating a bootable system requires additional work which is not
|
---|
| 74 | ecessary just yet. The major advantage is that <quote>chrooting</quote>
|
---|
| 75 | allows to isolate the build process from the installed distribution, while
|
---|
| 76 | using the installed kernel.</para>
|
---|
[81fd230] | 77 |
|
---|
[13a9dc2] | 78 | <para>This effort to isolate the new system from the host distribution may
|
---|
[efcb393] | 79 | seem excessive. A full technical explanation as to why this is done is
|
---|
| 80 | provided in <xref linkend="ch-tools-toolchaintechnotes"/>.</para>
|
---|
[81fd230] | 81 |
|
---|
[3a56c9a] | 82 | <para>In <xref linkend="chapter-building-system"/>, The
|
---|
| 83 | full LFS system is built. Another advantage provided by the chroot
|
---|
| 84 | environment is that it allows you to continue using the host system
|
---|
[efcb393] | 85 | while LFS is being built. While waiting for package compilations to
|
---|
| 86 | complete, you can continue using your computer as normal.</para>
|
---|
[87899e5] | 87 |
|
---|
[1118b17] | 88 | <para>To finish the installation, the basic system configuration is set up in
|
---|
[afcfd74] | 89 | <xref linkend="chapter-config"/>, and the kernel and boot loader are set
|
---|
[13a9dc2] | 90 | up in <xref linkend="chapter-bootable"/>. <xref linkend="chapter-finalizing"/>
|
---|
[cff800e] | 91 | contains information on continuing the LFS experience beyond this book.
|
---|
[13a9dc2] | 92 | After the steps in this book have been implemented, the computer will be
|
---|
| 93 | ready to reboot into the new LFS system.</para>
|
---|
| 94 |
|
---|
| 95 | <para>This is the process in a nutshell. Detailed information on each
|
---|
| 96 | step is discussed in the following chapters and package descriptions.
|
---|
| 97 | Items that may seem complicated will be clarified, and everything will
|
---|
[cff800e] | 98 | fall into place as you embark on the LFS adventure.</para>
|
---|
[81fd230] | 99 |
|
---|
[13a9dc2] | 100 | </sect1>
|
---|