From c649743dd612621a69872e95e38d5d575ce13d7e Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Tue, 3 Aug 2021 21:35:39 -0500 Subject: Clarify chapter 7 stripping and backup In chapter 7 we do not need to unmount file systems to strip binaries. Move unmounting to the backup/restore sections. Also make sure the stripping commands are valid. --- chapter07/stripping.xml | 54 ++++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 25 deletions(-) (limited to 'chapter07') diff --git a/chapter07/stripping.xml b/chapter07/stripping.xml index 1d81fff6f..65edf3a89 100644 --- a/chapter07/stripping.xml +++ b/chapter07/stripping.xml @@ -55,28 +55,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 @@ -87,15 +86,15 @@ 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/* + + cd $LFS/tools/$LFS_TGT +bin/strip --strip-unneeded $LFS/usr/lib/* +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 @@ -125,14 +124,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 . @@ -158,12 +162,12 @@ tar -cJpf $HOME/lfs-temp-tools-&versiond;.tar.xz . -cd $LFS && -rm -rf ./* && +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 @@ -173,8 +177,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 -- cgit v1.2.3-54-g00ecf