source: chapter06/makedev.xml@ 2ec64b3

v5_1_1
Last change on this file since 2ec64b3 was 2ec64b3, checked in by lfs-dev <lfs-dev@…>, 20 years ago

This commit was manufactured by cvs2svn to create tag 'v5_1_1'.

git-svn-id: http://svn.linuxfromscratch.org/LFS/tags/v5_1_1/BOOK@3757 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 5.0 KB
Line 
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
13nodes.</para>
14
15<screen>&buildtime; 1 SBU
16&diskspace; 160 KB</screen>
17
18<para>For its installation Make_devices depends on: Bash, Bzip2,
19Coreutils.</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
28create a directory for you to <command>cd</command> into, as the file
29contains 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 &gt; /dev/make_devices
34chmod 754 /dev/make_devices</userinput></screen>
35
36<para>Device nodes are special files: things that can generate or receive data.
37They usually correspond to physical pieces of hardware. Device nodes can be
38created by issuing commands of the form: <command>mknod -m mode name type major
39minor</command>. In such a command, <emphasis>mode</emphasis> is the usual
40octal read/write/execute permissions triplet, and <emphasis>name</emphasis> is
41the name of the device file to be created. It may seem surprising, but the
42device name is actually arbitrary, except that most programs rely on devices
43such as <filename>/dev/null</filename> having their usual names. The remaining
44three parameters tell the kernel what device the node
45actually refers to. The <emphasis>type</emphasis> is a letter, either b or c,
46indicating whether the device is accessed in blocks (such as a hard disk) or
47character by character (such as the console). And <emphasis>major</emphasis>
48and <emphasis>minor</emphasis> are numbers, together forming a code that
49identifies the device to the kernel. A list of the currently assigned device
50numbers for Linux can be found in the file <filename>devices.txt</filename> in
51the <filename class="directory">Documentation</filename> subdirectory of the
52kernel sources.</para>
53
54<para>Note that the same major/minor combination is usually assigned to both a
55block and a character device. These are, however, completely unrelated devices
56that cannot be interchanged. A device is identified by the type/major/minor
57triple, not just the major/minor pair, so when creating a device node it is
58important 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
63series of <command>mknod</command> commands, one for each device, complete with
64recommended name, permissions and group assignment. It has been set up so that
65only a minimal set of commonly used devices is enabled and the other lines are
66commented out. You should open <filename>make_devices</filename> in an editor
67and customize it to your needs. This takes some time, but is very simple. When
68you are satisfied, run the script to create the device files:</para>
69
70<warning><para>Failure to properly edit the <command>make_devices</command> to
71match your systems's setup (eg. number of partitions) can lead to boot errors.
72</para></warning>
73
74<screen><userinput>cd /dev
75./make_devices</userinput></screen>
76
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
79unable to mount devpts, you will have to create a few static ptyXX and ttyXX
80device nodes instead. To do this, open <filename>make_devices</filename> in
81your editor, go to the section <quote>Pseudo-TTY masters</quote> and enable a
82few ptyXX devices -- a handful are enough to enable the test suites to run, but
83if you plan to run a kernel without devpts support you will probably need many
84more (every xterm, ssh connection, telnet connection, and the like, uses one of
85these pseudo terminals). In the immediately following section <quote>Pseudo-TTY
86slaves</quote>, enable the corresponding ttyXX devices. When you are done, rerun
87<command>./make_devices</command> from inside <filename>/dev</filename> to
88have it create the new devices.</para>
89
90</sect2>
91
92
93<sect2 id="contents-makedev"><title>Contents of Make_devices</title>
94
95<para><emphasis>Installed script</emphasis>: make_devices</para>
96
97</sect2>
98
99<sect2><title>Short description</title>
100
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
103static device nodes, usually residing in the <filename class="directory">/dev</filename> directory.</para>
104
105</sect2>
106
107
108
109</sect1>
Note: See TracBrowser for help on using the repository browser.