diff options
author | Xi Ruoyao <xry111@xry111.site> | 2022-10-01 15:14:22 +0800 |
---|---|---|
committer | Xi Ruoyao <xry111@xry111.site> | 2022-10-01 15:14:22 +0800 |
commit | 00588180eea2ae621865ede52b7b9c619848c276 (patch) | |
tree | 32a5f33acb6baf06126356c16e433bc22771ffaa /chapter07 | |
parent | a8f3814a7b070ec4b8fcdf6960bd9e31824d91a5 (diff) |
kernfs: modernize the explanation for bind mounting /dev
If you are using a "modern" distro (with devtmpfs and a modern udev
implementation), a bind mounting is actually not needed because you can
mount devtmpfs anyway. The only reason for bind mounting is to be
compatible with old host distros where /dev is a directory containing
many static device nodes, or is a tmpfs (not same as devtmpfs) popluated
by bootscript or an old udev (modern udev implementations, including
eudev and systemd-udev used by LFS, strictly requires a devtmpfs on
/dev).
So update the explanation to match the status quo.
Diffstat (limited to 'chapter07')
-rw-r--r-- | chapter07/kernfs.xml | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/chapter07/kernfs.xml b/chapter07/kernfs.xml index 54b864130..4a1cac179 100644 --- a/chapter07/kernfs.xml +++ b/chapter07/kernfs.xml @@ -29,16 +29,27 @@ <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; the - devices are created dynamically on that virtual filesystem when they - are first detected or accessed. Device creation is generally done during the - boot process by the kernel and the udev program. - Since the new system does not yet include udev and - has not yet been booted, it is necessary to mount and populate - the <filename class="directory">/dev</filename> directory 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 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 at some other location. Use the following |