Changeset 302d97a


Ignore:
Timestamp:
06/11/2020 12:14:42 PM (4 years ago)
Author:
Thomas Trepl <thomas@…>
Branches:
10.0, 10.0-rc1, 10.1, 10.1-rc1, 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:
fb386e0
Parents:
aefc822
Message:

Restructure ch7-stripping

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross2@11920 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter07/stripping.xml

    raefc822 r302d97a  
    1717  </para>
    1818
     19  <para>
     20    The following steps are performed from outside the chroot
     21    environment. That means, you have to leave the chroot environment
     22    first before continuing. The reason for that is to
     23    <itemizedlist>
     24      <listitem>
     25        <para>
     26          make sure that objects are not in use while they gets
     27          manipulated.
     28        </para>
     29      </listitem>
     30      <listitem>
     31        <para>
     32          get access to file system locations outside of the chroot
     33          environment to store/read the backup archive which should
     34          not be placed within the
     35          <filename class="directory">$LFS</filename> hierarchy for
     36          safety reasons.
     37        </para>
     38      </listitem>
     39    </itemizedlist>
     40  </para>
     41
     42  <para>
     43    Leave the chroot environment and unmount the kernel virtual file
     44    systems:
     45  </para>
     46
     47<screen role="nodump"><userinput>exit
     48umount $LFS/dev{/pts,}
     49umount $LFS/{sys,proc,run}</userinput></screen>
     50
     51  <note>
     52    <para>All of the following instructions are executed by
     53      <systemitem class="username">root</systemitem>. Take extra
     54      care about the commands you're going to run as mistakes
     55      here can modify your host system. Be aware that the
     56      environment variable <envar>LFS</envar> is set for user
     57      <systemitem class="username">lfs</systemitem> by default
     58      but it might <emphasis>not</emphasis> be set for
     59      <systemitem class="username">root</systemitem>. Whenever
     60      commands are to be executed by <systemitem class="username">root</systemitem>,
     61      make sure you have set <envar>LFS</envar> accordingly.
     62      This has been discussed in <xref linkend='ch-partitioning-aboutlfs'/>.
     63    </para>
     64  </note>
     65
    1966  <sect2>
    2067    <title>Stripping</title>
    2168
    2269    <para>If the LFS partition is rather small, it is beneficial to
    23     learn that unnecessary items can be removed.
    24     The executables and libraries built so far contain about 70 MB of unneeded
    25     debugging symbols.</para>
     70    learn that unnecessary items can be removed. The executables and
     71    libraries built so far contain about 94 MB of unneeded debugging
     72    symbols.</para>
    2673
    27 <screen><userinput>strip --strip-debug /usr/lib/*
    28 strip --strip-unneeded /usr/{,s}bin/*
    29 strip --strip-unneeded /tools/bin/*</userinput></screen>
     74    <para>Strip off debugging symbols from binaries:</para>
     75<screen role="nodump"><userinput>strip --strip-debug $LFS/usr/lib/*
     76strip --strip-unneeded $LFS/usr/{,s}bin/*
     77strip --strip-unneeded $LFS/tools/bin/*</userinput></screen>
    3078
    3179    <para>These commands will skip a number of files reporting that it does not
    3280    recognize their file format. Most of these are scripts instead of binaries.
    3381    <!--Note that we use the <command>strip</command> program built in
    34     <quote>Binutils pass 1</quote>, since it is the one that knows how to strip
     82    <quote>Binutils pass 2</quote>, since it is the one that knows how to strip
    3583    our cross-compiled programs.--></para>
    3684
     
    4088    built all over again.</para>
    4189
    42     <para>To save more space, remove the documentation:</para>
     90    <para>To save more space (about 37 MB), remove the documentation:</para>
    4391
    44 <screen><userinput>rm -rf /usr/{,share}/{info,man,doc}</userinput></screen>
     92<screen role="nodump"><userinput>rm -rf $LFS/usr/share/{info,man,doc}</userinput></screen>
    4593
    4694    <para>The libtool .la files are only useful when linking with static
     
    4997    Remove those files now:</para>
    5098
    51 <screen><userinput>find /usr/{lib,libexec} -name \*.la -delete</userinput></screen>
     99<screen role="nodump"><userinput>find $LFS/usr/{lib,libexec} -name \*.la -delete</userinput></screen>
    52100
    53101    <para>At this point, you should have at least 5 GB of free space on the
     
    55103    the next phase. If you can build and install Glibc, you can build and install
    56104    the rest too. You can check the free disk space with the command
    57     <command>df -h /</command>.</para>
     105    <command>df -h $LFS/</command>.</para>
    58106
    59107  </sect2>
     
    69117      chapters, it often turns out that removing everything and starting over
    70118      (more carefully) is the best option to recover. Unfortunatly, all the
    71       temporary tools will be removed, too. To avoid the extra time needed to redo
    72       something which has been built successfully, prepare a backup.
     119      temporary tools will be removed, too. To avoid spending extra time to
     120      redo something which has been built successfully, prepare a backup.
    73121    </para>
    74122
    75123    <para>
    76       Leave the chroot environment and make sure you have at least
    77       600 MB free disk space (the source tarballs will be included in
    78       the backup archive) in the home directory of user
    79       <systemitem class="username">lfs</systemitem>. Leaving the
    80       chroot environment is required as the backup should be stored
    81       outside of the <filename class="directory">$LFS</filename> directory
    82       but those cannot be accessed when in chroot. Leave the chroot environment
    83       and unmount the virtual kernel filesystems:
     124      Make sure you have at least 600 MB free disk space (the source tarballs
     125      will be included in the backup archive) in the home directory of user
     126      <systemitem class="username">root</systemitem>.
    84127    </para>
    85128
    86 <screen role="nodump"><userinput>exit
    87 umount $LFS/dev{/pts,}
    88 umount $LFS/{sys,proc,run}</userinput></screen>
    89 
    90     <para>Create the backup archive:</para>
     129    <para>
     130      Create the backup archive by running the following command:
     131    </para>
    91132<screen role="nodump"><userinput>cd $LFS &amp;&amp;
    92133tar -cJpf $HOME/temp-tools.tar.xz .
    93134</userinput></screen>
     135    <para>
     136      Replace <envar>$HOME</envar> by a directory of your choice if you
     137      do not want to have the backup stored in <systemitem class="username">root</systemitem>'s
     138      home directory.
     139    </para>
    94140
    95141    <para>
     
    115161    <important>
    116162      <para>
    117       If you left the chroot environment either to create a backup
    118       or restart building using a restore, remember to mount the
    119       kernel virtual filesystems as described in <xref
    120       linkend='ch-tools-kernfs'/> and re-enter the
    121       chroot environment (see <xref
    122       linkend='ch-tools-chroot'/>) again before continuing.</para>
     163        If you left the chroot environment either to strip off debug
     164        symbols, create a backup or restart building using a restore,
     165        remember to mount the kernel virtual filesystems now again as
     166        described in <xref linkend='ch-tools-kernfs'/> and re-enter
     167        the chroot environment (see <xref linkend='ch-tools-chroot'/>)
     168        again before continuing.
     169      </para>
    123170    </important>
    124171   
Note: See TracChangeset for help on using the changeset viewer.