strippingagain.xml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
  3. <!ENTITY % general-entities SYSTEM "../general.ent">
  4. %general-entities;
  5. ]>
  6. <sect1 id="ch-system-strippingagain">
  7. <title>Stripping Again</title>
  8. <?dbhtml filename="strippingagain.html"?>
  9. <para>If the intended user is not a programmer and does not plan to do
  10. any debugging on the system software, the system size can be decreased
  11. by about 200 MB by removing the debugging symbols from binaries and
  12. libraries. This causes no inconvenience other than not being able to
  13. debug the software fully anymore.</para>
  14. <para>Most people who use the command mentioned below do not
  15. experience any difficulties. However, it is easy to make a typo and
  16. render the new system unusable, so before running the
  17. <command>strip</command> command, it is a good idea to make a
  18. backup of the current situation.</para>
  19. <para>Before performing the stripping, take special care to ensure that
  20. none of the binaries that are about to be stripped are running. If
  21. unsure whether the user entered chroot with the command given in
  22. <xref linkend="ch-system-chroot" role=","/> first exit from
  23. chroot:</para>
  24. <screen><userinput>logout</userinput></screen>
  25. <para>Then reenter it with:</para>
  26. <screen><userinput>chroot $LFS /tools/bin/env -i \
  27. HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
  28. PATH=/bin:/usr/bin:/sbin:/usr/sbin \
  29. /tools/bin/bash --login</userinput></screen>
  30. <para>Now the binaries and libraries can be safely stripped:</para>
  31. <screen><userinput>/tools/bin/find /{,usr/}{bin,lib,sbin} -type f \
  32. -exec /tools/bin/strip --strip-debug '{}' ';'</userinput></screen>
  33. <para>A large number of files will be reported as having their file
  34. format not recognized. These warnings can be safely ignored. These
  35. warnings indicate that those files are scripts instead of
  36. binaries.</para>
  37. <para>If disk space is very tight, the
  38. <parameter>--strip-all</parameter> option can be used on the binaries
  39. in <filename class="directory">/{,usr/}{bin,sbin}</filename> to gain
  40. several more megabytes. Do not use this option on libraries&mdash;they will
  41. be destroyed.</para>
  42. </sect1>