mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-06-19 11:49:20 +01:00
Restructure ch7-stripping
git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross2@11920 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
parent
aefc8221f5
commit
302d97aaab
@ -16,22 +16,70 @@
|
|||||||
a backup of the temporary tools.
|
a backup of the temporary tools.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
The following steps are performed from outside the chroot
|
||||||
|
environment. That means, you have to leave the chroot environment
|
||||||
|
first before continuing. The reason for that is to
|
||||||
|
<itemizedlist>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
make sure that objects are not in use while they gets
|
||||||
|
manipulated.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
get access to file system locations outside of the chroot
|
||||||
|
environment to store/read the backup archive which should
|
||||||
|
not be placed within the
|
||||||
|
<filename class="directory">$LFS</filename> hierarchy for
|
||||||
|
safety reasons.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</itemizedlist>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Leave the chroot environment and unmount the kernel virtual file
|
||||||
|
systems:
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<screen role="nodump"><userinput>exit
|
||||||
|
umount $LFS/dev{/pts,}
|
||||||
|
umount $LFS/{sys,proc,run}</userinput></screen>
|
||||||
|
|
||||||
|
<note>
|
||||||
|
<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
|
||||||
|
<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.
|
||||||
|
This has been discussed in <xref linkend='ch-partitioning-aboutlfs'/>.
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
|
|
||||||
<sect2>
|
<sect2>
|
||||||
<title>Stripping</title>
|
<title>Stripping</title>
|
||||||
|
|
||||||
<para>If the LFS partition is rather small, it is beneficial to
|
<para>If the LFS partition is rather small, it is beneficial to
|
||||||
learn that unnecessary items can be removed.
|
learn that unnecessary items can be removed. The executables and
|
||||||
The executables and libraries built so far contain about 70 MB of unneeded
|
libraries built so far contain about 94 MB of unneeded debugging
|
||||||
debugging symbols.</para>
|
symbols.</para>
|
||||||
|
|
||||||
<screen><userinput>strip --strip-debug /usr/lib/*
|
<para>Strip off debugging symbols from binaries:</para>
|
||||||
strip --strip-unneeded /usr/{,s}bin/*
|
<screen role="nodump"><userinput>strip --strip-debug $LFS/usr/lib/*
|
||||||
strip --strip-unneeded /tools/bin/*</userinput></screen>
|
strip --strip-unneeded $LFS/usr/{,s}bin/*
|
||||||
|
strip --strip-unneeded $LFS/tools/bin/*</userinput></screen>
|
||||||
|
|
||||||
<para>These commands will skip a number of files reporting that it does not
|
<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.
|
recognize their file format. Most of these are scripts instead of binaries.
|
||||||
<!--Note that we use the <command>strip</command> program built in
|
<!--Note that we use the <command>strip</command> program built in
|
||||||
<quote>Binutils pass 1</quote>, since it is the one that knows how to strip
|
<quote>Binutils pass 2</quote>, since it is the one that knows how to strip
|
||||||
our cross-compiled programs.--></para>
|
our cross-compiled programs.--></para>
|
||||||
|
|
||||||
<para>Take care <emphasis>NOT</emphasis> to use
|
<para>Take care <emphasis>NOT</emphasis> to use
|
||||||
@ -39,22 +87,22 @@ strip --strip-unneeded /tools/bin/*</userinput></screen>
|
|||||||
ones would be destroyed and the toolchain packages would need to be
|
ones would be destroyed and the toolchain packages would need to be
|
||||||
built all over again.</para>
|
built all over again.</para>
|
||||||
|
|
||||||
<para>To save more space, remove the documentation:</para>
|
<para>To save more space (about 37 MB), remove the documentation:</para>
|
||||||
|
|
||||||
<screen><userinput>rm -rf /usr/{,share}/{info,man,doc}</userinput></screen>
|
<screen role="nodump"><userinput>rm -rf $LFS/usr/share/{info,man,doc}</userinput></screen>
|
||||||
|
|
||||||
<para>The libtool .la files are only useful when linking with static
|
<para>The libtool .la files are only useful when linking with static
|
||||||
libraries. They are unneeded, and potentially harmful, when using dynamic
|
libraries. They are unneeded, and potentially harmful, when using dynamic
|
||||||
shared libraries, specially when using non-autotools build systems.
|
shared libraries, specially when using non-autotools build systems.
|
||||||
Remove those files now:</para>
|
Remove those files now:</para>
|
||||||
|
|
||||||
<screen><userinput>find /usr/{lib,libexec} -name \*.la -delete</userinput></screen>
|
<screen role="nodump"><userinput>find $LFS/usr/{lib,libexec} -name \*.la -delete</userinput></screen>
|
||||||
|
|
||||||
<para>At this point, you should have at least 5 GB of free space on the
|
<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
|
chroot partition that can be used to build and install Glibc and Gcc in
|
||||||
the next phase. If you can build and install Glibc, you can build and install
|
the next phase. If you can build and install Glibc, you can build and install
|
||||||
the rest too. You can check the free disk space with the command
|
the rest too. You can check the free disk space with the command
|
||||||
<command>df -h /</command>.</para>
|
<command>df -h $LFS/</command>.</para>
|
||||||
|
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
@ -68,29 +116,27 @@ strip --strip-unneeded /tools/bin/*</userinput></screen>
|
|||||||
backed up for later reuse. In case of fatal failures in the subsequent
|
backed up for later reuse. In case of fatal failures in the subsequent
|
||||||
chapters, it often turns out that removing everything and starting over
|
chapters, it often turns out that removing everything and starting over
|
||||||
(more carefully) is the best option to recover. Unfortunatly, all the
|
(more carefully) is the best option to recover. Unfortunatly, all the
|
||||||
temporary tools will be removed, too. To avoid the extra time needed to redo
|
temporary tools will be removed, too. To avoid spending extra time to
|
||||||
something which has been built successfully, prepare a backup.
|
redo something which has been built successfully, prepare a backup.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Leave the chroot environment and make sure you have at least
|
Make sure you have at least 600 MB free disk space (the source tarballs
|
||||||
600 MB free disk space (the source tarballs will be included in
|
will be included in the backup archive) in the home directory of user
|
||||||
the backup archive) in the home directory of user
|
<systemitem class="username">root</systemitem>.
|
||||||
<systemitem class="username">lfs</systemitem>. Leaving the
|
|
||||||
chroot environment is required as the backup should be stored
|
|
||||||
outside of the <filename class="directory">$LFS</filename> directory
|
|
||||||
but those cannot be accessed when in chroot. Leave the chroot environment
|
|
||||||
and unmount the virtual kernel filesystems:
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<screen role="nodump"><userinput>exit
|
<para>
|
||||||
umount $LFS/dev{/pts,}
|
Create the backup archive by running the following command:
|
||||||
umount $LFS/{sys,proc,run}</userinput></screen>
|
</para>
|
||||||
|
|
||||||
<para>Create the backup archive:</para>
|
|
||||||
<screen role="nodump"><userinput>cd $LFS &&
|
<screen role="nodump"><userinput>cd $LFS &&
|
||||||
tar -cJpf $HOME/temp-tools.tar.xz .
|
tar -cJpf $HOME/temp-tools.tar.xz .
|
||||||
</userinput></screen>
|
</userinput></screen>
|
||||||
|
<para>
|
||||||
|
Replace <envar>$HOME</envar> by a directory of your choice if you
|
||||||
|
do not want to have the backup stored in <systemitem class="username">root</systemitem>'s
|
||||||
|
home directory.
|
||||||
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
In case some mistakes have been made and you need to start over, you can
|
In case some mistakes have been made and you need to start over, you can
|
||||||
@ -114,12 +160,13 @@ tar -xpf $HOME/temp-tools.tar.xz
|
|||||||
|
|
||||||
<important>
|
<important>
|
||||||
<para>
|
<para>
|
||||||
If you left the chroot environment either to create a backup
|
If you left the chroot environment either to strip off debug
|
||||||
or restart building using a restore, remember to mount the
|
symbols, create a backup or restart building using a restore,
|
||||||
kernel virtual filesystems as described in <xref
|
remember to mount the kernel virtual filesystems now again as
|
||||||
linkend='ch-tools-kernfs'/> and re-enter the
|
described in <xref linkend='ch-tools-kernfs'/> and re-enter
|
||||||
chroot environment (see <xref
|
the chroot environment (see <xref linkend='ch-tools-chroot'/>)
|
||||||
linkend='ch-tools-chroot'/>) again before continuing.</para>
|
again before continuing.
|
||||||
|
</para>
|
||||||
</important>
|
</important>
|
||||||
|
|
||||||
</sect2>
|
</sect2>
|
||||||
|
Loading…
Reference in New Issue
Block a user