From 00588180eea2ae621865ede52b7b9c619848c276 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sat, 1 Oct 2022 15:14:22 +0800 Subject: 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. --- chapter07/kernfs.xml | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'chapter07/kernfs.xml') 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 @@ Mounting and Populating /dev - During a normal boot, the kernel automatically mounts the - devtmpfs filesystem on the - /dev 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 /dev directory manually. This is - accomplished by bind mounting the host system's + During a normal boot of the LFS system, the kernel automatically + mounts the devtmpfs + filesystem on the + /dev 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 + for details.) + If the host kernel supports &devtmpfs;, we can simply mount a + &devtmpfs; at $LFS/dev and rely + on the kernel to populate it (the LFS building process does not need + the additional work onto &devtmpfs; by udev daemon). + + But, some host kernels may lack &devtmpfs; support and these + host distros maintain the content of + /dev with different methods. + So the only host-agnostic way for populating + $LFS/dev is + bind mounting the host system's /dev 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 -- cgit v1.2.3-54-g00ecf