Changeset febac51 for chapter07/kernfs.xml
- Timestamp:
- 02/26/2022 03:43:11 PM (2 years ago)
- Branches:
- xry111/clfs-ng
- Children:
- ae636e7
- Parents:
- fa7acfc
- git-author:
- Xi Ruoyao <xry111@…> (08/25/2021 05:30:13 AM)
- git-committer:
- Xi Ruoyao <xry111@…> (02/26/2022 03:43:11 PM)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter07/kernfs.xml
rfa7acfc rfebac51 23 23 mounted:</para> 24 24 25 <screen><userinput>mkdir -pv $LFS/{dev,proc,sys,run}</userinput></screen> 26 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 45 <sect2 id="ch-tools-bindmount"> 46 <title>Mounting and Populating /dev</title> 47 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> 62 63 <screen><userinput>mount -v --bind /dev $LFS/dev</userinput></screen> 64 65 </sect2> 25 <screen><userinput>mkdir -pv /{proc,sys,run}</userinput></screen> 66 26 67 27 <sect2 id="ch-tools-kernfsmount"> 68 28 <title>Mounting Virtual Kernel File Systems</title> 69 29 70 <para>Now mount the remaining virtual kernel filesystems:</para> 30 <para>The kernel has already mounted 31 <systemitem class="filesystem">devtmpfs</systemitem>. 32 Mount the remaining virtual kernel filesystems:</para> 71 33 72 <screen><userinput>mount -v --bind /dev/pts $LFS/dev/pts 73 mount -vt proc proc $LFS/proc 74 mount -vt sysfs sysfs $LFS/sys 75 mount -vt tmpfs tmpfs $LFS/run</userinput></screen> 76 <!-- 34 <screen><userinput>mkdir -pv /dev/{pts,shm} 35 mount -vt devpts /dev/pts /dev/pts -o gid=5,mode=620 36 mount -vt proc proc /proc 37 mount -vt sysfs sysfs /sys 38 mount -vt tmpfs tmpfs /run 39 mount -vt tmpfs tmpfs /dev/shm</userinput></screen> 40 77 41 <variablelist> 78 42 <title>The meaning of the mount options for devpts:</title> … … 102 66 103 67 </variablelist> 104 -->105 <para>In some host systems, <filename>/dev/shm</filename> is a106 symbolic link to <filename class="directory">/run/shm</filename>.107 The /run tmpfs was mounted above so in this case only a108 directory needs to be created.</para>109 68 110 <screen><userinput>if [ -h $LFS/dev/shm ]; then 111 mkdir -pv $LFS/$(readlink $LFS/dev/shm) 112 fi</userinput></screen> 69 </sect2> 70 71 <sect2 id="ch-tools-devadjust"> 72 <title>Adjusting devtmpfs</title> 73 74 <para>Now <systemitem class='filesystem'>proc</systemitem> filesystem 75 is mounted, we can replace the device nodes for standard I/O streams 76 with symlinks to pseudo files in 77 <filename class="directory">/proc/self/fd</filename> (which are symlinks 78 to the files connected to the standard I/O streams for the current 79 process). This is necessary for I/O redirection in the building system 80 of some packages to function properly:</para> 81 82 <screen><userinput>ln -sfv /proc/self/fd/0 /dev/stdin 83 ln -sfv /proc/self/fd/1 /dev/stdout 84 ln -sfv /proc/self/fd/2 /dev/stderr</userinput></screen> 113 85 114 86 </sect2>
Note:
See TracChangeset
for help on using the changeset viewer.