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