diff --git a/chapter07/createfiles.xml b/chapter07/createfiles.xml index c55d40836..79fdaaf97 100644 --- a/chapter07/createfiles.xml +++ b/chapter07/createfiles.xml @@ -48,7 +48,7 @@ as well: cat > /etc/hosts << EOF -"127.0.0.1 localhost $(hostname)" +127.0.0.1 localhost $(hostname) ::1 localhost EOF diff --git a/chapter07/stripping.xml b/chapter07/stripping.xml index c7b75cb92..c4bee8d97 100644 --- a/chapter07/stripping.xml +++ b/chapter07/stripping.xml @@ -58,28 +58,27 @@ - Leave the chroot environment and unmount the kernel virtual file - systems: + Now, if you are stripping installed files or making a backup, + leave the chroot environment: - +exit + + All of the following instructions are executed by root. Take extra care about the commands you're going to run as mistakes here can modify your host system. Be aware that the - environment variable LFS is set for user - lfs by default - but it might not be set for + environment variables LFS and LFS_TGT + are set for user lfs by default + but may not be set for root. Whenever commands are to be executed by root, - make sure you have set LFS accordingly. + make sure you have set LFS and LFS_TGT accordingly. This has been discussed in . - + -exit -umount $LFS/dev{/pts,} -umount $LFS/{sys,proc,run} Stripping @@ -90,24 +89,22 @@ umount $LFS/{sys,proc,run} symbols. Strip off debugging symbols from binaries: -$LFS_TGT-strip --strip-unneeded $LFS/usr/lib/* -$LFS_TGT-strip --strip-unneeded $LFS/usr/{,s}bin/* -$LFS_TGT-strip --strip-unneeded $LFS/tools/bin/* -$LFS_TGT-strip --strip-unneeded $LFS/usr/lib{,32}/* -$LFS_TGT-strip --strip-unneeded $LFS/usr/{,s}bin/* -$LFS_TGT-strip --strip-unneeded $LFS/tools/bin/* -$LFS_TGT-strip --strip-unneeded $LFS/usr/lib{,x32}/* -$LFS_TGT-strip --strip-unneeded $LFS/usr/{,s}bin/* -$LFS_TGT-strip --strip-unneeded $LFS/tools/bin/* -$LFS_TGT-strip --strip-unneeded $LFS/usr/lib{,{,x}32}/* -$LFS_TGT-strip --strip-unneeded $LFS/usr/{,s}bin/* -$LFS_TGT-strip --strip-unneeded $LFS/tools/bin/* + + + cd $LFS/tools/$LFS_TGT +bin/strip --strip-unneeded $LFS/usr/lib/* +bin/strip --strip-unneeded $LFS/usr/lib32/* +bin/strip --strip-unneeded $LFS/usr/libx32/* +bin/strip --strip-unneeded $LFS/usr/lib{,x}32/* +bin/strip --strip-unneeded $LFS/usr/{,s}bin/* +bin/strip --strip-unneeded $LFS/tools/bin/* + + + These commands will skip a number of files reporting that it does not recognize their file format. Most of these are scripts instead of binaries. - + At this point, you should have at least 5 GB of free space on the chroot partition that can be used to build and install Glibc and GCC in @@ -137,14 +134,19 @@ $LFS_TGT-strip --strip-unneeded $LFS/tools/bin/* root. + Before we make a backup, unmount the virtual file systems: + +umount $LFS/dev{/pts,} +umount $LFS/{sys,proc,run} + Create the backup archive by running the following command: -cd $LFS && +cd $LFS tar -cJpf $HOME/lfs-temp-tools-&version;.tar.xz . -cd $LFS && +cd $LFS tar -cJpf $HOME/lfs-temp-tools-&versiond;.tar.xz . @@ -170,12 +172,18 @@ tar -cJpf $HOME/lfs-temp-tools-&versiond;.tar.xz . -cd $LFS && -rm -rf ./* && + The following commands are extremly dangerous. If + you run rm -rf ./* as the root user and you + do not change to the $LFS directory or the LFS + environment variable is not set for the root user, it will destroy + your entire host system. YOU ARE WARNED. + +cd $LFS +rm -rf ./* tar -xpf $HOME/lfs-temp-tools-&version;.tar.xz -cd $LFS && -rm -rf ./* && +cd $LFS +rm -rf ./* tar -xpf $HOME/lfs-temp-tools-&versiond;.tar.xz @@ -185,8 +193,8 @@ tar -xpf $HOME/lfs-temp-tools-&versiond;.tar.xz - If you left the chroot environment either to strip off debug - symbols, create a backup, or restart building using a restore, + If you left the chroot environment + to create a backup or restart building using a restore, remember to check that the virtual filesystems are still mounted (findmnt | grep $LFS). If they are not mounted, remount them now as diff --git a/chapter08/bash.xml b/chapter08/bash.xml index e2d32bba4..699a24e43 100644 --- a/chapter08/bash.xml +++ b/chapter08/bash.xml @@ -42,9 +42,9 @@ Prepare Bash for compilation: -./configure --prefix=/usr \ +./configure --prefix=/usr \ --docdir=/usr/share/doc/bash-&bash-version; \ - --without-bash-malloc \ + --without-bash-malloc \ --with-installed-readline diff --git a/chapter08/glibc.xml b/chapter08/glibc.xml index a3993ac36..a85c962f8 100644 --- a/chapter08/glibc.xml +++ b/chapter08/glibc.xml @@ -1096,7 +1096,7 @@ readelf -l a.out | grep '/ld-linux-x32' libutil - >Dummy library containing no functions. Previously contained + Dummy library containing no functions. Previously contained code for standard functions used in many different Unix utilities. These functions are now in libc diff --git a/chapter08/strippingagain.xml b/chapter08/strippingagain.xml index 78426a235..dd3090785 100644 --- a/chapter08/strippingagain.xml +++ b/chapter08/strippingagain.xml @@ -40,15 +40,19 @@ Read the related entry in for the rationale to use the install command here. + The linux loader's name is ld-linux-x86-64.so.2 on 64-bit systems + and ld-linux.so.2 on 32-bit systems. The contruct below selects the + correct name for the current architecture. + + - save_usrlib="ld-linux-x86-64.so.2 + save_usrlib="$(cd /usr/lib; ls ld_linux*) libc.so.6 - libpthread.so.6 - libthread_db.so + libthread_db.so.1 libquadmath.so.&libquadmath-version; - libstdc++.so.6 + libstdc++.so.&libstdcpp-version; libitm.so.&libitm-version; libatomic.so.&libatomic-version;" @@ -83,13 +87,12 @@ for LIB in $save_usrlib; do done online_usrbin="bash find strip" -online_usrlib="libbfd.so - libdl.so.2 - libhistory.so - libncursesw.so - libm.so.6 - libreadline.so - libz.so +online_usrlib="libbfd-&binutils-version;.so + libhistory.so.&readline-version; + libncursesw.so.&ncurses-version; + libm.so.6 + libreadline.so.&readline-version; + libz.so.&zlib-version; $(cd /usr/lib; find libnss*.so* -type f)" for BIN in $online_usrbin; do