In chapter 6 Glibc will be installed before Binutils is compiled for the last time. Is is only *after* installation of Glibc when the "make install" is executed, so the make command in the binutils-build/ld directory is merely a preparation.
It is not really used until chapter 6 after installation of the Glibc package. Everything that is installed in chapter 6 is there to stay, and the /tools directory does not belong in the final LFS system.
I guess the /use/bin and /bin directory belong to the host system. but why LFS change the host system's libraries. Am i misunderstand it ?
Remember when you did almost the same thing at the beginning of chapter 5? You start building the Binutils package, then prepare the ld (the library linker program) directory in the Binutils to link against libraries in the /tools directory. You then install GCC, the libc headers and Glibc.
After this, you actually install the new ld program, so that all packages in chapter 5 get linked to libraries in the /tools directory.
You then quickly rebuild GCC and Binutils, so that the /tools directory contains a compiler and the binutils programs. The GCC and Binutils packages you built earlier were linked against Glibc in your host system. After Pass 2 of GCC/Binutils, they no longer need your host libraries, so the rest of chapter 5 is basically adding functionality required to build the basic system in chapter 6.
If you skip all packages that are required, but do not make part of the "trick", you get the following scheme:
Chapter 5
- build and install a new version of binutils in the /tools directory, and link the programs against the host system libc
- build a new version of the linker (ld) and tell it to link against libraries in the /tools directory, but *do not* install it yet.
- build and install a new version of GCC in the tools directory, and link it against the host system libc
- install libc headers in /tools
- build and install Glibc in the /tools directory (of course Glibc is not linked against the host system libc)
- install the prepared linker program in the /tools directory so that all new programs will be linked against the /tools/lib libraries
- build and replace the GCC and Binutils packages in /tools so that they will be linked against the Glibc library in /tools
- directly after building Binutils for the second time, build a new linker and tell it to link against /lib and /usr/lib libraries, but *do not* install it yet, because we need to link al remaining packages in chapter 5 to the /tools libraries
- build some packages that we will need in chapter 6, no special tricks here
Chapter 6
- enter the chroot environment
- install libc headers
- build and install Glibc into the new LFS directory tree (again: glibc is of course not linked against the Glibc libraries in /tools)
- install the linker program so that all packages build from then on are linked against the newy build Glibc in the LFS directory tree
- build an install GCC and binutils so that we don't need the ones in /tools anymore, for in the end, the /tools directory will be purged, and we will want to compile and link new packages ;)
- install some basic software
Wow, that's a long story, hope it's clear why the linker program (ld) for chapter 6 is prepared so early on in chapter 5.
Warning: i'm not sure if I got it right, but it seems to be a plausible explanation, right? I have installed LFS a couple of times now, most packages are pretty straight forward. Glibc, GCC and Binutils seem to be most important, since these are the real work horses when compiling and linking libraries and binaries.
This is also why there are checks in the book directly after installing those packages. After adjusting the toolchain, it is very important to know if the libraries are linked against the right Glibc library (i.e. ld-linux.so.2) since the "old" one(s) might not be available after a) entering the chroot environment of b) removing the /tools directory.
--
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page
