[9dfc02f] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
---|
| 3 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 4 | %general-entities;
|
---|
| 5 | ]>
|
---|
| 6 | <sect1 id="ch-system-devices" xreflabel="devices">
|
---|
[4cfd9f0f] | 7 | <title>Populating /dev</title>
|
---|
[9dfc02f] | 8 | <?dbhtml filename="devices.html"?>
|
---|
| 9 |
|
---|
[3c928f1] | 10 | <indexterm zone="ch-system-devices"><primary sortas="e-Devices">Devices</primary></indexterm>
|
---|
[9dfc02f] | 11 |
|
---|
| 12 | <sect2>
|
---|
[ef13657] | 13 | <title>Creating Initial Device Nodes</title>
|
---|
[9dfc02f] | 14 |
|
---|
| 15 | <para>When the kernel boots the system, it requires the presence of a few device
|
---|
[3c928f1] | 16 | nodes, in particular the <filename class="devicefile">console</filename> and
|
---|
[ef13657] | 17 | <filename class="devicefile">null</filename> devices. Create these by
|
---|
| 18 | running the following commands:</para>
|
---|
[9dfc02f] | 19 |
|
---|
| 20 | <screen><userinput>mknod -m 600 /dev/console c 5 1
|
---|
| 21 | mknod -m 666 /dev/null c 1 3</userinput></screen>
|
---|
| 22 | </sect2>
|
---|
| 23 |
|
---|
| 24 | <sect2>
|
---|
| 25 | <title>Mounting ramfs and populating /dev</title>
|
---|
| 26 |
|
---|
[ef13657] | 27 | <para>The ideal way to populate <filename
|
---|
| 28 | class="directory">/dev</filename> is to mount a ramfs onto <filename
|
---|
| 29 | class="directory">/dev</filename> like <systemitem
|
---|
| 30 | class="filesystem">tmpfs</systemitem>, and create the devices on there
|
---|
| 31 | during each bootup. Since the system has not been booted, it is
|
---|
| 32 | necessary to do what the bootscripts would otherwise do and populate
|
---|
| 33 | <filename class="directory">/dev</filename>. Begin by mounting
|
---|
| 34 | <filename class="directory">/dev</filename>:</para>
|
---|
[9dfc02f] | 35 |
|
---|
| 36 | <screen><userinput>mount -n -t ramfs none /dev</userinput></screen>
|
---|
| 37 |
|
---|
[ef13657] | 38 | <para>Now run the installed <command>udevstart</command> program to
|
---|
| 39 | create the initial devices based on all the information in <filename
|
---|
| 40 | class="directory">/sys</filename>:</para>
|
---|
[9dfc02f] | 41 |
|
---|
| 42 | <screen><userinput>/tools/sbin/udevstart</userinput></screen>
|
---|
| 43 |
|
---|
[ef13657] | 44 | <para>There are some symlinks and directories required by LFS that are
|
---|
| 45 | not created by Udev, so create those here:</para>
|
---|
[9dfc02f] | 46 |
|
---|
| 47 | <screen><userinput>ln -s /proc/self/fd /dev/fd
|
---|
| 48 | ln -s /proc/self/fd/0 /dev/stdin
|
---|
| 49 | ln -s /proc/self/fd/1 /dev/stdout
|
---|
| 50 | ln -s /proc/self/fd/2 /dev/stderr
|
---|
| 51 | ln -s /proc/kcore /dev/core
|
---|
| 52 | mkdir /dev/pts
|
---|
| 53 | mkdir /dev/shm</userinput></screen>
|
---|
| 54 |
|
---|
[ef13657] | 55 | <para>Finally, mount the proper virtual (kernel) file systems on the
|
---|
| 56 | newly-created directories:</para>
|
---|
[9dfc02f] | 57 |
|
---|
| 58 | <screen><userinput>mount -t devpts -o gid=4,mode=620 none /dev/pts
|
---|
| 59 | mount -t tmpfs none /dev/shm</userinput></screen>
|
---|
| 60 | </sect2>
|
---|
| 61 |
|
---|
| 62 | </sect1>
|
---|
[ef13657] | 63 |
|
---|