1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.5/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 a CLFS System</title>
|
---|
12 |
|
---|
13 | <para>The CLFS system will be built by using a previously installed
|
---|
14 | Unix system or Linux distribution (such as Debian, Fedora, openSUSE,
|
---|
15 | or Ubuntu). This existing system (the host) will be used as a starting
|
---|
16 | point to 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 onto
|
---|
22 | your machine, you may wish to use a livecd. Most distributions provide
|
---|
23 | a livecd, which provides an environment to which you can add the required
|
---|
24 | tools onto, allowing you to
|
---|
25 | successfully follow the instructions in this book. Remember that if you
|
---|
26 | reboot the livecd you will need to reconfigure the host environment before
|
---|
27 | continuing with your build.</para>
|
---|
28 |
|
---|
29 | <para><xref linkend="chapter-partitioning"/> of this book describes how
|
---|
30 | to create a new Linux native partition and file system, the place
|
---|
31 | where the new CLFS system will be compiled and installed. <xref
|
---|
32 | linkend="chapter-getting-materials"/> explains which packages and
|
---|
33 | patches need to be downloaded to build a CLFS system and how to store
|
---|
34 | them on the new file system. <xref linkend="chapter-final-preps"/>
|
---|
35 | discusses the setup for an appropriate working environment. Please read
|
---|
36 | <xref linkend="chapter-final-preps"/> carefully as it explains several
|
---|
37 | important issues the developer should be aware of before beginning to
|
---|
38 | work through <xref linkend="chapter-cross-tools"/> and
|
---|
39 | beyond.</para>
|
---|
40 |
|
---|
41 | <para><xref linkend="chapter-cross-tools"/> explains the installation of
|
---|
42 | cross-compile tools which will be built on the host but be able to compile
|
---|
43 | programs that run on the target machine. These cross-compile tools will
|
---|
44 | be used to create a temporary, minimal system that will be the basis for
|
---|
45 | building the final CLFS system. Some of these packages are needed to resolve
|
---|
46 | circular dependencies—for example, to compile a compiler, you need a
|
---|
47 | compiler.</para>
|
---|
48 |
|
---|
49 | <para>The process of building cross-compile tools first involves building and
|
---|
50 | installing all the necessary tools to create a build system for the target
|
---|
51 | machine. With these cross-compiled tools, we eliminate any
|
---|
52 | dependencies on the toolchain from our host distro.</para>
|
---|
53 |
|
---|
54 | <para>After we build our <quote>Cross-Tools</quote>, we start building
|
---|
55 | a very minimal working system in
|
---|
56 | <filename class="directory">/tools</filename>. This minimal system will be
|
---|
57 | built using the cross-toolchain in
|
---|
58 | <filename class="directory">/cross-tools</filename>.</para>
|
---|
59 |
|
---|
60 | <para>In <xref linkend="chapter-building-system"/>, the full CLFS system is
|
---|
61 | built. Depending on the system you are cross-compiling for, you will either
|
---|
62 | boot the minimal temp-system on the target machine, or chroot into it.</para>
|
---|
63 |
|
---|
64 | <para>The <command>chroot</command> (change root) program is used to enter
|
---|
65 | a virtual environment and start a new shell whose root directory will be set
|
---|
66 | to the CLFS partition. This is very similar to rebooting and instructing the
|
---|
67 | kernel to mount the CLFS partition as the root partition.
|
---|
68 | The major advantage is that <quote>chrooting</quote> allows the builder to
|
---|
69 | continue using the host while CLFS is being built. While waiting for package
|
---|
70 | compilation to complete, a user can switch to a different virtual console
|
---|
71 | (VC) or X desktop and continue using the computer as normal.</para>
|
---|
72 |
|
---|
73 | <para>Some systems cannot be built by chrooting so they must be
|
---|
74 | booted instead. Generally, if you building for a different arch than
|
---|
75 | the host system, you must reboot because the kernel will likely not
|
---|
76 | support the target machine. Booting involves installing a few
|
---|
77 | additional packages that are needed for bootup, installing
|
---|
78 | boot-scripts, and building a miminal kernel.<!-- We also describe some
|
---|
79 | alternative booting methods in <xref linkend="ch-boot-whatnext"/> --></para>
|
---|
80 |
|
---|
81 | <para>To finish the installation, several configuration files are created in
|
---|
82 | <xref linkend="chapter-system-config"/>, and the kernel and boot loader are set
|
---|
83 | up in <xref linkend="chapter-bootable"/>. <xref linkend="chapter-finalizing"/>
|
---|
84 | contains information on furthering the CLFS experience beyond this book.
|
---|
85 | After the steps in this book have been implemented, the computer will be
|
---|
86 | ready to reboot into the new CLFS system.</para>
|
---|
87 |
|
---|
88 | <para>This is the process in a nutshell. Detailed information on each
|
---|
89 | step is discussed in the following chapters and package descriptions.
|
---|
90 | Items that may seem complicated will be clarified, and everything will
|
---|
91 | fall into place as the reader embarks on the CLFS adventure.</para>
|
---|
92 |
|
---|
93 | </sect1>
|
---|