Changeset 940c8495


Ignore:
Timestamp:
03/07/2022 05:25:06 PM (2 years ago)
Author:
Xi Ruoyao <xry111@…>
Branches:
11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, bdubbs/gcc13, multilib, renodr/libudev-from-systemd, s6-init, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
Children:
6ad2793, ac47b25
Parents:
102a7f6
git-author:
Xi Ruoyao <xry111@…> (03/07/2022 05:19:06 PM)
git-committer:
Xi Ruoyao <xry111@…> (03/07/2022 05:25:06 PM)
Message:

kernfs: remove static node creation, and update the text

This is to match the "new" way of device handling with devtmpfs (already
widely used in recent ten years).

In a normal booting process, the kernel mounts devtmpfs at very early
stage. So the static nodes won't be used at all. The only situation
where the kernel can't mount devtmpfs is "/dev is missing", but it means
those two static nodes can't exist anyway, and a normal LFS system
(without initramfs) won't boot in such a bad situation.

Removing static /dev/console and /dev/null may cause trouble for those
people or scripts chroot into LFS tree without mounting devtmpfs. But
entering a chroot with only console and null in /dev is already
problematic. For a reference, If a systemd service is started with
PrivateDevices=true, systemd will create 18 nodes and symlinks to form a
"minimal" /dev.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter07/kernfs.xml

    r102a7f6 r940c8495  
    2525<screen><userinput>mkdir -pv $LFS/{dev,proc,sys,run}</userinput></screen>
    2626
    27   <sect2>
    28     <title>Creating Initial Device Nodes</title>
    29 
    30     <para>When the kernel boots the system, it requires the presence of a few
    31     device nodes, in particular the <filename
    32     class="devicefile">console</filename> and <filename
    33     class="devicefile">null</filename> devices. The device nodes must be
    34     created on the hard disk so that they are available before the kernel
    35     populates <systemitem class="filesystem">/dev</systemitem>), and
    36     additionally when Linux is started with
    37     <parameter>init=/bin/bash</parameter>. Create the devices by running the
    38     following commands:</para>
    39 
    40 <screen><userinput>mknod -m 600 $LFS/dev/console c 5 1
    41 mknod -m 666 $LFS/dev/null c 1 3</userinput></screen>
    42 
    43   </sect2>
    44 
    4527  <sect2 id="ch-tools-bindmount">
    4628    <title>Mounting and Populating /dev</title>
    4729
    48       <para>The recommended method of populating the <filename
    49       class="directory">/dev</filename> directory with devices is to mount a
    50       virtual filesystem (such as <systemitem
    51       class="filesystem">tmpfs</systemitem>) on the <filename
    52       class="directory">/dev</filename> directory, and allow the devices to be
    53       created dynamically on that virtual filesystem as they are detected or
    54       accessed. Device creation is generally done during the boot process
    55       by Udev. Since this new system does not yet have Udev and has not yet
    56       been booted, it is necessary to mount and populate <filename
    57       class="directory">/dev</filename> manually. This is accomplished by bind
    58       mounting the host system's <filename class="directory">/dev</filename>
    59       directory. A bind mount is a special type of mount that allows you to
    60       create a mirror of a directory or mount point to some other location. Use
    61       the following command to achieve this:</para>
     30      <para>During a normal boot, the kernel automatically mounts the
     31      <systemitem class="filesystem">devtmpfs</systemitem> filesystem on the
     32      <filename class="directory">/dev</filename> directory, and allow the
     33      devices to be created dynamically on that virtual filesystem as they
     34      are detected or accessed. Device creation is generally done during the
     35      boot process by Udev. Since this new system does not yet have Udev and
     36      has not yet been booted, it is necessary to mount and populate
     37      <filename class="directory">/dev</filename> manually. This is
     38      accomplished by bind mounting the host system's
     39      <filename class="directory">/dev</filename> directory. A bind mount is
     40      a special type of mount that allows you to create a mirror of a
     41      directory or mount point to some other location. Use the following
     42      command to achieve this:</para>
    6243
    6344<screen><userinput>mount -v --bind /dev $LFS/dev</userinput></screen>
Note: See TracChangeset for help on using the changeset viewer.