[6370fa6] | 1 | <sect1 id="ch01-how">
|
---|
| 2 | <title>How things are going to be done</title>
|
---|
[04f5529] | 3 | <?dbhtml filename="how.html" dir="chapter01"?>
|
---|
[6370fa6] | 4 |
|
---|
[35c2fa60] | 5 | <para>You are going to build your LFS system by using a previously installed
|
---|
| 6 | Linux distribution (such as Debian, Mandrake, Red Hat, or SuSE). This existing
|
---|
| 7 | Linux system (the host) will be used as a starting point, because you will need
|
---|
| 8 | programs like a compiler, linker and shell to build the new system. Normally
|
---|
| 9 | all the required tools are available if you selected <quote>development</quote>
|
---|
| 10 | as one of the options when you installed your distribution.</para>
|
---|
[6370fa6] | 11 |
|
---|
[35c2fa60] | 12 | <para>In Chapter 3 you will first create a new Linux native partition and
|
---|
| 13 | filesystem, the place where your new LFS system will be compiled and installed.
|
---|
| 14 | Then in Chapter 4 you download all the packages and patches required to build
|
---|
| 15 | an LFS system, and store them on the new filesystem.</para>
|
---|
[c61dd1e] | 16 |
|
---|
[bdf5881] | 17 | <para>Chapter 5 will then discuss the installation of a number of packages that
|
---|
[f5ae45a6] | 18 | will form the basic development suite (or tool-set) which is used to build the
|
---|
[bdf5881] | 19 | actual system in Chapter 6. Some of these packages are needed to resolve
|
---|
| 20 | circular dependencies. For example, to compile a compiler you need a
|
---|
[cc7e27a] | 21 | compiler.</para>
|
---|
[60ed866] | 22 |
|
---|
[bdf5881] | 23 | <para>The first thing to be done in Chapter 5 is build a first pass of the
|
---|
| 24 | toolchain, which is made up of Binutils and GCC. The programs from these
|
---|
| 25 | packages will be linked statically in order for them to be used independently
|
---|
| 26 | of the host system. The second thing to do is build Glibc, the C library. Glibc
|
---|
| 27 | will be compiled by the toolchain programs we just built in the first
|
---|
[e668792] | 28 | pass.</para>
|
---|
[c61dd1e] | 29 |
|
---|
[bdf5881] | 30 | <para>The third thing to do is build a second pass of the toolchain. This time
|
---|
| 31 | the toolchain will be dynamically linked against the newly built Glibc. The
|
---|
| 32 | remaining Chapter 5 packages are all built using this second pass toolchain and
|
---|
[f5ae45a6] | 33 | dynamically linked against the new host-independent Glibc. When this is done,
|
---|
[bdf5881] | 34 | the LFS installation process will no longer depend on the host distribution,
|
---|
| 35 | with the exception of the running kernel. This is known as <quote>self
|
---|
| 36 | contained</quote> and <quote>self hosted</quote>. There is a discussion of the
|
---|
| 37 | differences between statically and dynamically linked programs at the beginning
|
---|
| 38 | of Chapter 5.</para>
|
---|
[c61dd1e] | 39 |
|
---|
[bdf5881] | 40 | <para>You may be asking yourself <quote>that seems like a lot of work, just to
|
---|
| 41 | get away from my host distribution</quote>. Let us take a few minutes to
|
---|
| 42 | discuss this question. The work involved in building the packages in Chapter 5
|
---|
[638a39cb] | 43 | is to ensure that as little information as possible from your host makes it into
|
---|
| 44 | your brand new LFS system. When you build the first two packages in Chapter 5,
|
---|
[bdf5881] | 45 | Binutils and GCC, they will be compiled statically. This means that the
|
---|
| 46 | version of the C library on your host distribution will be embedded inside all
|
---|
[1ce39f2] | 47 | the binary programs you just compiled. This has the potential to cause
|
---|
| 48 | problems for you down the road. The host's Glibc is usually an unknown
|
---|
| 49 | quantity and might even contain bugs or anything else we don't know about
|
---|
[bdf5881] | 50 | until it is too late. A well known issue is that statically linked binaries
|
---|
[3993087] | 51 | compiled on a Glibc-2.2.x based system that contain calls to the
|
---|
| 52 | <emphasis>getpwuid()</emphasis> function crash when run on a Glibc-2.3.x based
|
---|
| 53 | system. Seeing as we are about to build a Glibc-2.3.x based system, we need to
|
---|
| 54 | shield ourselves from problems of this nature. The procedure employed in
|
---|
| 55 | Chapter 5 achieves this goal. With all these things in mind, you can see that
|
---|
| 56 | the extra effort to compile Binutils and GCC twice is well worth it.</para>
|
---|
[cc7e27a] | 57 |
|
---|
[bdf5881] | 58 | <para>In Chapter 6 your real LFS system will be built. The chroot (change root)
|
---|
| 59 | program is used to enter a virtual environment and start a new shell whose root
|
---|
| 60 | directory will be set to the LFS partition. This is very similar to rebooting
|
---|
| 61 | and instructing the kernel to mount the LFS partition as the root partition.
|
---|
| 62 | The reason that you don't actually reboot, but instead chroot, is that creating
|
---|
[638a39cb] | 63 | a bootable system requires additional work which isn't necessary just yet.
|
---|
| 64 | Another advantage is that chrooting allows you to continue using the host while
|
---|
| 65 | LFS is being built. While waiting for package compilation to complete, you can
|
---|
| 66 | simply switch to a different VC (Virtual Console) or X desktop and continue
|
---|
| 67 | using the computer as you normally would.</para>
|
---|
[32489b5] | 68 |
|
---|
[bdf5881] | 69 | <para>When all the software from Chapter 6 is installed, the temporary tools
|
---|
[35c2fa60] | 70 | built in Chapter 5 are removed. In Chapters 7, 8 and 9 the installation will
|
---|
| 71 | then be finalized. The bootscripts are set up in Chapter 7, the kernel and
|
---|
| 72 | bootloader are set up in Chapter 8, and Chapter 9 has some pointers to help
|
---|
| 73 | you after you finish the book. Then, finally, you're ready to reboot your
|
---|
| 74 | computer into your new LFS system.</para>
|
---|
[32489b5] | 75 |
|
---|
[bdf5881] | 76 | <para>This is the process in a nutshell. Detailed information on the steps you
|
---|
| 77 | will take are discussed in the chapters and package descriptions as you
|
---|
| 78 | progress through them. If something isn't completely clear now, don't worry,
|
---|
| 79 | everything will fall into place soon.</para>
|
---|
| 80 |
|
---|
| 81 | <para>Please read Chapter 2 carefully as it explains a few important things you
|
---|
| 82 | should be aware of before you begin to work through Chapters 5 and
|
---|
[cc7e27a] | 83 | beyond.</para>
|
---|
[6370fa6] | 84 |
|
---|
| 85 | </sect1>
|
---|
| 86 |
|
---|