Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter07/kernfs.xml

    rac47b25 rd35dc01  
    2323    mounted:</para>
    2424
    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>
    4826
    4927  <sect2 id="ch-tools-kernfsmount">
    5028    <title>Mounting Virtual Kernel File Systems</title>
    5129
    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>
    5333
    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}
     35mount -vt devpts /dev/pts /dev/pts -o gid=5,mode=620
     36mount -vt proc  proc  /proc
     37mount -vt sysfs sysfs /sys
     38mount -vt tmpfs tmpfs /run
     39mount -vt tmpfs tmpfs /dev/shm</userinput></screen>
     40
    5941    <variablelist>
    6042      <title>The meaning of the mount options for devpts:</title>
     
    8466
    8567    </variablelist>
    86 -->
    87       <para>In some host systems, <filename>/dev/shm</filename> is a
    88       symbolic link to <filename class="directory">/run/shm</filename>.
    89       The /run tmpfs was mounted above so in this case only a
    90       directory needs to be created.</para>
    9168
    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
     84ln -sfv /proc/self/fd/1 /dev/stdout
     85ln -sfv /proc/self/fd/2 /dev/stderr
     86ln -sv  /proc/self/fd   /dev</userinput></screen>
    9587
    9688  </sect2>
Note: See TracChangeset for help on using the changeset viewer.