Changeset c649743


Ignore:
Timestamp:
08/04/2021 02:35:39 AM (3 years ago)
Author:
Bruce Dubbs <bdubbs@…>
Branches:
11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
Children:
d04ce15
Parents:
adcaf07e
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter07/stripping.xml

    radcaf07e rc649743  
    5656
    5757  <para>
    58     Leave the chroot environment and unmount the kernel virtual file
    59     systems:
     58     Now, if you are stripping installed files or making a backup,
     59     leave the chroot environment:
    6060  </para>
    6161
    62   <note>
     62<screen role="nodump"><userinput>exit</userinput></screen>
     63
     64  <important>
    6365    <para>All of the following instructions are executed by
    6466      <systemitem class="username">root</systemitem>. Take extra
    6567      care about the commands you're going to run as mistakes
    6668      here can modify your host system. Be aware that the
    67       environment variable <envar>LFS</envar> is set for user
    68       <systemitem class="username">lfs</systemitem> by default
    69       but it might <emphasis>not</emphasis> be set for
     69      environment variables <envar>LFS</envar> and <envar>LFS_TGT</envar>
     70      are set for user <systemitem class="username">lfs</systemitem> by default
     71      but may <emphasis>not</emphasis> be set for
    7072      <systemitem class="username">root</systemitem>. Whenever
    7173      commands are to be executed by <systemitem class="username">root</systemitem>,
    72       make sure you have set <envar>LFS</envar> accordingly.
     74      make sure you have set <envar>LFS</envar> and <envar>LFS_TGT</envar> accordingly.
    7375      This has been discussed in <xref linkend='ch-partitioning-aboutlfs'/>.
    7476    </para>
    75   </note>
     77  </important>
    7678
    77 <screen role="nodump"><userinput>exit
    78 umount $LFS/dev{/pts,}
    79 umount $LFS/{sys,proc,run}</userinput></screen>
    8079
    8180  <sect2>
     
    8887
    8988    <para>Strip off debugging symbols from binaries:</para>
    90 <screen role="nodump"><userinput>$LFS_TGT-strip --strip-unneeded $LFS/usr/lib/*
    91 $LFS_TGT-strip --strip-unneeded $LFS/usr/{,s}bin/*
    92 $LFS_TGT-strip --strip-unneeded $LFS/tools/bin/*</userinput></screen>
     89
     90    <screen role="nodump"><userinput>cd $LFS/tools/$LFS_TGT
     91bin/strip --strip-unneeded $LFS/usr/lib/*
     92bin/strip --strip-unneeded $LFS/usr/{,s}bin/*
     93bin/strip --strip-unneeded $LFS/tools/bin/*</userinput></screen>
    9394
    9495    <para>These commands will skip a number of files reporting that it does not
    9596    recognize their file format. Most of these are scripts instead of binaries.
    96     <!--Note that we use the <command>strip</command> program built in
    97     <quote>Binutils pass 2</quote>, since it is the one that knows how to strip
    98     our cross-compiled programs.--></para>
     97    </para>
    9998
    10099    <para>At this point, you should have at least 5 GB of free space on the
     
    126125    </para>
    127126
     127    <para>Before we make a backup, unmount the virtual file systems:</para>
     128
     129<screen role="nodump"><userinput>umount $LFS/dev{/pts,}
     130umount $LFS/{sys,proc,run}</userinput></screen>
     131
    128132    <para>
    129133      Create the backup archive by running the following command:
    130134    </para>
    131135
    132 <screen role="nodump" revision="sysv"><userinput>cd $LFS &amp;&amp;
     136<screen role="nodump" revision="sysv"><userinput>cd $LFS
    133137tar -cJpf $HOME/lfs-temp-tools-&version;.tar.xz .</userinput></screen>
    134138
    135 <screen role="nodump" revision="systemd"><userinput>cd $LFS &amp;&amp;
     139<screen role="nodump" revision="systemd"><userinput>cd $LFS
    136140tar -cJpf $HOME/lfs-temp-tools-&versiond;.tar.xz .</userinput></screen>
    137141
     
    159163     restore when they don't need to. -->
    160164
    161 <screen role="nodump" revision="sysv"><computeroutput>cd $LFS &amp;&amp;
    162 rm -rf ./* &amp;&amp;
     165<screen role="nodump" revision="sysv"><computeroutput>cd $LFS
     166rm -rf ./*
    163167tar -xpf $HOME/lfs-temp-tools-&version;.tar.xz</computeroutput></screen>
    164168
    165 <screen role="nodump" revision="systemd"><computeroutput>cd $LFS &amp;&amp;
    166 rm -rf ./* &amp;&amp;
     169<screen role="nodump" revision="systemd"><computeroutput>cd $LFS
     170rm -rf ./*
    167171tar -xpf $HOME/lfs-temp-tools-&versiond;.tar.xz</computeroutput></screen>
    168172
     
    174178    <important>
    175179      <para>
    176         If you left the chroot environment either to strip off debug
    177         symbols, create a backup, or restart building using a restore,
     180        If you left the chroot environment
     181        to create a backup or restart building using a restore,
    178182        remember to check that the virtual filesystems are still
    179183        mounted (<command>findmnt | grep $LFS</command>).
Note: See TracChangeset for help on using the changeset viewer.