Corrected grammar, spelling, and idiom in chapter 7.

This commit is contained in:
David Bryant 2022-11-16 13:15:01 -06:00
parent f2dff2db69
commit ebecd08c05
4 changed files with 53 additions and 57 deletions

View File

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

View File

@ -13,15 +13,15 @@
<sect2> <sect2>
<title>Cleaning</title> <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> 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> <screen><userinput>rm -rf /usr/share/{info,man,doc}/*</userinput></screen>
<para>Second, on a modern Linux system, the libtool .la files are only <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 useful for libltdl. No libraries in LFS are loaded by
libltdl, and it's known that some .la files can cause BLFS packages libltdl, and it's known that some .la files can cause BLFS package
fail to build. Remove those files now:</para> failures. Remove those files now:</para>
<screen><userinput>find /usr/{lib,libexec} -name \*.la -delete</userinput></screen> <screen><userinput>find /usr/{lib,libexec} -name \*.la -delete</userinput></screen>
@ -42,9 +42,9 @@
and your current LFS system is in a good state. Your system can now be 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 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. 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 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. the current LFS system may prove useful.
</para> </para>
@ -58,13 +58,12 @@
<para> <para>
The following steps are performed from outside the chroot 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 first before continuing. The reason for that is to
get access to file system locations outside of the chroot 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 not be placed within the
<filename class="directory">$LFS</filename> hierarchy for <filename class="directory">$LFS</filename> hierarchy.
safety reasons.
</para> </para>
<para> <para>
@ -78,7 +77,7 @@
All of the following instructions are executed by All of the following instructions are executed by
<systemitem class="username">root</systemitem> on your host system. <systemitem class="username">root</systemitem> on your host system.
Take extra care about the commands you're going to run as mistakes 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> environment variable <envar>LFS</envar>
is set for user <systemitem class="username">lfs</systemitem> by default is set for user <systemitem class="username">lfs</systemitem> by default
but may <emphasis>not</emphasis> be set for but may <emphasis>not</emphasis> be set for
@ -101,17 +100,14 @@ umount $LFS/{sys,proc,run,dev}</userinput></screen>
<para> <para>
Make sure you have at least 1 GB free disk space (the source tarballs 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 will be included in the backup archive) on the file system containing
directory where you create the backup archive. the directory where you create the backup archive.
</para> </para>
<para> <para>
Note that the instructions below specify the home directory of the host Note that the instructions below specify the home directory of the host
system's <systemitem class="username">root</systemitem> user, which is system's <systemitem class="username">root</systemitem> user, which is
typically found on the root filesystem. typically found on the root file system.
</para>
<para>
Replace <envar>$HOME</envar> by a directory of your choice if you Replace <envar>$HOME</envar> by a directory of your choice if you
do not want to have the backup stored in <systemitem do not want to have the backup stored in <systemitem
class="username">root</systemitem>'s home directory. class="username">root</systemitem>'s home directory.
@ -149,7 +145,7 @@ tar -cJpf $HOME/lfs-temp-tools-&version;.tar.xz .</userinput></screen>
Since the sources are located under Since the sources are located under
<filename class="directory">$LFS</filename>, they are included in the <filename class="directory">$LFS</filename>, they are included in the
backup archive as well, so they do not need to be downloaded again. After 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: restore the backup by executing the following commands:
</para> </para>
@ -167,7 +163,7 @@ rm -rf ./*
tar -xpf $HOME/lfs-temp-tools-&version;.tar.xz</computeroutput></screen> tar -xpf $HOME/lfs-temp-tools-&version;.tar.xz</computeroutput></screen>
<para> <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. and continue building the rest of the system.
</para> </para>
@ -175,7 +171,7 @@ tar -xpf $HOME/lfs-temp-tools-&version;.tar.xz</computeroutput></screen>
<para> <para>
If you left the chroot environment to create a backup or restart If you left the chroot environment to create a backup or restart
building using a restore, remember to check that the virtual 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 $LFS</command>). If they are not mounted, remount them now as
described in <xref linkend='ch-tools-kernfs'/> and re-enter the chroot described in <xref linkend='ch-tools-kernfs'/> and re-enter the chroot
environment (see <xref linkend='ch-tools-chroot'/>) before continuing. 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> <primary sortas="e-/var/log/wtmp">/var/log/wtmp</primary>
</indexterm> </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 file <filename>/etc/mtab</filename>. Modern kernels maintain this list
internally and expose it to the user via the <filename internally and expose it to the user via the <filename
class="directory">/proc</filename> filesystem. To satisfy utilities that 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> symbolic link:</para>
<screen><userinput>ln -sv /proc/self/mounts /etc/mtab</userinput></screen> <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 <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 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 distributions. In addition, some test suites rely on specific users or
groups. The Linux Standard Base (LSB, available at <ulink groups. The Linux Standard Base (LSB, available at <ulink
url="https://refspecs.linuxfoundation.org/lsb.shtml"/>) only recommends that, url="https://refspecs.linuxfoundation.org/lsb.shtml"/>) only recommends that,
besides the group <systemitem class="groupname">root</systemitem> with a besides the group <systemitem class="groupname">root</systemitem> with a
Group ID (GID) of 0, a group <systemitem class="groupname">bin</systemitem> 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 <systemitem class="groupname">tty</systemitem> group, and the number 5 is
also used in <phrase revision="systemd">systemd</phrase> also used in <phrase revision="systemd">systemd</phrase>
<phrase revision="sysv"><filename>/etc/fstab</filename></phrase> for the <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 or the parent user namespace, but <quote>do not exist</quote> on the local
machine or in the separate namespace). We assign machine or in the separate namespace). We assign
<systemitem class="username">nobody</systemitem> and <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 unnamed ID. But other distros may treat this ID differently, so any
portable program should not depend on this assignment.</para> portable program should not depend on this assignment.</para>

View File

@ -15,13 +15,13 @@
</indexterm> </indexterm>
<para>Applications running in user space utilize various file <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 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 memory. These file systems must be mounted in the $LFS directory tree
so the applications can find them in the chroot environment.</para> 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> mounted:</para>
<screen><userinput>mkdir -pv $LFS/{dev,proc,sys,run}</userinput></screen> <screen><userinput>mkdir -pv $LFS/{dev,proc,sys,run}</userinput></screen>
@ -29,31 +29,31 @@
<sect2 id="ch-tools-bindmount"> <sect2 id="ch-tools-bindmount">
<title>Mounting and Populating /dev</title> <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> mounts the <systemitem class="filesystem">devtmpfs</systemitem>
filesystem on the file system on the
<filename class="directory">/dev</filename> directory; the kernel <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 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 change the ownership or permissions of the device nodes created by the
kernel, or create new device nodes or symlinks to ease the work of kernel, and create new device nodes or symlinks, to ease the work of
distro maintainers or system administrators. (See distro maintainers and system administrators. (See
<xref linkend='ch-config-udev-device-node-creation'/> for details.) <xref linkend='ch-config-udev-device-node-creation'/> for details.)
If the host kernel supports &devtmpfs;, we can simply mount a If the host kernel supports &devtmpfs;, we can simply mount a
&devtmpfs; at <filename class='directory'>$LFS/dev</filename> and rely &devtmpfs; at <filename class='directory'>$LFS/dev</filename> and rely
on the kernel to populate it (the LFS building process does not need on the kernel to populate it (i.e., the udev daemon will do the
the additional work onto &devtmpfs; by udev daemon).</para> necessary work automatically).</para>
<para>But, some host kernels may lack &devtmpfs; support and these <para>But some host kernels lack &devtmpfs; support; these
host distros maintain the content of host distros use different methods to create the content of
<filename class="directory">/dev</filename> with different methods. <filename class="directory">/dev</filename>.
So the only host-agnostic way for populating So the only host-agnostic way to populate the
<filename class="directory">$LFS/dev</filename> is <filename class="directory">$LFS/dev</filename> directory is
bind mounting the host system's by bind mounting the host system's
<filename class="directory">/dev</filename> directory. A bind mount is <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 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> <screen><userinput>mount -v --bind /dev $LFS/dev</userinput></screen>
@ -62,7 +62,7 @@
<sect2 id="ch-tools-kernfsmount"> <sect2 id="ch-tools-kernfsmount">
<title>Mounting Virtual Kernel File Systems</title> <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 <screen><userinput>mount -v --bind /dev/pts $LFS/dev/pts
mount -vt proc proc $LFS/proc mount -vt proc proc $LFS/proc