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">
6 <sect1 id="ch-system-MAKEDEV" xreflabel="Make_devices">
7 <title>Creating devices with Make_devices-&makedev-version;</title>
8 <?dbhtml filename="makedevices.html"?>
10 <indexterm zone="ch-system-MAKEDEV"><primary sortas="a-Make_devices">Make_devices</primary></indexterm>
12 <para>The Make_devices package contains a script for creating device
15 <screen>&buildtime; 1 SBU
16 &diskspace; 160 KB</screen>
18 <para>For its installation Make_devices depends on: Bash, Bzip2,
24 <title>Making devices</title>
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>
31 <para>Install the <filename>make_devices</filename> script:</para>
33 <screen><userinput>bzcat make_devices-&makedev-version;.bz2 > /dev/make_devices
34 chmod 754 /dev/make_devices</userinput></screen>
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>
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>
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>
70 <warning><para>Failure to properly edit the <command>make_devices</command> to
71 match your systems's setup (eg. number of partitions) can lead to boot errors.
74 <screen><userinput>cd /dev
75 ./make_devices</userinput></screen>
77 <para>If you had success with mounting the devpts file system earlier in
78 <xref linkend="ch-system-proc"/>, you can continue with the next section. If you were
79 unable to mount devpts, you will have to create a few static ptyXX and ttyXX
80 device nodes instead. To do this, open <filename>make_devices</filename> in
81 your editor, go to the section <quote>Pseudo-TTY masters</quote> and enable a
82 few ptyXX devices -- a handful are enough to enable the test suites to run, but
83 if you plan to run a kernel without devpts support you will probably need many
84 more (every xterm, ssh connection, telnet connection, and the like, uses one of
85 these pseudo terminals). In the immediately following section <quote>Pseudo-TTY
86 slaves</quote>, enable the corresponding ttyXX devices. When you are done, rerun
87 <command>./make_devices</command> from inside <filename>/dev</filename> to
88 have it create the new devices.</para>
93 <sect2 id="contents-makedev"><title>Contents of Make_devices</title>
95 <para><emphasis>Installed script</emphasis>: make_devices</para>
99 <sect2><title>Short description</title>
101 <indexterm zone="ch-system-MAKEDEV make_devices"><primary sortas="d-make_devices">make_devices</primary></indexterm>
102 <para id="make_devices"><command>make_devices</command> is a script for creating a basic set of
103 static device nodes, usually residing in the <filename class="directory">/dev</filename> directory.</para>