source: chapter06/makedev.xml@ 673b0d8

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 6.0 6.1 6.1.1 6.3 6.4 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk v5_1 v5_1_1 xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 673b0d8 was 673b0d8, checked in by Matthew Burgess <matthew@…>, 20 years ago
  • Merged newxml into HEAD

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

  • Property mode set to 100644
File size: 4.9 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<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
75unable to mount devpts, you will have to create a few static ptyXX and ttyXX
76device nodes instead. To do this, open <filename>make_devices</filename> in
77your editor, go to the section <quote>Pseudo-TTY masters</quote> and enable a
78few ptyXX devices -- a handful are enough to enable the test suites to run, but
79if you plan to run a kernel without devpts support you will probably need many
80more (every xterm, ssh connection, telnet connection, and the like, uses one of
81these pseudo terminals). In the immediately following section <quote>Pseudo-TTY
82slaves</quote>, enable the corresponding ttyXX devices. When you are done, rerun
83<command>./make_devices</command> from inside <filename>/dev</filename> to
84have 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
99static device nodes, usually residing in the <filename class="directory">/dev</filename> directory.</para>
100
101</sect2>
102
103
104
105</sect1>
Note: See TracBrowser for help on using the repository browser.