aboutsummaryrefslogtreecommitdiffstats
path: root/chapter07
diff options
context:
space:
mode:
Diffstat (limited to 'chapter07')
-rw-r--r--chapter07/stripping.xml60
1 files changed, 35 insertions, 25 deletions
diff --git a/chapter07/stripping.xml b/chapter07/stripping.xml
index 1d81fff6f..6572b042e 100644
--- a/chapter07/stripping.xml
+++ b/chapter07/stripping.xml
@@ -55,28 +55,27 @@
</para>
<para>
- Leave the chroot environment and unmount the kernel virtual file
- systems:
+ Now, if you are stripping installed files or making a backup,
+ leave the chroot environment:
</para>
- <note>
+<screen role="nodump"><userinput>exit</userinput></screen>
+
+ <important>
<para>All of the following instructions are executed by
<systemitem class="username">root</systemitem>. Take extra
care about the commands you're going to run as mistakes
here can modify your host system. Be aware that the
- environment variable <envar>LFS</envar> is set for user
- <systemitem class="username">lfs</systemitem> by default
- but it might <emphasis>not</emphasis> be set for
+ environment variables <envar>LFS</envar> and <envar>LFS_TGT</envar>
+ are set for user <systemitem class="username">lfs</systemitem> by default
+ but may <emphasis>not</emphasis> be set for
<systemitem class="username">root</systemitem>. Whenever
commands are to be executed by <systemitem class="username">root</systemitem>,
- make sure you have set <envar>LFS</envar> accordingly.
+ make sure you have set <envar>LFS</envar> and <envar>LFS_TGT</envar> accordingly.
This has been discussed in <xref linkend='ch-partitioning-aboutlfs'/>.
</para>
- </note>
+ </important>
-<screen role="nodump"><userinput>exit
-umount $LFS/dev{/pts,}
-umount $LFS/{sys,proc,run}</userinput></screen>
<sect2>
<title>Stripping</title>
@@ -87,15 +86,15 @@ umount $LFS/{sys,proc,run}</userinput></screen>
symbols.</para>
<para>Strip off debugging symbols from binaries:</para>
-<screen role="nodump"><userinput>$LFS_TGT-strip --strip-unneeded $LFS/usr/lib/*
-$LFS_TGT-strip --strip-unneeded $LFS/usr/{,s}bin/*
-$LFS_TGT-strip --strip-unneeded $LFS/tools/bin/*</userinput></screen>
+
+ <screen role="nodump"><userinput>cd $LFS/tools/$LFS_TGT
+bin/strip --strip-unneeded $LFS/usr/lib/*
+bin/strip --strip-unneeded $LFS/usr/{,s}bin/*
+bin/strip --strip-unneeded $LFS/tools/bin/*</userinput></screen>
<para>These commands will skip a number of files reporting that it does not
recognize their file format. Most of these are scripts instead of binaries.
- <!--Note that we use the <command>strip</command> program built in
- <quote>Binutils pass 2</quote>, since it is the one that knows how to strip
- our cross-compiled programs.--></para>
+ </para>
<para>At this point, you should have at least 5 GB of free space on the
chroot partition that can be used to build and install Glibc and GCC in
@@ -125,14 +124,19 @@ $LFS_TGT-strip --strip-unneeded $LFS/tools/bin/*</userinput></screen>
<systemitem class="username">root</systemitem>.
</para>
+ <para>Before we make a backup, unmount the virtual file systems:</para>
+
+<screen role="nodump"><userinput>umount $LFS/dev{/pts,}
+umount $LFS/{sys,proc,run}</userinput></screen>
+
<para>
Create the backup archive by running the following command:
</para>
-<screen role="nodump" revision="sysv"><userinput>cd $LFS &amp;&amp;
+<screen role="nodump" revision="sysv"><userinput>cd $LFS
tar -cJpf $HOME/lfs-temp-tools-&version;.tar.xz .</userinput></screen>
-<screen role="nodump" revision="systemd"><userinput>cd $LFS &amp;&amp;
+<screen role="nodump" revision="systemd"><userinput>cd $LFS
tar -cJpf $HOME/lfs-temp-tools-&versiond;.tar.xz .</userinput></screen>
<para>
@@ -158,12 +162,18 @@ tar -cJpf $HOME/lfs-temp-tools-&versiond;.tar.xz .</userinput></screen>
<!-- Make the following look different so users don't blindly run the
restore when they don't need to. -->
-<screen role="nodump" revision="sysv"><computeroutput>cd $LFS &amp;&amp;
-rm -rf ./* &amp;&amp;
+ <warning><para>The following commands are extremly dangerous. If
+ you run <command>rm -rf ./*</command> as the root user and you
+ do not change to the $LFS directory or the <envar>LFS</envar>
+ environment variable is not set for the root user, it will destroy
+ your entire host system. YOU ARE WARNED.</para></warning>
+
+<screen role="nodump" revision="sysv"><computeroutput>cd $LFS
+rm -rf ./*
tar -xpf $HOME/lfs-temp-tools-&version;.tar.xz</computeroutput></screen>
-<screen role="nodump" revision="systemd"><computeroutput>cd $LFS &amp;&amp;
-rm -rf ./* &amp;&amp;
+<screen role="nodump" revision="systemd"><computeroutput>cd $LFS
+rm -rf ./*
tar -xpf $HOME/lfs-temp-tools-&versiond;.tar.xz</computeroutput></screen>
<para>
@@ -173,8 +183,8 @@ tar -xpf $HOME/lfs-temp-tools-&versiond;.tar.xz</computeroutput></screen>
<important>
<para>
- If you left the chroot environment either to strip off debug
- symbols, create a backup, or restart building using a restore,
+ If you left the chroot environment
+ to create a backup or restart building using a restore,
remember to check that the virtual filesystems are still
mounted (<command>findmnt | grep $LFS</command>).
If they are not mounted, remount them now as