Changes in chapter07/kernfs.xml [ac47b25:d35dc01]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter07/kernfs.xml
rac47b25 rd35dc01 23 23 mounted:</para> 24 24 25 <screen><userinput>mkdir -pv $LFS/{dev,proc,sys,run}</userinput></screen> 26 27 <sect2 id="ch-tools-bindmount"> 28 <title>Mounting and Populating /dev</title> 29 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 the kernel and Udev. 36 Since this new system does not yet have Udev and 37 has not yet been booted, it is necessary to mount and populate 38 <filename class="directory">/dev</filename> manually. This is 39 accomplished by bind mounting the host system's 40 <filename class="directory">/dev</filename> directory. A bind mount is 41 a special type of mount that allows you to create a mirror of a 42 directory or mount point to some other location. Use the following 43 command to achieve this:</para> 44 45 <screen><userinput>mount -v --bind /dev $LFS/dev</userinput></screen> 46 47 </sect2> 25 <screen><userinput>mkdir -pv /{proc,sys,run}</userinput></screen> 48 26 49 27 <sect2 id="ch-tools-kernfsmount"> 50 28 <title>Mounting Virtual Kernel File Systems</title> 51 29 52 <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> 53 33 54 <screen><userinput>mount -v --bind /dev/pts $LFS/dev/pts 55 mount -vt proc proc $LFS/proc 56 mount -vt sysfs sysfs $LFS/sys 57 mount -vt tmpfs tmpfs $LFS/run</userinput></screen> 58 <!-- 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 59 41 <variablelist> 60 42 <title>The meaning of the mount options for devpts:</title> … … 84 66 85 67 </variablelist> 86 -->87 <para>In some host systems, <filename>/dev/shm</filename> is a88 symbolic link to <filename class="directory">/run/shm</filename>.89 The /run tmpfs was mounted above so in this case only a90 directory needs to be created.</para>91 68 92 <screen><userinput>if [ -h $LFS/dev/shm ]; then 93 mkdir -pv $LFS/$(readlink $LFS/dev/shm) 94 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). And, create another symlink recommended by the kernel 80 documentation. These are necessary for I/O redirection in the building 81 system of some packages to function properly:</para> 82 83 <screen><userinput>ln -sfv /proc/self/fd/0 /dev/stdin 84 ln -sfv /proc/self/fd/1 /dev/stdout 85 ln -sfv /proc/self/fd/2 /dev/stderr 86 ln -sv /proc/self/fd /dev</userinput></screen> 95 87 96 88 </sect2>
Note:
See TracChangeset
for help on using the changeset viewer.