1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
|
---|
3 | <sect1 id="ch-system-strippingagain">
|
---|
4 | <title>Stripping again</title>
|
---|
5 | <?dbhtml filename="strippingagain.html"?>
|
---|
6 |
|
---|
7 | <para>If you are not a programmer and don't plan to do any debugging on your
|
---|
8 | system software, you can shrink your system by about 200 MB by removing the
|
---|
9 | debugging symbols from binaries and libraries. This causes no inconvenience
|
---|
10 | other than not being able to debug the software fully any more.</para>
|
---|
11 |
|
---|
12 | <para>Most people who use the command mentioned below don't experience any
|
---|
13 | problems. But it is easy to make a typo and render your new system unusable, so
|
---|
14 | before running the strip command it is probably a good idea to make a backup of
|
---|
15 | the current situation.</para>
|
---|
16 |
|
---|
17 | <para>If you are going to perform the stripping, special care is needed to
|
---|
18 | ensure you're not running any of the binaries that are about to be stripped.
|
---|
19 | If you're not sure whether you entered chroot with the command given in
|
---|
20 | <xref linkend="ch-system-chroot"/>, then first exit from chroot:</para>
|
---|
21 |
|
---|
22 | <screen><userinput>logout</userinput></screen>
|
---|
23 |
|
---|
24 | <para>Then reenter it with:</para>
|
---|
25 |
|
---|
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 |
|
---|
31 | <para>Now you can safely strip the binaries and libraries:</para>
|
---|
32 |
|
---|
33 | <screen><userinput>/tools/bin/find /{,usr/}{bin,lib,sbin} -type f \
|
---|
34 | -exec /tools/bin/strip --strip-debug '{}' ';'</userinput></screen>
|
---|
35 |
|
---|
36 | <para>A large number of files will be reported as having their file format not
|
---|
37 | recognized. These warnings can be safely ignored, they just mean that those
|
---|
38 | files are scripts instead of binaries, no harm is done.</para>
|
---|
39 |
|
---|
40 | <para>If you are really tight on disk space, you may want to use
|
---|
41 | <parameter>--strip-all</parameter> on the binaries in
|
---|
42 | <filename class="directory">/{,usr/}{bin,sbin}</filename> to gain several more megabytes. But do
|
---|
43 | <emphasis>not</emphasis> use this option on libraries: they would be
|
---|
44 | destroyed.</para>
|
---|
45 |
|
---|
46 | </sect1>
|
---|
47 |
|
---|