Automatic merge of trunk into multilib

This commit is contained in:
Thomas Trepl (Moody) 2022-11-17 00:30:12 +01:00
commit 16a1647c6b
5 changed files with 55 additions and 59 deletions

View File

@ -11,11 +11,11 @@
<title>Entering the Chroot Environment</title>
<para>Now that all the packages which are required to build the rest of the
needed tools are on the system, it is time to enter the chroot environment to
finish installing the remaining temporary tools. This environment will be in
use also for installing the final system. As user <systemitem
needed tools are on the system, it is time to enter the chroot environment and
finish installing the temporary tools. This environment will also be
used to install the final system. As user <systemitem
class="username">root</systemitem>, run the following command to enter the
environment that is, at the moment, populated with only the temporary
environment that is, at the moment, populated with nothing but temporary
tools:</para>
<screen role="nodump"><userinput>chroot "$LFS" /usr/bin/env -i \
@ -26,25 +26,25 @@
/bin/bash --login</userinput></screen>
<para>The <parameter>-i</parameter> option given to the <command>env</command>
command will clear all variables of the chroot environment. After that, only
command will clear all the variables in the chroot environment. After that, only
the <envar>HOME</envar>, <envar>TERM</envar>, <envar>PS1</envar>, and
<envar>PATH</envar> variables are set again. The
<parameter>TERM=$TERM</parameter> construct will set the <envar>TERM</envar>
<parameter>TERM=$TERM</parameter> construct sets the <envar>TERM</envar>
variable inside chroot to the same value as outside chroot. This variable is
needed for programs like <command>vim</command> and <command>less</command>
to operate properly. If other variables are desired, such as
needed so programs like <command>vim</command> and <command>less</command>
can operate properly. If other variables are desired, such as
<envar>CFLAGS</envar> or <envar>CXXFLAGS</envar>, this is a good place to set
them again.</para>
them.</para>
<para>From this point on, there is no need to use the
<envar>LFS</envar> variable anymore because all work will be restricted
to the LFS file system. This is because the Bash shell is told that
<envar>LFS</envar> variable any more because all work will be restricted
to the LFS file system; the <command>chroot</command> command tells the Bash shell that
<filename class="directory">$LFS</filename> is now the root
(<filename class="directory">/</filename>) directory.</para>
<para>Notice that <filename class="directory">/tools/bin</filename> is not
in the <envar>PATH</envar>. This means that the cross toolchain will no longer be
used in the chroot environment.</para>
used.</para>
<para>Note that the <command>bash</command> prompt will say
<computeroutput>I have no name!</computeroutput> This is normal because the

View File

