source: chapter07/stripping.xml@ bc8cca5

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since bc8cca5 was 67d1e79, checked in by Thomas Trepl <thomas@…>, 4 years ago

Move stripping to chap-7

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

  • Property mode set to 100644
File size: 5.2 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-tools-stripping">
9 <?dbhtml filename="stripping.html"?>
10
11 <title>Finishing Temporary Tools</title>
12
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>
18
19 <sect2>
20 <title>Stripping</title>
21
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>
26
27<screen><userinput>strip --strip-debug /usr/lib/*
28strip --strip-unneeded /usr/{,s}bin/*
29strip --strip-unneeded /tools/bin/*</userinput></screen>
30
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 https://sourceware.org/bugzilla/show_bug.cgi?id=22875-->
41
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>
46
47 <para>To save more, remove the documentation:</para>
48
49<screen><userinput>rm -rf /usr/{,share}/{info,man,doc}</userinput></screen>
50
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>
55
56<screen><userinput>find /usr/{lib,libexec} -name \*.la -delete</userinput></screen>
57
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>
62
63 </sect2>
64
65 <sect2>
66 <title>Backup / Restore</title>
67
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>
78
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>
89
90<screen role="nodump"><userinput>exit
91umount $LFS/dev{/pts,}
92umount $LFS/{sys,proc,run}
93</userinput></screen>
94
95 <para>Create the backup archive:</para>
96<screen role="nodump"><userinput>cd $LFS &amp;&amp;
97tar -cJpf $HOME/temp-tools.tar.xz .
98</userinput></screen>
99
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>
109
110<screen role="nodump"><userinput>cd $LFS &amp;&amp;
111rm -rf ./* &amp;&amp;
112tar -xpf $HOME/temp-tools.tar.xz
113</userinput></screen>
114
115 <para>
116 Again, double check that the environment has been setup proper and
117 continue building the rest of the system.
118 </para>
119
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>
129
130 </sect2>
131
132</sect1>
Note: See TracBrowser for help on using the repository browser.