Changeset b157558


Ignore:
Timestamp:
02/22/2004 10:32:27 PM (20 years ago)
Author:
Alex Gronenwoud <alex@…>
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, 6.0, 6.1, 6.1.1, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.5-systemd, 7.6, 7.6-systemd, 7.7, 7.7-systemd, 7.8, 7.8-systemd, 7.9, 7.9-systemd, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, v5_1, v5_1_1, 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:
f89de33
Parents:
cd0c92d6
Message:

Moving the final strip from the last chapter to the end of chapter 6.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@3258 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • chapter01/changelog.xml

    rcd0c92d6 rb157558  
    33<?dbhtml filename="changelog.html" dir="chapter01"?>
    44
    5 <para>&version; - &releasedate;</para>
     5<para>This is version &version; of the Linux From Scratch book, dated
     6&releasedate;. If this book is more than two months old, a newer and better
     7version is probably already available. To find out, please check one of the
     8mirrors via <ulink url="&lfs-root;"/>.</para>
     9 
     10<para>Below is a list of changes made since the previous release of the book,
     11first a summary, then a detailed log.</para>
    612
    713<itemizedlist>
     14
     15<listitem><para>Upgraded to:</para>
     16<itemizedlist>
     17<listitem><para>less-382</para></listitem>
     18<listitem><para>man-pages-1.66</para></listitem>
     19<listitem><para>ncurses-5.4</para></listitem>
     20</itemizedlist></listitem>
     21
     22<listitem><para>February 22nd, 2004 [alex]: Moved the stripping of the final
     23system from chapter 9 to the end of chapter 6.</para></listitem>
    824
    925<listitem><para>February 22nd, 2004 [alex]: Chapter 6 - Coreutils and
     
    1430command.</para></listitem>
    1531
    16 <listitem><para>February 14th, 2004 [jeremy]: Chapter 6 - Upgraded Less
    17 to 382.</para></listitem>
     32<listitem><para>February 14th, 2004 [jeremy]: Chapter 6 - Upgraded to
     33Less-382.</para></listitem>
    1834
    19 <listitem><para>February 14th, 2004 [jeremy]: Chapters 5 & 6 - Upgraded
    20 ncurses to version 5.4, and removed references to etip patch.</para></listitem>
     35<listitem><para>February 14th, 2004 [jeremy]: Chapters 5 + 6 - Upgraded to
     36Ncurses-5.4, and removed references to the etip patch.</para></listitem>
    2137
    2238<listitem><para>February 12th, 2004 [jeremy]: Chapter 6 - Removed explicit
     
    2844
    2945<listitem><para>February 8th, 2004 [matt]: Chapter 6 - Updated to
    30 man-pages-1.66.</para></listitem>
     46Man-pages-1.66.</para></listitem>
    3147
    3248<listitem><para>February 7th, 2004 [alex]: Chapter 1 - Moved the Conventions
  • chapter05/chapter05.xml

    rcd0c92d6 rb157558  
    574574<?dbhtml filename="stripping.html" dir="chapter05"?>
    575575
    576 <para>The steps in this section are optional. If your LFS partition is rather
    577 small, you will be glad to learn that you can throw away some unnecessary
    578 things. The executables and libraries you have built so far contain about 130 MB
    579 of unneeded debugging symbols. Remove those symbols like this:</para>
    580 
    581 <screen><userinput>strip --strip-unneeded /tools/{,s}bin/*
    582 strip --strip-debug /tools/lib/*</userinput></screen>
    583 
    584 <para>The first of the above commands will skip some twenty files, reporting
     576<para>The steps in this section are optional, but if your LFS partition is
     577rather small, you will be glad to learn that you can remove some unnecessary
     578things. The executables and libraries you have built so far contain about 130
     579MB of unneeded debugging symbols. Remove those symbols with:</para>
     580
     581<screen><userinput>strip --strip-debug /tools/lib/*
     582strip --strip-unneeded /tools/{,s}bin/*</userinput></screen>
     583
     584<para>The last of the above commands will skip some twenty files, reporting
    585585that it doesn't recognize their file format. Most of them are scripts instead
    586586of binaries.</para>
  • chapter06/chapter06.xml

    rcd0c92d6 rb157558  
    503503
    504504
     505<sect1 id="ch-system-aboutdebug">
     506<title>About debugging symbols</title>
     507<?dbhtml filename="aboutdebug.html" dir="chapter06"?>
     508
     509<para>Most programs and libraries are, by default, compiled with debugging
     510symbols included (with <command>gcc</command>'s <emphasis>-g</emphasis>
     511option). This means that, when debugging a program or library that was compiled
     512with debugging information included, the debugger can give you not only memory
     513addresses but also the names of the routines and variables.</para>
     514 
     515<para>The inclusion of these debugging symbols, however, enlarges a program or
     516library significantly. To get an idea of the amount of space these symbols
     517occupy, have a look at the following:</para>
     518
     519<itemizedlist>
     520
     521<listitem><para>a bash binary
     522with debugging symbols: 1200 KB</para></listitem>
     523
     524<listitem><para>a bash binary
     525without debugging symbols: 480 KB</para></listitem>
     526
     527<listitem><para>Glibc and GCC files (/lib and /usr/lib)
     528with debugging symbols: 87 MB</para></listitem>
     529
     530<listitem><para>Glibc and GCC files
     531without debugging symbols: 16 MB</para></listitem>
     532
     533</itemizedlist>
     534
     535<para>Sizes may vary somewhat, depending on which compiler was used and which C
     536library, but when comparing programs with and without debugging symbols the
     537difference will generally be a factor between 2 and 5.</para>
     538
     539<para>As most people will probably never use a debugger on their system
     540software, a lot of disk space can be regained by removing these symbols. For
     541your convenience, the next section shows how to strip all debugging symbols
     542from all programs and libraries. Information on other ways of optimizing your
     543system can be found in the hint at <ulink
     544url="&hints-root;optimization.txt"/>.</para>
     545
     546</sect1>
     547
     548
     549<sect1 id="ch-system-strippingagain">
     550<title>Stripping again</title>
     551<?dbhtml filename="strippingagain.html" dir="chapter06"?>
     552
     553<para>If you are not a programmer and don't plan to do any debugging on your
     554system software, you can shrink your system by about 200 MB by removing the
     555debugging symbols from binaries and libraries. This causes no inconvenience
     556other than not being able to debug the software fully any more.</para>
     557
     558<para>Most people who use the command mentioned below don't experience any
     559problems. But it is easy to make a typo and render your new system unusable, so
     560before running the strip command it is probably a good idea to make a backup of
     561the current situation.</para>
     562
     563<para>If you are going to perform the stripping, special care is needed to
     564ensure you're not running any of the binaries that are about to be stripped.
     565If you're not sure whether you entered chroot with the command given in
     566<xref linkend="ch-system-chroot"/>, then now exit from chroot and reenter it
     567with the following commands:</para>
     568
     569<screen><userinput>logout; chroot $LFS /tools/bin/env -i \
     570&nbsp;&nbsp;&nbsp;&nbsp;HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
     571&nbsp;&nbsp;&nbsp;&nbsp;PATH=/bin:/usr/bin:/sbin:/usr/sbin \
     572&nbsp;&nbsp;&nbsp;&nbsp;/tools/bin/bash --login</userinput></screen>
     573
     574<para>Now you can safely strip the binaries and libraries:</para>
     575
     576<screen><userinput>/tools/bin/find /{,usr/}{bin,lib,sbin} -type f \
     577&nbsp;&nbsp;&nbsp;-exec /tools/bin/strip --strip-debug '{}' ';'</userinput></screen>
     578
     579<para>A large number of files will be reported as having their file format not
     580recognized. These warnings can be safely ignored, they just mean that those
     581files are scripts instead of binaries, no harm is done.</para>
     582
     583<para>If you are really tight on disk space, you may want to use
     584<emphasis>--strip-all</emphasis> on the binaries in
     585<filename>/{,usr/}{bin,sbin}</filename> to gain several more megabytes. But do
     586<emphasis>not</emphasis> use this option on libraries: they would be
     587destroyed.</para>
     588
     589</sect1>
     590
     591
    505592<sect1 id="ch-system-revisedchroot">
    506593<title>Revised chroot command</title>
    507594<?dbhtml filename="revisedchroot.html" dir="chapter06"?>
    508595
    509 <para>From now on when you exit the chroot environment and wish to re-enter
     596<para>From now on when you exit the chroot environment and wish to reenter
    510597it, you should run the following modified chroot command:</para>
    511598
     
    522609</sect1>
    523610
    524 
    525 &c6-aboutdebug;
    526 
    527611</chapter>
    528612
  • chapter08/kernel.xml

    rcd0c92d6 rb157558  
    7575<screen><userinput>make CC=/opt/gcc-2.95.3/bin/gcc modules_install</userinput></screen>
    7676
     77<para>If you have a lot of modules and very little space, you may want to
     78consider stripping and compressing the modules. For most people such compression
     79isn't worth the trouble, but if you're really pressed for space, then have a look at
     80<ulink url="http://www.linux-mips.org/archives/linux-mips/2002-04/msg00031.html"/>.</para>
     81
    7782<para>As nothing is complete without documentation, build the manual pages
    7883that come with the kernel:</para>
  • chapter09/theend.xml

    rcd0c92d6 rb157558  
    66been a long process, but we hope it was worth it. We wish you a lot of fun
    77with your new shiny custom built Linux system.</para>
    8 
    9 <para>Now would be a good time to strip all debug symbols from
    10 the binaries on your LFS system. If you are not a programmer and don't plan
    11 on debugging your software, then you will be happy to know that you can
    12 reclaim a few tens of megs by removing debug symbols. This process causes
    13 no inconvenience other than not being able to debug the software fully
    14 anymore, which is not an issue if you don't know how to debug.</para>
    15 
    16 <para>Disclaimer: 98% of the people who use the command mentioned below don't
    17 experience any problems. But do make a backup of your LFS system before
    18 you run this command. There's a slight chance it may backfire on you and
    19 render your system unusable (mostly by destroying your kernel modules
    20 and dynamic &amp; shared libraries). This is caused more often by typos
    21 than by a problem with the command used.</para>
    22 
    23 <para>Having said that, the --strip-debug option we use to strip is quite
    24 harmless under normal circumstances. It doesn't strip anything vital from
    25 the files. It also is quite safe to use --strip-all on regular programs
    26 (don't use that on libraries - they will be destroyed), but it's not as
    27 safe, and the space you gain is not all that much. But if you're tight on
    28 disk space every little bit helps, so decide for yourself. Please refer to
    29 the strip man page for other strip options you can use. The general idea
    30 is to not run strip on libraries (other than --strip-debug), just to be
    31 on the safe side.</para>
    32 
    33 <para>If you are planning to go ahead and perform the strip, special care is
    34 needed to ensure you're not running any binaries that are about to be stripped
    35 -- including the active bash shell. Therefore you'll need to exit the chroot
    36 environment and reenter it using a modified chroot command:</para>
    37 
    38 <screen><userinput>logout
    39 chroot $LFS /tools/bin/env -i \
    40 &nbsp;&nbsp;&nbsp;&nbsp;HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
    41 &nbsp;&nbsp;&nbsp;&nbsp;PATH=/bin:/usr/bin:/sbin:/usr/sbin \
    42 &nbsp;&nbsp;&nbsp;&nbsp;/tools/bin/bash --login</userinput></screen>
    43 
    44 <para>Now run the following command:</para>
    45 
    46 <screen><userinput>/tools/bin/find /{,usr/,usr/local/}{bin,sbin,lib} -type f \
    47 &nbsp;&nbsp;&nbsp;-exec /tools/bin/strip --strip-debug '{}' ';'</userinput></screen>
    48 
    49 <para>Quite a number of files will be reported as having their file format not
    50 recognized. Most of these are scripts instead of binaries. These warnings can
    51 be safely ignored.</para>
    528
    539<para>It may be a good idea to create an <filename>/etc/lfs-release</filename>
Note: See TracChangeset for help on using the changeset viewer.