- Timestamp:
- May 29, 2006, 2:45:38 AM (19 years ago)
- Children:
- f22fbd1
- Parents:
- f2be112a
- Location:
- chroot/common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
chroot/common/devices.xml
rf2be112a red3238a 9 9 <?dbhtml filename="devices.html"?> 10 10 11 <title> Populating /dev</title>11 <title>Mounting Kernel Filesystems</title> 12 12 13 13 <indexterm zone="ch-chroot-devices"> … … 16 16 17 17 <sect2> 18 <title> Creating Initial Device Nodes</title>18 <title>Mounting Additional Kernel Filesystems</title> 19 19 20 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" 21 href="../../boot/common/devices.xml" 22 xpointer="xpointer(//*[@os='b'])"/> 23 24 <screen><userinput>mknod -m 600 /dev/console c 5 1 25 mknod -m 666 /dev/null c 1 3</userinput></screen> 26 27 </sect2> 28 29 <sect2> 30 <title>Mounting tmpfs and Populating /dev</title> 31 32 <para>The recommended method of populating the <filename 33 class="directory">/dev</filename> directory with devices is to 34 mount a virtual filesystem (such as <systemitem 35 class="filesystem">tmpfs</systemitem>) on the <filename 36 class="directory">/dev</filename> directory, and allow the devices 37 to be created dynamically on that virtual filesystem as they are 38 detected or accessed. This is generally done during the boot process. 39 Since this new system has not been booted, it is necessary to do what 40 the LFS-Bootscripts package would otherwise do by mounting <filename 41 class="directory">/dev</filename>:</para> 42 43 <screen><userinput>mount -n -vt tmpfs none /dev</userinput></screen> 44 45 <para>The Udev package is what actually creates the devices in the 46 <filename class="directory">/dev</filename> directory. Since it will 47 not be installed until later on in the process, manually create the 48 minimal set of device nodes needed to complete the building of this 49 system:</para> 50 51 <screen><userinput>mknod -m 622 /dev/console c 5 1 52 mknod -m 666 /dev/null c 1 3 53 mknod -m 666 /dev/zero c 1 5 54 mknod -m 666 /dev/ptmx c 5 2 55 mknod -m 666 /dev/tty c 5 0 56 mknod -m 444 /dev/random c 1 8 57 mknod -m 444 /dev/urandom c 1 9 58 chown -v root:tty /dev/{console,ptmx,tty}</userinput></screen> 59 60 <para>There are some symlinks and directories required by LFS that 61 are created during system startup by the LFS-Bootscripts package. Since 62 this is a chroot environment and not a booted environment, those symlinks 63 and directories need to be created here:</para> 64 65 <screen><userinput>ln -sv /proc/self/fd /dev/fd 66 ln -sv /proc/self/fd/0 /dev/stdin 67 ln -sv /proc/self/fd/1 /dev/stdout 68 ln -sv /proc/self/fd/2 /dev/stderr 69 ln -sv /proc/kcore /dev/core 70 mkdir -v /dev/pts 71 mkdir -v /dev/shm</userinput></screen> 72 73 <para>Finally, mount the proper virtual (kernel) file systems on the 20 <para>Mount the proper virtual (kernel) file systems on the 74 21 newly-created directories:</para> 75 22 -
chroot/common/kernfs.xml
rf2be112a red3238a 34 34 are mounted again before entering the chroot environment.</para> 35 35 36 <para> Additional file systems will soon be mounted from within the37 chroot environment. To keep the host up to date, perform a <quote>fake38 mount</quote> for each of these now:</para>36 <para>Two device nodes, /dev/console and /dev/null, are required to be 37 present on the filesystem. These are needed by the kernel even before 38 starting Udev early in the boot process, so we create them here:</para> 39 39 40 <screen><userinput>mount -f -vt tmpfs tmpfs $LFS/dev 41 mount -f -vt tmpfs tmpfs $LFS/dev/shm 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 <para>Once the system is complete and booting, the rest of our device 44 nodes are created by the Udev package. Since this package is not 45 available to us right now, we must take other steps to provide device 46 nodes under on the LFS filesystem. We will use the <quote>bind</quote> 47 option in the mount command to make our host system's /dev structure 48 appear in the new LFS filesystem:</para> 49 50 <screen><userinput>/tools/bin/mount -o bind /dev $LFS/dev</userinput></screen> 51 52 <para>Additional file systems will soon be mounted from within the chroot 53 environment. To keep the host up to date, perform a <quote>fake mount</quote> 54 for each of these now:</para> 55 56 <screen><userinput>mount -f -vt tmpfs tmpfs $LFS/dev/shm 42 57 mount -f -vt devpts -o gid=10,mode=620 devpts $LFS/dev/pts</userinput></screen> 43 58
Note:
See TracChangeset
for help on using the changeset viewer.