diff options
author | Bruce Dubbs <bdubbs@linuxfromscratch.org> | 2021-08-03 21:35:39 -0500 |
---|---|---|
committer | Bruce Dubbs <bdubbs@linuxfromscratch.org> | 2021-08-03 21:35:39 -0500 |
commit | c649743dd612621a69872e95e38d5d575ce13d7e (patch) | |
tree | 6e410876bb539eaca5fc5d9d1019eb2365e42133 /chapter07 | |
parent | adcaf07efbeb8f787f704907a0699e99b633cf6f (diff) |
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.
Diffstat (limited to 'chapter07')
-rw-r--r-- | chapter07/stripping.xml | 54 |
1 files changed, 29 insertions, 25 deletions
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 @@ </para> <para> - 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: </para> - <note> +<screen role="nodump"><userinput>exit</userinput></screen> + + <important> <para>All of the following instructions are executed by <systemitem class="username">root</systemitem>. 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 <envar>LFS</envar> is set for user - <systemitem class="username">lfs</systemitem> by default - but it might <emphasis>not</emphasis> be set for + environment variables <envar>LFS</envar> and <envar>LFS_TGT</envar> + are set for user <systemitem class="username">lfs</systemitem> by default + but may <emphasis>not</emphasis> be set for <systemitem class="username">root</systemitem>. Whenever commands are to be executed by <systemitem class="username">root</systemitem>, - make sure you have set <envar>LFS</envar> accordingly. + make sure you have set <envar>LFS</envar> and <envar>LFS_TGT</envar> accordingly. This has been discussed in <xref linkend='ch-partitioning-aboutlfs'/>. </para> - </note> + </important> -<screen role="nodump"><userinput>exit -umount $LFS/dev{/pts,} -umount $LFS/{sys,proc,run}</userinput></screen> <sect2> <title>Stripping</title> @@ -87,15 +86,15 @@ umount $LFS/{sys,proc,run}</userinput></screen> symbols.</para> <para>Strip off debugging symbols from binaries:</para> -<screen role="nodump"><userinput>$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/*</userinput></screen> + + <screen role="nodump"><userinput>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/*</userinput></screen> <para>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. - <!--Note that we use the <command>strip</command> program built in - <quote>Binutils pass 2</quote>, since it is the one that knows how to strip - our cross-compiled programs.--></para> + </para> <para>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/*</userinput></screen> <systemitem class="username">root</systemitem>. </para> + <para>Before we make a backup, unmount the virtual file systems:</para> + +<screen role="nodump"><userinput>umount $LFS/dev{/pts,} +umount $LFS/{sys,proc,run}</userinput></screen> + <para> Create the backup archive by running the following command: </para> -<screen role="nodump" revision="sysv"><userinput>cd $LFS && +<screen role="nodump" revision="sysv"><userinput>cd $LFS tar -cJpf $HOME/lfs-temp-tools-&version;.tar.xz .</userinput></screen> -<screen role="nodump" revision="systemd"><userinput>cd $LFS && +<screen role="nodump" revision="systemd"><userinput>cd $LFS tar -cJpf $HOME/lfs-temp-tools-&versiond;.tar.xz .</userinput></screen> <para> @@ -158,12 +162,12 @@ tar -cJpf $HOME/lfs-temp-tools-&versiond;.tar.xz .</userinput></screen> <!-- Make the following look different so users don't blindly run the restore when they don't need to. --> -<screen role="nodump" revision="sysv"><computeroutput>cd $LFS && -rm -rf ./* && +<screen role="nodump" revision="sysv"><computeroutput>cd $LFS +rm -rf ./* tar -xpf $HOME/lfs-temp-tools-&version;.tar.xz</computeroutput></screen> -<screen role="nodump" revision="systemd"><computeroutput>cd $LFS && -rm -rf ./* && +<screen role="nodump" revision="systemd"><computeroutput>cd $LFS +rm -rf ./* tar -xpf $HOME/lfs-temp-tools-&versiond;.tar.xz</computeroutput></screen> <para> @@ -173,8 +177,8 @@ tar -xpf $HOME/lfs-temp-tools-&versiond;.tar.xz</computeroutput></screen> <important> <para> - 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 (<command>findmnt | grep $LFS</command>). If they are not mounted, remount them now as |