aboutsummaryrefslogtreecommitdiffstats
path: root/chapter07
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@xry111.site>2022-10-02 21:49:39 +0800
committerXi Ruoyao <xry111@xry111.site>2022-10-02 21:49:39 +0800
commit96323bd9fc7bafc4f9f9c8419894c49701a3b63d (patch)
tree716a30f51c58304648204995fb36aab14af4afd0 /chapter07
parent111194c5b7bff4d074f602f6c2bc7aecee2dbc5d (diff)
parent6582ddc527ff5959daf6dce5cb16a2c42678f7c5 (diff)
Merge remote-tracking branch 'origin/trunk' into xry111/arm64
Diffstat (limited to 'chapter07')
-rw-r--r--chapter07/creatingdirs.xml22
-rw-r--r--chapter07/introduction.xml12
-rw-r--r--chapter07/kernfs.xml51
3 files changed, 49 insertions, 36 deletions
diff --git a/chapter07/creatingdirs.xml b/chapter07/creatingdirs.xml
index bc6162e61..35a0a9003 100644
--- a/chapter07/creatingdirs.xml
+++ b/chapter07/creatingdirs.xml
@@ -10,10 +10,10 @@
<title>Creating Directories</title>
- <para>It is time to create the full structure in the LFS file system.</para>
+ <para>It is time to create the full directory structure in the LFS file system.</para>
- <note><para>Some of the directories mentioned in this section may be
- already created earlier with explicit instructions or when installing some
+ <note><para>Some of the directories mentioned in this section may have
+ already been created earlier with explicit instructions, or when installing some
packages. They are repeated below for completeness.</para></note>
<para>Create some root-level directories that are not in the limited set
@@ -42,14 +42,14 @@ install -dv -m 0750 /root
install -dv -m 1777 /tmp /var/tmp</userinput></screen>
<para>Directories are, by default, created with permission mode 755, but
- this is not desirable for all directories. In the commands above, two
+ this is not desirable everywhere. In the commands above, two
changes are made&mdash;one to the home directory of user <systemitem
class="username">root</systemitem>, and another to the directories for
temporary files.</para>
<para>The first mode change ensures that not just anybody can enter
- the <filename class="directory">/root</filename> directory&mdash;the
- same as a normal user would do with his or her home directory. The
+ the <filename class="directory">/root</filename> directory&mdash;just
+ like a normal user would do with his or her own home directory. The
second mode change makes sure that any user can write to the
<filename class="directory">/tmp</filename> and <filename
class="directory">/var/tmp</filename> directories, but cannot remove
@@ -59,14 +59,14 @@ install -dv -m 1777 /tmp /var/tmp</userinput></screen>
<sect2>
<title>FHS Compliance Note</title>
- <para>The directory tree is based on the Filesystem Hierarchy Standard
+ <para>This directory tree is based on the Filesystem Hierarchy Standard
(FHS) (available at <ulink
url="https://refspecs.linuxfoundation.org/fhs.shtml"/>). The FHS also specifies
- the optional existence of some directories such as <filename
+ the optional existence of additional directories such as <filename
class="directory">/usr/local/games</filename> and <filename
- class="directory">/usr/share/games</filename>. We create only the
- directories that are needed. However, feel free to create these
- directories. </para>
+ class="directory">/usr/share/games</filename>. In LFS, we create only the
+ directories that are really necessary. However, feel free to create more
+ directories, if you wish. </para>
</sect2>
diff --git a/chapter07/introduction.xml b/chapter07/introduction.xml
index 6605ddea4..d00f3fe2a 100644
--- a/chapter07/introduction.xml
+++ b/chapter07/introduction.xml
@@ -11,22 +11,22 @@
<title>Introduction</title>
<para>This chapter shows how to build the last missing bits of the temporary
- system: the tools needed by the build machinery of various packages. Now
+ system: the tools needed to build the various packages. Now
that all circular dependencies have been resolved, a <quote>chroot</quote>
environment, completely isolated from the host operating system (except for
the running kernel), can be used for the build.</para>
<para>For proper operation of the isolated environment, some communication
- with the running kernel must be established. This is done through the
- so-called <emphasis>Virtual Kernel File Systems</emphasis>, which must be
- mounted when entering the chroot environment. You may want to check
- that they are mounted by issuing <command>findmnt</command>.</para>
+ with the running kernel must be established. This is done via the
+ so-called <emphasis>Virtual Kernel File Systems</emphasis>, which will be
+ mounted before entering the chroot environment. You may want to verify
+ that they are mounted by issuing the <command>findmnt</command> command.</para>
<para>Until <xref linkend="ch-tools-chroot"/>, the commands must be
run as <systemitem class="username">root</systemitem>, with the
<envar>LFS</envar> variable set. After entering chroot, all commands
are run as &root;, fortunately without access to the OS of the computer
you built LFS on. Be careful anyway, as it is easy to destroy the whole
- LFS system with badly formed commands.</para>
+ LFS system with bad commands.</para>
</sect1>
diff --git a/chapter07/kernfs.xml b/chapter07/kernfs.xml
index c9721113d..3e96bee5e 100644
--- a/chapter07/kernfs.xml
+++ b/chapter07/kernfs.xml
@@ -14,12 +14,14 @@
<primary sortas="e-/dev/">/dev/*</primary>
</indexterm>
- <para>Various file systems exported by the kernel are used to communicate to
- and from the kernel itself. These file systems are virtual in that no disk
+ <para>Applications running in user space utilize various file
+ systems exported 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
- memory.</para>
+ 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 onto which the file systems will be
+ <para>Begin by creating directories on which the file systems will be
mounted:</para>
<screen><userinput>mkdir -pv $LFS/{dev,proc,sys,run}</userinput></screen>
@@ -27,20 +29,31 @@
<sect2 id="ch-tools-bindmount">
<title>Mounting and Populating /dev</title>
- <para>During a normal boot, the kernel automatically mounts the
- <systemitem class="filesystem">devtmpfs</systemitem> filesystem on the
- <filename class="directory">/dev</filename> directory, and allow the
- devices to be created dynamically on that virtual filesystem as they
- are detected or accessed. Device creation is generally done during the
- boot process by the kernel and Udev.
- Since this new system does not yet have Udev and
- has not yet been booted, it is necessary to mount and populate
- <filename class="directory">/dev</filename> manually. This is
- accomplished by bind mounting the host system's
+ <para>During a normal boot of the LFS system, the kernel automatically
+ mounts the <systemitem class="filesystem">devtmpfs</systemitem>
+ filesystem on the
+ <filename class="directory">/dev</filename> directory; the kernel
+ creates device nodes on that virtual filesystem 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
+ <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>
+
+ <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
<filename class="directory">/dev</filename> directory. A bind mount is
a special type of mount that allows you to create a mirror of a
- directory or mount point to some other location. Use the following
- command to achieve this:</para>
+ directory or mount point at some other location. Use the following
+ command to do this:</para>
<screen><userinput>mount -v --bind /dev $LFS/dev</userinput></screen>
@@ -89,10 +102,10 @@ mount -vt tmpfs tmpfs $LFS/run</userinput></screen>
The /run tmpfs was mounted above so in this case only a
directory needs to be created.</para>
- <para>In other cases <filename>/dev/shm</filename> is a mountpoint
+ <para>In other host systems <filename>/dev/shm</filename> is a mount point
for a tmpfs. In that case the mount of /dev above will only create
- /dev/shm in the chroot environment as a directory. In this situation
- we explicitly mount a tmpfs,</para>
+ /dev/shm as a directory in the chroot environment. In this situation
+ we must explicitly mount a tmpfs:</para>
<screen><userinput>if [ -h $LFS/dev/shm ]; then
mkdir -pv $LFS/$(readlink $LFS/dev/shm)