source: chapter07/stripping.xml@ 67d1e79

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 ml-11.0 multilib trunk xry111/git-transition xry111/glibc-2.34 xry111/tester-nohack xry111/usr-move
Last change on this file since 67d1e79 was 67d1e79, checked in by Thomas Trepl <thomas@…>, 18 months ago

Move stripping to chap-7

git-svn-id: 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 5.2 KB
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
8<sect1 id="ch-tools-stripping">
9 <?dbhtml filename="stripping.html"?>
11 <title>Finishing Temporary Tools</title>
13 <para>
14 The steps in this section are optional. Skip this section entirely
15 if you are not really short on disk space and do not want to create
16 a backup of the temporary tools.
17 </para>
19 <sect2>
20 <title>Stripping</title>
22 <para>If the LFS partition is rather small, it is beneficial to
23 learn that unnecessary items can be removed.
24 The executables and libraries built so far contain about 70 MB of unneeded
25 debugging symbols.</para>
27<screen><userinput>strip --strip-debug /usr/lib/*
28strip --strip-unneeded /usr/{,s}bin/*
29strip --strip-unneeded /tools/bin/*</userinput></screen>
31 <para>These commands will skip a number of files, reporting that it does not
32 recognize their file format. Most of these are scripts instead of binaries.
33 Note that we use the <command>strip</command> program built in
34 <quote>Binutils pass 1</quote>, since it is the one that knows how to strip
35 our cross-compiled programs.</para>
36 <!-- Normally, the host "strip" could be used too, since it is actually the
37 same computer. But Some old versions of binutils may generate buggy crt1.o
38 and the like, because they do not know about recently introduced symbol
39 types. For more details,
40 see>
42 <para>Take care <emphasis>not</emphasis> to use
43 <parameter>--strip-unneeded</parameter> on the libraries. The static
44 ones would be destroyed and the toolchain packages would need to be
45 built all over again.</para>
47 <para>To save more, remove the documentation:</para>
49<screen><userinput>rm -rf /usr/{,share}/{info,man,doc}</userinput></screen>
51 <para>The libtool .la files are only useful when linking with static
52 libraries. They are unneeded, and potentially harmful, when using dynamic
53 shared libraries, specially when using also non-autotools build systems.
54 Remove those files now:</para>
56<screen><userinput>find /usr/{lib,libexec} -name \*.la -delete</userinput></screen>
58 <para>At this point, you should have at least 3 GB of free space in
59 <envar>$LFS</envar> that can be used to build and install Glibc and Gcc in
60 the next phase. If you can build and install Glibc, you can build and install
61 the rest too.</para>
63 </sect2>
65 <sect2>
66 <title>Backup / Restore</title>
68 <para>
69 Now that the essential tools have been created, its time to think about
70 a backup. When every check has passed successfully in the previously
71 built packages, your temporary tools are in a good state and might be
72 backed up for later reuse. In case of fatal failures in the subsequent
73 sections, it often turns out that removing everything and starting over
74 (more carefully) is the best option to recover. Unfortunatly, all the
75 temporary tools will be removed, too. To avoid extra time to redo
76 something which has been built successfully, prepare a backup.
77 </para>
79 <para>
80 Leave the chroot environment and make sure you have at least
81 600 MB free disk space (the source tarballs will be included in
82 the backup archive) in the home directory of user
83 <systemitem class="username">lfs</systemitem>. Leaving the
84 chroot environment is required as the backup should be stored
85 outside of the <filename class="directory">$LFS</filename> directory
86 but those cannot be accessed when in chroot. Leave chroot environment
87 and unmount the virtual kernel filesystems:
88 </para>
90<screen role="nodump"><userinput>exit
91umount $LFS/dev{/pts,}
92umount $LFS/{sys,proc,run}
95 <para>Create the backup archive:</para>
96<screen role="nodump"><userinput>cd $LFS &amp;&amp;
97tar -cJpf $HOME/temp-tools.tar.xz .
100 <para>
101 In case you have to start over as some mistakes has been made, you can
102 use this backup to restore the temporary tools and save some time on
103 the way to recover. Since the sources are located under
104 <filename class="directory">$LFS</filename>, they are included in the
105 backup archive as well, so you need not to download them again. After
106 checking that <filename class="directory">$LFS</filename> is set proper,
107 restore the backup by executing the following commands:
108 </para>
110<screen role="nodump"><userinput>cd $LFS &amp;&amp;
111rm -rf ./* &amp;&amp;
112tar -xpf $HOME/temp-tools.tar.xz
115 <para>
116 Again, double check that the environment has been setup proper and
117 continue building the rest of the system.
118 </para>
120 <important>
121 <para>
122 If you left the chroot environment either to create a backup
123 or restart building using a restore, remember to mount the
124 kernel virtual filesystems as described in <xref
125 linkend='ch-tools-kernfs'/> and enter the
126 chroot environment (see <xref
127 linkend='ch-tools-chroot'/>) again before continuing.</para>
128 </important>
130 </sect2>
Note: See TracBrowser for help on using the repository browser.