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-MAKEDEV" xreflabel="Make_devices">
|
---|
7 | <title>Creating devices with Make_devices-&makedev-version;</title>
|
---|
8 | <?dbhtml filename="makedevices.html"?>
|
---|
9 |
|
---|
10 | <indexterm zone="ch-system-MAKEDEV"><primary sortas="a-Make_devices">Make_devices</primary></indexterm>
|
---|
11 |
|
---|
12 | <para>The Make_devices package contains a script for creating device
|
---|
13 | nodes.</para>
|
---|
14 |
|
---|
15 | <screen>&buildtime; 1 SBU
|
---|
16 | &diskspace; 160 KB</screen>
|
---|
17 |
|
---|
18 | <para>For its installation Make_devices depends on: Bash, Bzip2,
|
---|
19 | Coreutils.</para>
|
---|
20 |
|
---|
21 |
|
---|
22 |
|
---|
23 | <sect2>
|
---|
24 | <title>Making devices</title>
|
---|
25 |
|
---|
26 | <para>Note that unpacking the
|
---|
27 | <filename>make_devices-&makedev-version;.bz2</filename> file doesn't
|
---|
28 | create a directory for you to <command>cd</command> into, as the file
|
---|
29 | contains only a shell script.</para>
|
---|
30 |
|
---|
31 | <para>Install the <filename>make_devices</filename> script:</para>
|
---|
32 |
|
---|
33 | <screen><userinput>bzcat make_devices-&makedev-version;.bz2 > /dev/make_devices
|
---|
34 | chmod 754 /dev/make_devices</userinput></screen>
|
---|
35 |
|
---|
36 | <para>Device nodes are special files: things that can generate or receive data.
|
---|
37 | They usually correspond to physical pieces of hardware. Device nodes can be
|
---|
38 | created by issuing commands of the form: <command>mknod -m mode name type major
|
---|
39 | minor</command>. In such a command, <emphasis>mode</emphasis> is the usual
|
---|
40 | octal read/write/execute permissions triplet, and <emphasis>name</emphasis> is
|
---|
41 | the name of the device file to be created. It may seem surprising, but the
|
---|
42 | device name is actually arbitrary, except that most programs rely on devices
|
---|
43 | such as <filename>/dev/null</filename> having their usual names. The remaining
|
---|
44 | three parameters tell the kernel what device the node
|
---|
45 | actually refers to. The <emphasis>type</emphasis> is a letter, either b or c,
|
---|
46 | indicating whether the device is accessed in blocks (such as a hard disk) or
|
---|
47 | character by character (such as the console). And <emphasis>major</emphasis>
|
---|
48 | and <emphasis>minor</emphasis> are numbers, together forming a code that
|
---|
49 | identifies the device to the kernel. A list of the currently assigned device
|
---|
50 | numbers for Linux can be found in the file <filename>devices.txt</filename> in
|
---|
51 | the <filename class="directory">Documentation</filename> subdirectory of the
|
---|
52 | kernel sources.</para>
|
---|
53 |
|
---|
54 | <para>Note that the same major/minor combination is usually assigned to both a
|
---|
55 | block and a character device. These are, however, completely unrelated devices
|
---|
56 | that cannot be interchanged. A device is identified by the type/major/minor
|
---|
57 | triple, not just the major/minor pair, so when creating a device node it is
|
---|
58 | important to choose the correct <emphasis>type</emphasis> of device.</para>
|
---|
59 |
|
---|
60 | <para>Because looking up the type/major/minor triples and using
|
---|
61 | <command>mknod</command> manually is tedious and error-prone, the
|
---|
62 | <filename>make_devices</filename> script has been created. It contains a whole
|
---|
63 | series of <command>mknod</command> commands, one for each device, complete with
|
---|
64 | recommended name, permissions and group assignment. It has been set up so that
|
---|
65 | only a minimal set of commonly used devices is enabled and the other lines are
|
---|
66 | commented out. You should open <filename>make_devices</filename> in an editor
|
---|
67 | and customize it to your needs. This takes some time, but is very simple. When
|
---|
68 | you are satisfied, run the script to create the device files:</para>
|
---|
69 |
|
---|
70 | <screen><userinput>cd /dev
|
---|
71 | ./make_devices</userinput></screen>
|
---|
72 |
|
---|
73 | <para>If you had success with mounting the devpts file system earlier in
|
---|
74 | <xref linkend="ch-system-proc"/>, you can continue with the next section. If you were
|
---|
75 | unable to mount devpts, you will have to create a few static ptyXX and ttyXX
|
---|
76 | device nodes instead. To do this, open <filename>make_devices</filename> in
|
---|
77 | your editor, go to the section <quote>Pseudo-TTY masters</quote> and enable a
|
---|
78 | few ptyXX devices -- a handful are enough to enable the test suites to run, but
|
---|
79 | if you plan to run a kernel without devpts support you will probably need many
|
---|
80 | more (every xterm, ssh connection, telnet connection, and the like, uses one of
|
---|
81 | these pseudo terminals). In the immediately following section <quote>Pseudo-TTY
|
---|
82 | slaves</quote>, enable the corresponding ttyXX devices. When you are done, rerun
|
---|
83 | <command>./make_devices</command> from inside <filename>/dev</filename> to
|
---|
84 | have it create the new devices.</para>
|
---|
85 |
|
---|
86 | </sect2>
|
---|
87 |
|
---|
88 |
|
---|
89 | <sect2 id="contents-makedev"><title>Contents of Make_devices</title>
|
---|
90 |
|
---|
91 | <para><emphasis>Installed script</emphasis>: make_devices</para>
|
---|
92 |
|
---|
93 | </sect2>
|
---|
94 |
|
---|
95 | <sect2><title>Short description</title>
|
---|
96 |
|
---|
97 | <indexterm zone="ch-system-MAKEDEV make_devices"><primary sortas="d-make_devices">make_devices</primary></indexterm>
|
---|
98 | <para id="make_devices"><command>make_devices</command> is a script for creating a basic set of
|
---|
99 | static device nodes, usually residing in the <filename class="directory">/dev</filename> directory.</para>
|
---|
100 |
|
---|
101 | </sect2>
|
---|
102 |
|
---|
103 |
|
---|
104 |
|
---|
105 | </sect1>
|
---|