[bf8c11f] | 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 |
|
---|
[2e9d6f5] | 11 | <title>How to Build a CLFS System</title>
|
---|
[bf8c11f] | 12 |
|
---|
[2e9d6f5] | 13 | <para>The CLFS system will be built by using a previously installed
|
---|
[77396ef] | 14 | Linux distribution (such as Debian, Fedora, Mandriva, SuSE, or Ubuntu).
|
---|
| 15 | This existing Linux system (the host) will be used as a starting point to
|
---|
[bf8c11f] | 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
|
---|
[77396ef] | 22 | onto your machine, you may wish to use the Linux From Scratch LiveCD.
|
---|
| 23 | The CD works well as a host system, providing all the tools you need to
|
---|
| 24 | successfully follow the instructions in this book. Additionally, it
|
---|
| 25 | contains all the source packages, patches and a copy of this book. So
|
---|
| 26 | once you have the CD, no network connection or additional downloads are
|
---|
| 27 | necessary. For more information about the LFS LiveCD or to download a copy,
|
---|
| 28 | visit <ulink url="&livecd-root;"/></para>
|
---|
[bf8c11f] | 29 |
|
---|
| 30 | <para><xref linkend="chapter-partitioning"/> of this book describes how
|
---|
| 31 | to create a new Linux native partition and file system, the place
|
---|
[2e9d6f5] | 32 | where the new CLFS system will be compiled and installed. <xref
|
---|
[bf8c11f] | 33 | linkend="chapter-getting-materials"/> explains which packages and
|
---|
[2e9d6f5] | 34 | patches need to be downloaded to build a CLFS system and how to store
|
---|
[bf8c11f] | 35 | them on the new file system. <xref linkend="chapter-final-preps"/>
|
---|
| 36 | discusses the setup for an appropriate working environment. Please read
|
---|
| 37 | <xref linkend="chapter-final-preps"/> carefully as it explains several
|
---|
| 38 | important issues the developer should be aware of before beginning to
|
---|
[ed3e5d8] | 39 | work through <xref linkend="chapter-cross-tools"/> and
|
---|
[bf8c11f] | 40 | beyond.</para>
|
---|
| 41 |
|
---|
[bea9517] | 42 | <para><xref linkend="chapter-cross-tools"/> explains the installation of
|
---|
| 43 | cross-compile tools which will be built on the host but be able to compile
|
---|
| 44 | programs that run on the target machine. These cross-compile tools will
|
---|
| 45 | be used to create a temporary, minimal system that will be the basis for
|
---|
[2e9d6f5] | 46 | building the final CLFS system. Some of these packages are needed to resolve
|
---|
[bea9517] | 47 | circular dependencies—for example, to compile a compiler, you need a
|
---|
| 48 | compiler.</para>
|
---|
| 49 |
|
---|
| 50 | <para>The process of building cross-compile tools first involves installing
|
---|
[77396ef] | 51 | building all the necessary tools to create a build system for the target
|
---|
| 52 | machine. With the Cross-Compiled tools we just created, we elminate any
|
---|
| 53 | dependencies on the toolchain from our host distro.</para>
|
---|
[bf8c11f] | 54 |
|
---|
[77396ef] | 55 | <para>After we build our <quote>Cross-Tools</quote>, we start building
|
---|
| 56 | a very minimal working system in /tools. This effort to isolate the new
|
---|
| 57 | system from the host distribution may seem excessive, but a full technical
|
---|
| 58 | explanation is provided at the beginning of
|
---|
| 59 | <xref linkend="chapter-temp-system"/>.</para>
|
---|
[bf8c11f] | 60 |
|
---|
[2e9d6f5] | 61 | <para>In <xref linkend="chapter-building-system"/>, the full CLFS system is
|
---|
[bea9517] | 62 | built. Depending on the system you are cross-compiling for, either you will
|
---|
| 63 | boot the minimal temp-system on the target machine, or chroot into it.</para>
|
---|
| 64 |
|
---|
| 65 | <para>The <command>chroot</command> (change root) program is used to enter
|
---|
[bf8c11f] | 66 | a virtual environment and start a new shell whose root directory will be set
|
---|
[2e9d6f5] | 67 | to the CLFS partition. This is very similar to rebooting and instructing the
|
---|
| 68 | kernel to mount the CLFS partition as the root partition.
|
---|
[bf8c11f] | 69 | The major advantage is that <quote>chrooting</quote> allows the builder to
|
---|
[2e9d6f5] | 70 | continue using the host while CLFS is being built. While waiting for package
|
---|
[bf8c11f] | 71 | compilation to complete, a user can switch to a different virtual console
|
---|
| 72 | (VC) or X desktop and continue using the computer as normal.</para>
|
---|
| 73 |
|
---|
[2e9d6f5] | 74 | <para>Some systems cannot be built by chrooting so they must be
|
---|
| 75 | booted instead. Generally, if you building for a different arch than
|
---|
| 76 | the host system, you must reboot because the kernel will likely not
|
---|
| 77 | support the target machine. Booting involves installing a few
|
---|
| 78 | additional packages that are needed for bootup, installing
|
---|
[77396ef] | 79 | bootscripts, and building a miminal kernel. We also describe some
|
---|
| 80 | alternative booting methods in <xref linkend="ch-boot-whatnext"/></para>
|
---|
[bea9517] | 81 |
|
---|
[2e9d6f5] | 82 | <para>To finish the installation, the CLFS-Bootscripts are set up in <xref
|
---|
[bf8c11f] | 83 | linkend="chapter-bootscripts"/>, and the kernel and boot loader are set
|
---|
[77396ef] | 84 | up in <xref linkend="chapter-bootable"/>. <xref linkend="chapter-finalizing"/>
|
---|
| 85 | contains information on furthering the CLFS experience beyond this book.
|
---|
| 86 | After the steps in this book have been implemented, the computer will be
|
---|
| 87 | ready to reboot into the new CLFS system.</para>
|
---|
[bf8c11f] | 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
|
---|
[2e9d6f5] | 92 | fall into place as the reader embarks on the CLFS adventure.</para>
|
---|
[bf8c11f] | 93 |
|
---|
| 94 | </sect1>
|
---|