[bf8c11f] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
| 8 | <sect1 id="ch-chroot-devices">
|
---|
| 9 | <?dbhtml filename="devices.html"?>
|
---|
| 10 |
|
---|
| 11 | <title>Populating /dev</title>
|
---|
| 12 |
|
---|
| 13 | <indexterm zone="ch-chroot-devices">
|
---|
| 14 | <primary sortas="e-/dev/*">/dev/*</primary>
|
---|
| 15 | </indexterm>
|
---|
| 16 |
|
---|
| 17 | <sect2>
|
---|
| 18 | <title>Creating Initial Device Nodes</title>
|
---|
| 19 |
|
---|
| 20 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 21 | href="../../boot/common/devices.xml"
|
---|
[780c204] | 22 | xpointer="xpointer(//*[@os='b'])"/>
|
---|
[bf8c11f] | 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 |
|
---|
[dd9906e] | 43 | <screen><userinput>mount -n -vt tmpfs none /dev</userinput></screen>
|
---|
[bf8c11f] | 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
|
---|
[dd9906e] | 58 | chown -v root:tty /dev/{console,ptmx,tty}</userinput></screen>
|
---|
[bf8c11f] | 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 |
|
---|
[dd9906e] | 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>
|
---|
[bf8c11f] | 72 |
|
---|
| 73 | <para>Finally, mount the proper virtual (kernel) file systems on the
|
---|
| 74 | newly-created directories:</para>
|
---|
| 75 |
|
---|
[dd9906e] | 76 | <screen><userinput>mount -vt devpts -o gid=4,mode=620 none /dev/pts
|
---|
| 77 | mount -vt tmpfs none /dev/shm</userinput></screen>
|
---|
[bf8c11f] | 78 |
|
---|
| 79 | <para>The <command>mount</command> commands executed above may result
|
---|
| 80 | in the following warning message:</para>
|
---|
| 81 |
|
---|
| 82 | <screen><computeroutput>can't open /etc/fstab: No such file or directory.</computeroutput></screen>
|
---|
| 83 |
|
---|
| 84 | <para>This file—<filename>/etc/fstab</filename>—has not
|
---|
| 85 | been created yet but is also not required for the file systems to be
|
---|
| 86 | properly mounted. As such, the warning can be safely ignored.</para>
|
---|
| 87 |
|
---|
| 88 | </sect2>
|
---|
| 89 |
|
---|
| 90 | </sect1>
|
---|