1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 | ]>
|
---|
7 |
|
---|
8 | <sect1 id="ch-boot-devices">
|
---|
9 | <?dbhtml filename="devices.html"?>
|
---|
10 |
|
---|
11 | <title>Populating /dev</title>
|
---|
12 |
|
---|
13 | <indexterm zone="ch-boot-devices">
|
---|
14 | <primary sortas="e-/dev/*">/dev/*</primary>
|
---|
15 | </indexterm>
|
---|
16 |
|
---|
17 | <sect2>
|
---|
18 | <title>Creating Initial Device Nodes</title>
|
---|
19 |
|
---|
20 | <note os="a">
|
---|
21 | <para>The commands in the remainder of the book should be run as
|
---|
22 | the <systemitem class="username">root</systemitem> user. Also,
|
---|
23 | double-check that ${CLFS} is set as
|
---|
24 | <systemitem class="username">root</systemitem>.</para>
|
---|
25 | </note>
|
---|
26 |
|
---|
27 | <para os="b">When the kernel boots the system, it requires the presence
|
---|
28 | of a few device nodes, in particular the <filename
|
---|
29 | class="devicefile">console</filename> and <filename
|
---|
30 | class="devicefile">null</filename> devices. The device nodes will
|
---|
31 | be created on the hard disk so that they are available before
|
---|
32 | <command>udev</command> has been started, and additionally when Linux
|
---|
33 | is started in single user mode (hence the restrictive permissions on
|
---|
34 | <filename class="devicefile">console</filename>). Create these by running
|
---|
35 | the following commands:</para>
|
---|
36 |
|
---|
37 | <screen><userinput>mknod -m 0600 ${CLFS}/dev/console c 5 1
|
---|
38 | mknod -m 0666 ${CLFS}/dev/null c 1 3
|
---|
39 | mknod -m 0666 ${CLFS}/dev/zero c 1 5</userinput></screen>
|
---|
40 |
|
---|
41 | <para>When systemd starts a tmpfs filesystem is mounted over
|
---|
42 | <filename class="directory">/dev</filename> and the previous entries are
|
---|
43 | no-longer available. The folling command creates files that are copied
|
---|
44 | over when udevd starts:</para>
|
---|
45 |
|
---|
46 | <screen><userinput>mkdir -pv ${CLFS}/lib/udev/devices/{pts,shm}
|
---|
47 | mknod -m 0600 ${CLFS}/lib/udev/devices/console c 5 1
|
---|
48 | mknod -m 0666 ${CLFS}/lib/udev/devices/null c 1 3
|
---|
49 | mknod -m 0666 ${CLFS}/lib/udev/devices/zero c 1 5
|
---|
50 | mknod -m 0600 ${CLFS}/lib/udev/devices/kmsg c 1 11
|
---|
51 | ln -snvf /proc/self/fd ${CLFS}/lib/udev/devices/fd
|
---|
52 | ln -snvf /proc/self/fd/0 ${CLFS}/lib/udev/devices/stdin
|
---|
53 | ln -snvf /proc/self/fd/1 ${CLFS}/lib/udev/devices/stdout
|
---|
54 | ln -snvf /proc/self/fd/2 ${CLFS}/lib/udev/devices/stderr
|
---|
55 | ln -snvf /proc/kcore ${CLFS}/lib/udev/devices/core</userinput></screen>
|
---|
56 |
|
---|
57 | </sect2>
|
---|
58 |
|
---|
59 | </sect1>
|
---|