source: chapter07/stripping.xml@ aefc822

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 aefc822 was aefc822, checked in by Bruce Dubbs <bdubbs@…>, 18 months ago

Updates to the rest of cross2 Chapter 7.

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

  • Property mode set to 100644
File size: 5.0 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>
37 <para>Take care <emphasis>NOT</emphasis> to use
38 <parameter>--strip-unneeded</parameter> on the libraries. The static
39 ones would be destroyed and the toolchain packages would need to be
40 built all over again.</para>
42 <para>To save more space, remove the documentation:</para>
44<screen><userinput>rm -rf /usr/{,share}/{info,man,doc}</userinput></screen>
46 <para>The libtool .la files are only useful when linking with static
47 libraries. They are unneeded, and potentially harmful, when using dynamic
48 shared libraries, specially when using non-autotools build systems.
49 Remove those files now:</para>
51<screen><userinput>find /usr/{lib,libexec} -name \*.la -delete</userinput></screen>
53 <para>At this point, you should have at least 5 GB of free space on the
54 chroot partition that can be used to build and install Glibc and Gcc in
55 the next phase. If you can build and install Glibc, you can build and install
56 the rest too. You can check the free disk space with the command
57 <command>df -h /</command>.</para>
59 </sect2>
61 <sect2>
62 <title>Backup / Restore</title>
64 <para>
65 Now that the essential tools have been created, its time to think about
66 a backup. When every check has passed successfully in the previously
67 built packages, your temporary tools are in a good state and might be
68 backed up for later reuse. In case of fatal failures in the subsequent
69 chapters, it often turns out that removing everything and starting over
70 (more carefully) is the best option to recover. Unfortunatly, all the
71 temporary tools will be removed, too. To avoid the extra time needed to redo
72 something which has been built successfully, prepare a backup.
73 </para>
75 <para>
76 Leave the chroot environment and make sure you have at least
77 600 MB free disk space (the source tarballs will be included in
78 the backup archive) in the home directory of user
79 <systemitem class="username">lfs</systemitem>. Leaving the
80 chroot environment is required as the backup should be stored
81 outside of the <filename class="directory">$LFS</filename> directory
82 but those cannot be accessed when in chroot. Leave the chroot environment
83 and unmount the virtual kernel filesystems:
84 </para>
86<screen role="nodump"><userinput>exit
87umount $LFS/dev{/pts,}
88umount $LFS/{sys,proc,run}</userinput></screen>
90 <para>Create the backup archive:</para>
91<screen role="nodump"><userinput>cd $LFS &amp;&amp;
92tar -cJpf $HOME/temp-tools.tar.xz .
95 <para>
96 In case some mistakes have been made and you need to start over, you can
97 use this backup to restore the temporary tools and save some irecovery time.
98 Since the sources are located under
99 <filename class="directory">$LFS</filename>, they are included in the
100 backup archive as well, so you need not to download them again. After
101 checking that <filename class="directory">$LFS</filename> is set properly,
102 restore the backup by executing the following commands:
103 </para>
105<screen role="nodump"><userinput>cd $LFS &amp;&amp;
106rm -rf ./* &amp;&amp;
107tar -xpf $HOME/temp-tools.tar.xz
110 <para>
111 Again, double check that the environment has been setup properly
112 and continue building the rest of the system.
113 </para>
115 <important>
116 <para>
117 If you left the chroot environment either to create a backup
118 or restart building using a restore, remember to mount the
119 kernel virtual filesystems as described in <xref
120 linkend='ch-tools-kernfs'/> and re-enter the
121 chroot environment (see <xref
122 linkend='ch-tools-chroot'/>) again before continuing.</para>
123 </important>
125 </sect2>
Note: See TracBrowser for help on using the repository browser.