mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-06-19 03:39:20 +01:00
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
This commit is contained in:
parent
cd0c92d633
commit
b157558174
@ -2,10 +2,26 @@
|
||||
<title>Changelog</title>
|
||||
<?dbhtml filename="changelog.html" dir="chapter01"?>
|
||||
|
||||
<para>&version; - &releasedate;</para>
|
||||
<para>This is version &version; of the Linux From Scratch book, dated
|
||||
&releasedate;. If this book is more than two months old, a newer and better
|
||||
version is probably already available. To find out, please check one of the
|
||||
mirrors via <ulink url="&lfs-root;"/>.</para>
|
||||
|
||||
<para>Below is a list of changes made since the previous release of the book,
|
||||
first a summary, then a detailed log.</para>
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para>Upgraded to:</para>
|
||||
<itemizedlist>
|
||||
<listitem><para>less-382</para></listitem>
|
||||
<listitem><para>man-pages-1.66</para></listitem>
|
||||
<listitem><para>ncurses-5.4</para></listitem>
|
||||
</itemizedlist></listitem>
|
||||
|
||||
<listitem><para>February 22nd, 2004 [alex]: Moved the stripping of the final
|
||||
system from chapter 9 to the end of chapter 6.</para></listitem>
|
||||
|
||||
<listitem><para>February 22nd, 2004 [alex]: Chapter 6 - Coreutils and
|
||||
E2fsprogs: Clarified the prerequisites for running the tests.</para></listitem>
|
||||
|
||||
@ -13,11 +29,11 @@ E2fsprogs: Clarified the prerequisites for running the tests.</para></listitem>
|
||||
an unnecessary "{,share/}" from the documentation's <command>rm</command>
|
||||
command.</para></listitem>
|
||||
|
||||
<listitem><para>February 14th, 2004 [jeremy]: Chapter 6 - Upgraded Less
|
||||
to 382.</para></listitem>
|
||||
<listitem><para>February 14th, 2004 [jeremy]: Chapter 6 - Upgraded to
|
||||
Less-382.</para></listitem>
|
||||
|
||||
<listitem><para>February 14th, 2004 [jeremy]: Chapters 5 & 6 - Upgraded
|
||||
ncurses to version 5.4, and removed references to etip patch.</para></listitem>
|
||||
<listitem><para>February 14th, 2004 [jeremy]: Chapters 5 + 6 - Upgraded to
|
||||
Ncurses-5.4, and removed references to the etip patch.</para></listitem>
|
||||
|
||||
<listitem><para>February 12th, 2004 [jeremy]: Chapter 6 - Removed explicit
|
||||
paths from the pwconv and grpconv commands, since /usr/sbin is part of
|
||||
@ -27,7 +43,7 @@ the default path.</para></listitem>
|
||||
installation section to chapter 7.</para></listitem>
|
||||
|
||||
<listitem><para>February 8th, 2004 [matt]: Chapter 6 - Updated to
|
||||
man-pages-1.66.</para></listitem>
|
||||
Man-pages-1.66.</para></listitem>
|
||||
|
||||
<listitem><para>February 7th, 2004 [alex]: Chapter 1 - Moved the Conventions
|
||||
and Acknowledgements sections to the Preface.</para></listitem>
|
||||
|
@ -573,15 +573,15 @@ ensuring to cut-and-paste the commands as was recommended.</para>
|
||||
<title>Stripping</title>
|
||||
<?dbhtml filename="stripping.html" dir="chapter05"?>
|
||||
|
||||
<para>The steps in this section are optional. If your LFS partition is rather
|
||||
small, you will be glad to learn that you can throw away some unnecessary
|
||||
things. The executables and libraries you have built so far contain about 130 MB
|
||||
of unneeded debugging symbols. Remove those symbols like this:</para>
|
||||
<para>The steps in this section are optional, but if your LFS partition is
|
||||
rather small, you will be glad to learn that you can remove some unnecessary
|
||||
things. The executables and libraries you have built so far contain about 130
|
||||
MB of unneeded debugging symbols. Remove those symbols with:</para>
|
||||
|
||||
<screen><userinput>strip --strip-unneeded /tools/{,s}bin/*
|
||||
strip --strip-debug /tools/lib/*</userinput></screen>
|
||||
<screen><userinput>strip --strip-debug /tools/lib/*
|
||||
strip --strip-unneeded /tools/{,s}bin/*</userinput></screen>
|
||||
|
||||
<para>The first of the above commands will skip some twenty files, reporting
|
||||
<para>The last of the above commands will skip some twenty files, reporting
|
||||
that it doesn't recognize their file format. Most of them are scripts instead
|
||||
of binaries.</para>
|
||||
|
||||
|
@ -502,11 +502,98 @@ Most likely something went wrong with the specs file amendment above.</para>
|
||||
&c6-gcc-2953;
|
||||
|
||||
|
||||
<sect1 id="ch-system-aboutdebug">
|
||||
<title>About debugging symbols</title>
|
||||
<?dbhtml filename="aboutdebug.html" dir="chapter06"?>
|
||||
|
||||
<para>Most programs and libraries are, by default, compiled with debugging
|
||||
symbols included (with <command>gcc</command>'s <emphasis>-g</emphasis>
|
||||
option). This means that, when debugging a program or library that was compiled
|
||||
with debugging information included, the debugger can give you not only memory
|
||||
addresses but also the names of the routines and variables.</para>
|
||||
|
||||
<para>The inclusion of these debugging symbols, however, enlarges a program or
|
||||
library significantly. To get an idea of the amount of space these symbols
|
||||
occupy, have a look at the following:</para>
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para>a bash binary
|
||||
with debugging symbols: 1200 KB</para></listitem>
|
||||
|
||||
<listitem><para>a bash binary
|
||||
without debugging symbols: 480 KB</para></listitem>
|
||||
|
||||
<listitem><para>Glibc and GCC files (/lib and /usr/lib)
|
||||
with debugging symbols: 87 MB</para></listitem>
|
||||
|
||||
<listitem><para>Glibc and GCC files
|
||||
without debugging symbols: 16 MB</para></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
<para>Sizes may vary somewhat, depending on which compiler was used and which C
|
||||
library, but when comparing programs with and without debugging symbols the
|
||||
difference will generally be a factor between 2 and 5.</para>
|
||||
|
||||
<para>As most people will probably never use a debugger on their system
|
||||
software, a lot of disk space can be regained by removing these symbols. For
|
||||
your convenience, the next section shows how to strip all debugging symbols
|
||||
from all programs and libraries. Information on other ways of optimizing your
|
||||
system can be found in the hint at <ulink
|
||||
url="&hints-root;optimization.txt"/>.</para>
|
||||
|
||||
</sect1>
|
||||
|
||||
|
||||
<sect1 id="ch-system-strippingagain">
|
||||
<title>Stripping again</title>
|
||||
<?dbhtml filename="strippingagain.html" dir="chapter06"?>
|
||||
|
||||
<para>If you are not a programmer and don't plan to do any debugging on your
|
||||
system software, you can shrink your system by about 200 MB by removing the
|
||||
debugging symbols from binaries and libraries. This causes no inconvenience
|
||||
other than not being able to debug the software fully any more.</para>
|
||||
|
||||
<para>Most people who use the command mentioned below don't experience any
|
||||
problems. But it is easy to make a typo and render your new system unusable, so
|
||||
before running the strip command it is probably a good idea to make a backup of
|
||||
the current situation.</para>
|
||||
|
||||
<para>If you are going to perform the stripping, special care is needed to
|
||||
ensure you're not running any of the binaries that are about to be stripped.
|
||||
If you're not sure whether you entered chroot with the command given in
|
||||
<xref linkend="ch-system-chroot"/>, then now exit from chroot and reenter it
|
||||
with the following commands:</para>
|
||||
|
||||
<screen><userinput>logout; chroot $LFS /tools/bin/env -i \
|
||||
HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
|
||||
/tools/bin/bash --login</userinput></screen>
|
||||
|
||||
<para>Now you can safely strip the binaries and libraries:</para>
|
||||
|
||||
<screen><userinput>/tools/bin/find /{,usr/}{bin,lib,sbin} -type f \
|
||||
-exec /tools/bin/strip --strip-debug '{}' ';'</userinput></screen>
|
||||
|
||||
<para>A large number of files will be reported as having their file format not
|
||||
recognized. These warnings can be safely ignored, they just mean that those
|
||||
files are scripts instead of binaries, no harm is done.</para>
|
||||
|
||||
<para>If you are really tight on disk space, you may want to use
|
||||
<emphasis>--strip-all</emphasis> on the binaries in
|
||||
<filename>/{,usr/}{bin,sbin}</filename> to gain several more megabytes. But do
|
||||
<emphasis>not</emphasis> use this option on libraries: they would be
|
||||
destroyed.</para>
|
||||
|
||||
</sect1>
|
||||
|
||||
|
||||
<sect1 id="ch-system-revisedchroot">
|
||||
<title>Revised chroot command</title>
|
||||
<?dbhtml filename="revisedchroot.html" dir="chapter06"?>
|
||||
|
||||
<para>From now on when you exit the chroot environment and wish to re-enter
|
||||
<para>From now on when you exit the chroot environment and wish to reenter
|
||||
it, you should run the following modified chroot command:</para>
|
||||
|
||||
<screen><userinput>chroot $LFS /usr/bin/env -i \
|
||||
@ -521,8 +608,5 @@ just yet. There is still some use for it towards the end of the book.</para>
|
||||
|
||||
</sect1>
|
||||
|
||||
|
||||
&c6-aboutdebug;
|
||||
|
||||
</chapter>
|
||||
|
||||
|
@ -74,6 +74,11 @@ interest to you.</para>
|
||||
|
||||
<screen><userinput>make CC=/opt/gcc-2.95.3/bin/gcc modules_install</userinput></screen>
|
||||
|
||||
<para>If you have a lot of modules and very little space, you may want to
|
||||
consider stripping and compressing the modules. For most people such compression
|
||||
isn't worth the trouble, but if you're really pressed for space, then have a look at
|
||||
<ulink url="http://www.linux-mips.org/archives/linux-mips/2002-04/msg00031.html"/>.</para>
|
||||
|
||||
<para>As nothing is complete without documentation, build the manual pages
|
||||
that come with the kernel:</para>
|
||||
|
||||
|
@ -6,50 +6,6 @@
|
||||
been a long process, but we hope it was worth it. We wish you a lot of fun
|
||||
with your new shiny custom built Linux system.</para>
|
||||
|
||||
<para>Now would be a good time to strip all debug symbols from
|
||||
the binaries on your LFS system. If you are not a programmer and don't plan
|
||||
on debugging your software, then you will be happy to know that you can
|
||||
reclaim a few tens of megs by removing debug symbols. This process causes
|
||||
no inconvenience other than not being able to debug the software fully
|
||||
anymore, which is not an issue if you don't know how to debug.</para>
|
||||
|
||||
<para>Disclaimer: 98% of the people who use the command mentioned below don't
|
||||
experience any problems. But do make a backup of your LFS system before
|
||||
you run this command. There's a slight chance it may backfire on you and
|
||||
render your system unusable (mostly by destroying your kernel modules
|
||||
and dynamic & shared libraries). This is caused more often by typos
|
||||
than by a problem with the command used.</para>
|
||||
|
||||
<para>Having said that, the --strip-debug option we use to strip is quite
|
||||
harmless under normal circumstances. It doesn't strip anything vital from
|
||||
the files. It also is quite safe to use --strip-all on regular programs
|
||||
(don't use that on libraries - they will be destroyed), but it's not as
|
||||
safe, and the space you gain is not all that much. But if you're tight on
|
||||
disk space every little bit helps, so decide for yourself. Please refer to
|
||||
the strip man page for other strip options you can use. The general idea
|
||||
is to not run strip on libraries (other than --strip-debug), just to be
|
||||
on the safe side.</para>
|
||||
|
||||
<para>If you are planning to go ahead and perform the strip, special care is
|
||||
needed to ensure you're not running any binaries that are about to be stripped
|
||||
-- including the active bash shell. Therefore you'll need to exit the chroot
|
||||
environment and reenter it using a modified chroot command:</para>
|
||||
|
||||
<screen><userinput>logout
|
||||
chroot $LFS /tools/bin/env -i \
|
||||
HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
|
||||
/tools/bin/bash --login</userinput></screen>
|
||||
|
||||
<para>Now run the following command:</para>
|
||||
|
||||
<screen><userinput>/tools/bin/find /{,usr/,usr/local/}{bin,sbin,lib} -type f \
|
||||
-exec /tools/bin/strip --strip-debug '{}' ';'</userinput></screen>
|
||||
|
||||
<para>Quite a number of files will be reported as having their file format not
|
||||
recognized. Most of these are scripts instead of binaries. These warnings can
|
||||
be safely ignored.</para>
|
||||
|
||||
<para>It may be a good idea to create an <filename>/etc/lfs-release</filename>
|
||||
file. By having this file it is very easy for you (and for us if you are going
|
||||
to ask for help with something at some point) to find out which LFS version
|
||||
|
Loading…
Reference in New Issue
Block a user