@ -13,15 +13,15 @@
<sect2>
<title>Cleaning</title>
<para>First, remove the currently installed documentation to prevent them
<para>First, remove the currently installed documentation files to prevent them
from ending up in the final system, and to save about 35 MB:</para>
<screen><userinput>rm -rf /usr/share/{info,man,doc}/*</userinput></screen>
<para>Second, on a modern Linux system, the libtool .la files are only
useful for libltdl. No libraries in LFS are expected to be loaded by
libltdl, and it's known that some .la files can cause BLFS packages
fail to build. Remove those files now:</para>
useful for libltdl. No libraries in LFS are loaded by
libltdl, and it's known that some .la files can cause BLFS package
failures. Remove those files now:</para>
<screen><userinput>find /usr/{lib,libexec} -name \*.la -delete</userinput><userinput arch="ml_32">
find /usr/lib32 -name \*.la -delete</userinput><userinput arch="ml_x32">
@ -45,9 +45,9 @@ find /usr/lib{,x}32 -name \*.la -delete</userinput></screen>
and your current LFS system is in a good state. Your system can now be
backed up for later reuse. In case of fatal failures in the subsequent
chapters, it often turns out that removing everything and starting over
(more carefully) is the best option to recover. Unfortunately, all the
(more carefully) is the best way to recover. Unfortunately, all the
temporary files will be removed, too. To avoid spending extra time to
redo something which has been built successfully, creating a backup of
redo something which has been done successfully, creating a backup of
the current LFS system may prove useful.
</para>
@ -61,13 +61,12 @@ find /usr/lib{,x}32 -name \*.la -delete</userinput></screen>
<para>
The following steps are performed from outside the chroot
environment. That means, you have to leave the chroot environment
environment. That means you have to leave the chroot environment
first before continuing. The reason for that is to
get access to file system locations outside of the chroot
environment to store/read the backup archive which should
environment to store/read the backup archive, which ought
not be placed within the
<filename class="directory">$LFS</filename> hierarchy for
safety reasons.
<filename class="directory">$LFS</filename> hierarchy.
</para>
<para>
@ -81,7 +80,7 @@ find /usr/lib{,x}32 -name \*.la -delete</userinput></screen>
All of the following instructions are executed by
<systemitem class="username">root</systemitem> on your host system.
Take extra care about the commands you're going to run as mistakes
here can modify your host system. Be aware that the
made 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 may <emphasis>not</emphasis> be set for
@ -104,17 +103,14 @@ umount $LFS/{sys,proc,run,dev}</userinput></screen>
<para>
Make sure you have at least 1 GB free disk space (the source tarballs
will be included in the backup archive) on the filesystem containing
directory where you create the backup archive.
will be included in the backup archive) on the file system containing
the directory where you create the backup archive.
</para>
<para>
Note that the instructions below specify the home directory of the host
system's <systemitem class="username">root</systemitem> user, which is
typically found on the root filesystem.
</para>
<para>
typically found on the root file system.
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.
@ -152,7 +148,7 @@ tar -cJpf $HOME/lfs-temp-tools-&version;.tar.xz .</userinput></screen>
Since the sources are located under
<filename class="directory">$LFS</filename>, they are included in the
backup archive as well, so they do not need to be downloaded again. After
checking that <envar>$LFS</envar> is set properly,
checking that <envar>$LFS</envar> is set properly, you can
restore the backup by executing the following commands:
</para>
@ -170,7 +166,7 @@ rm -rf ./*
tar -xpf $HOME/lfs-temp-tools-&version;.tar.xz</computeroutput></screen>
<para>
Again, double check that the environment has been setup properly
Again, double check that the environment has been set up properly
and continue building the rest of the system.
</para>
@ -178,7 +174,7 @@ tar -xpf $HOME/lfs-temp-tools-&version;.tar.xz</computeroutput></screen>
<para>
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
file systems are still mounted (<command>findmnt | grep
$LFS</command>). If they are not mounted, remount them now as
described in <xref linkend='ch-tools-kernfs'/> and re-enter the chroot
environment (see <xref linkend='ch-tools-chroot'/>) before continuing.

View File

@ -34,11 +34,11 @@
<primary sortas="e-/var/log/wtmp">/var/log/wtmp</primary>
</indexterm>
<para>Historically, Linux maintains a list of the mounted file systems in the
<para>Historically, Linux maintained a list of the mounted file systems in the
file <filename>/etc/mtab</filename>. Modern kernels maintain this list
internally and expose it to the user via the <filename
class="directory">/proc</filename> filesystem. To satisfy utilities that
expect the presence of <filename>/etc/mtab</filename>, create the following
expect to find <filename>/etc/mtab</filename>, create the following
symbolic link:</para>
<screen><userinput>ln -sv /proc/self/mounts /etc/mtab</userinput></screen>
@ -159,13 +159,13 @@ EOF</userinput></screen>
<para>The created groups are not part of any standard&mdash;they are groups
decided on in part by the requirements of the Udev configuration in Chapter
9, and in part by common convention employed by a number of existing Linux
9, and in part by common conventions employed by a number of existing Linux
distributions. In addition, some test suites rely on specific users or
groups. The Linux Standard Base (LSB, available at <ulink
url="https://refspecs.linuxfoundation.org/lsb.shtml"/>) only recommends that,
besides the group <systemitem class="groupname">root</systemitem> with a
Group ID (GID) of 0, a group <systemitem class="groupname">bin</systemitem>
with a GID of 1 be present. The GID of 5 is widely used for
with a GID of 1 be present. The GID of 5 is widely used for the
<systemitem class="groupname">tty</systemitem> group, and the number 5 is
also used in <phrase revision="systemd">systemd</phrase>
<phrase revision="sysv"><filename>/etc/fstab</filename></phrase> for the
@ -179,7 +179,7 @@ EOF</userinput></screen>
or the parent user namespace, but <quote>do not exist</quote> on the local
machine or in the separate namespace). We assign
<systemitem class="username">nobody</systemitem> and
<systemitem class="groupname">nogroup</systemitem> for it to avoid an
<systemitem class="groupname">nogroup</systemitem> to avoid an
unnamed ID. But other distros may treat this ID differently, so any
portable program should not depend on this assignment.</para>

View File

@ -15,13 +15,13 @@
</indexterm>
<para>Applications running in user space utilize various file
systems exported by the kernel to communicate
systems created by the kernel to communicate
with the kernel itself. These file systems are virtual: no disk
space is used for them. The content of the file systems resides in
space is used for them. The content of these file systems resides in
memory. These file systems must be mounted in the $LFS directory tree
so the applications can find them in the chroot environment.</para>
<para>Begin by creating directories on which the file systems will be
<para>Begin by creating the directories on which these virtual file systems will be
mounted:</para>
<screen><userinput>mkdir -pv $LFS/{dev,proc,sys,run}</userinput></screen>
@ -29,31 +29,31 @@
<sect2 id="ch-tools-bindmount">
<title>Mounting and Populating /dev</title>
<para>During a normal boot of the LFS system, the kernel automatically
<para>During a normal boot of an LFS system, the kernel automatically
mounts the <systemitem class="filesystem">devtmpfs</systemitem>
filesystem on the
file system on the
<filename class="directory">/dev</filename> directory; the kernel
creates device nodes on that virtual filesystem during the boot process
creates device nodes on that virtual file system during the boot process,
or when a device is first detected or accessed. The udev daemon may
change the owner or permission of the device nodes created by the
kernel, or create new device nodes or symlinks to ease the work of
distro maintainers or system administrators. (See
change the ownership or permissions of the device nodes created by the
kernel, and create new device nodes or symlinks, to ease the work of
distro maintainers and system administrators. (See
<xref linkend='ch-config-udev-device-node-creation'/> for details.)
If the host kernel supports &devtmpfs;, we can simply mount a
&devtmpfs; at <filename class='directory'>$LFS/dev</filename> and rely
on the kernel to populate it (the LFS building process does not need
the additional work onto &devtmpfs; by udev daemon).</para>
on the kernel to populate it (i.e., the udev daemon will do the
necessary work automatically).</para>
<para>But, some host kernels may lack &devtmpfs; support and these
host distros maintain the content of
<filename class="directory">/dev</filename> with different methods.
So the only host-agnostic way for populating
<filename class="directory">$LFS/dev</filename> is
bind mounting the host system's
<para>But some host kernels lack &devtmpfs; support; these
host distros use different methods to create the content of
<filename class="directory">/dev</filename>.
So the only host-agnostic way to populate the
<filename class="directory">$LFS/dev</filename> directory is
by bind mounting the host system's
<filename class="directory">/dev</filename> directory. A bind mount is
a special type of mount that allows you to create a mirror of a
a special type of mount that generates a duplicate copy of a
directory or mount point at some other location. Use the following
command to do this:</para>
command to do this.</para>
<screen><userinput>mount -v --bind /dev $LFS/dev</userinput></screen>
@ -62,7 +62,7 @@
<sect2 id="ch-tools-kernfsmount">
<title>Mounting Virtual Kernel File Systems</title>
<para>Now mount the remaining virtual kernel filesystems:</para>
<para>Now mount the remaining virtual kernel file systems:</para>
<screen><userinput>mount -v --bind /dev/pts $LFS/dev/pts
mount -vt proc proc $LFS/proc

View File

@ -244,7 +244,7 @@ useradd -D --gid 999</userinput></screen>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<segtitle>Installed directory</segtitle>
<segtitle>Installed directories</segtitle>
<segtitle>Installed libraries</segtitle>
<seglistitem>
@ -254,7 +254,7 @@ useradd -D --gid 999</userinput></screen>
newuidmap, newusers, nologin, passwd, pwck, pwconv, pwunconv,
sg (link to newgrp), su, useradd, userdel, usermod,
vigr (link to vipw), and vipw</seg>
<seg>/etc/default</seg>
<seg>/etc/default and /usr/include/shadow</seg>
<seg>libsubid.so</seg>
</seglistitem>
</segmentedlist>