source: chapter06/strippingagain.xml@ 0c81bec

Last change on this file since 0c81bec was 6a0e6f3, checked in by Matthew Burgess <matthew@…>, 20 years ago
  • Remove the spurious <info> tags that I thought were necessary but evidently aren't

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

  • Property mode set to 100644
File size: 2.1 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE section [
3]>
4<section xmlns="http://docbook.org/docbook-ng"
5 xml:id="ch-system-strippingagain">
6<title>Stripping again</title>
7<?dbhtml filename="strippingagain.html"?>
8
9<para>If you are not a programmer and don't plan to do any debugging on your
10system software, you can shrink your system by about 200 MB by removing the
11debugging symbols from binaries and libraries. This causes no inconvenience
12other than not being able to debug the software fully any more.</para>
13
14<para>Most people who use the command mentioned below don't experience any
15problems. But it is easy to make a typo and render your new system unusable, so
16before running the strip command it is probably a good idea to make a backup of
17the current situation.</para>
18
19<para>If you are going to perform the stripping, special care is needed to
20ensure you're not running any of the binaries that are about to be stripped.
21If you're not sure whether you entered chroot with the command given in
22<xref linkend="ch-system-chroot"/>, then first exit from chroot:</para>
23
24<screen><userinput>logout</userinput></screen>
25
26<para>Then reenter it with:</para>
27
28<screen><userinput>chroot $LFS /tools/bin/env -i \
29 HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
30 PATH=/bin:/usr/bin:/sbin:/usr/sbin \
31 /tools/bin/bash --login</userinput></screen>
32
33<para>Now you can safely strip the binaries and libraries:</para>
34
35<screen><userinput>/tools/bin/find /{,usr/}{bin,lib,sbin} -type f \
36 -exec /tools/bin/strip --strip-debug '{}' ';'</userinput></screen>
37
38<para>A large number of files will be reported as having their file format not
39recognized. These warnings can be safely ignored, they just mean that those
40files are scripts instead of binaries, no harm is done.</para>
41
42<para>If you are really tight on disk space, you may want to use
43<parameter>--strip-all</parameter> on the binaries in
44<filename class="directory">/{,usr/}{bin,sbin}</filename> to gain several more megabytes. But do
45<emphasis>not</emphasis> use this option on libraries: they would be
46destroyed.</para>
47
48</section>
49
Note: See TracBrowser for help on using the repository browser.