mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-06-18 19:29:21 +01:00
Clarify chapter 7 stripping and backup
In chapter 7 we do not need to unmount file systems to strip binaries. Move unmounting to the backup/restore sections. Also make sure the stripping commands are valid.
This commit is contained in:
parent
adcaf07efb
commit
c649743dd6
@ -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 &&
|
||||
<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 &&
|
||||
<screen role="nodump" revision="systemd"><userinput>cd $LFS
|
||||
tar -cJpf $HOME/lfs-temp-tools-&versiond;.tar.xz .</userinput></screen>
|
||||
|
||||
<para>
|
||||
@ -158,12 +162,12 @@ 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 &&
|
||||
rm -rf ./* &&
|
||||
<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 &&
|
||||
rm -rf ./* &&
|
||||
<screen role="nodump" revision="systemd"><computeroutput>cd $LFS
|
||||
rm -rf ./*
|
||||
tar -xpf $HOME/lfs-temp-tools-&versiond;.tar.xz</computeroutput></screen>
|
||||
|
||||
<para>
|
||||
@ -173,8 +177,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
|
||||
|
Loading…
Reference in New Issue
Block a user