source: chapter06/udev.xml@ 09f1daf

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 12.2 12.2-rc1 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 xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/loongarch-12.2 xry111/mips64el xry111/multilib xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 09f1daf was 2c558d69, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Look fix for PDF output.

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

  • Property mode set to 100644
File size: 13.1 KB
RevLine 
[9dfc02f]1<?xml version="1.0" encoding="ISO-8859-1"?>
[ddd5542]2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
[9dfc02f]4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
6]>
[ddd5542]7
[a001133]8<sect1 id="ch-system-udev" role="wrap">
[ddd5542]9 <?dbhtml filename="udev.html"?>
10
11 <title>Udev-&udev-version;</title>
12
13 <indexterm zone="ch-system-udev">
14 <primary sortas="a-Udev">Udev</primary>
15 </indexterm>
16
17 <sect2 role="package">
18 <title/>
[9dfc02f]19
[ddd5542]20 <para>The Udev package contains programs for dynamic creation of device
21 nodes.</para>
[9dfc02f]22
[ddd5542]23 <segmentedlist>
24 <segtitle>&buildtime;</segtitle>
25 <segtitle>&diskspace;</segtitle>
[9dfc02f]26
[ddd5542]27 <seglistitem>
28 <seg>0.1 SBU</seg>
[d2c332bc]29 <seg>4.8 MB</seg>
[ddd5542]30 </seglistitem>
31 </segmentedlist>
[9dfc02f]32
[ddd5542]33 </sect2>
[9dfc02f]34
[ddd5542]35 <sect2 role="installation">
36 <title>Installation of Udev</title>
37
[7d6d34b]38 <para>The udev-config tarball contains LFS-specific files used to configure
39 Udev.</para>
40
41<screen><userinput>tar xf ../&udev-config;.tar.bz2</userinput></screen>
42
[d2c332bc]43 <para>Create some devices and directories that Udev cannot handle due to
44 them being required very early in the boot process:</para>
45
46<screen><userinput>install -dv /lib/{firmware,udev/devices/{pts,shm}}
47mknod -m0666 /lib/udev/devices/null c 1 3
48ln -sv /proc/self/fd /lib/udev/devices/fd
49ln -sv /proc/self/fd/0 /lib/udev/devices/stdin
50ln -sv /proc/self/fd/1 /lib/udev/devices/stdout
51ln -sv /proc/self/fd/2 /lib/udev/devices/stderr
52ln -sv /proc/kcore /lib/udev/devices/core</userinput></screen>
53
[ddd5542]54 <para>Compile the package:</para>
[9dfc02f]55
[d2c332bc]56<screen><userinput>make EXTRAS="extras/ata_id extras/cdrom_id extras/edd_id \
[7d6d34b]57 extras/firmware extras/floppy extras/path_id \
58 extras/scsi_id extras/usb_id extras/volume_id"</userinput></screen>
[81fd230]59
[ddd5542]60 <variablelist>
61 <title>The meaning of the make option:</title>
62
63 <varlistentry>
[d2c332bc]64 <term><parameter>EXTRAS=...</parameter></term>
[ddd5542]65 <listitem>
[d2c332bc]66 <para>This builds several helper binaries that can aid in writing custom
67 Udev rules.</para>
[ddd5542]68 </listitem>
69 </varlistentry>
[09043c0]70
[ddd5542]71 </variablelist>
[09043c0]72
[ddd5542]73 <para>To test the results, issue:
74 <userinput>make test</userinput>.</para>
[81fd230]75
[ddd5542]76 <para>Install the package:</para>
[9dfc02f]77
[d2c332bc]78<screen><userinput>make DESTDIR=/ \
79 EXTRAS="extras/ata_id extras/cdrom_id extras/edd_id \
[7d6d34b]80 extras/firmware extras/floppy extras/path_id \
81 extras/scsi_id extras/usb_id extras/volume_id" install</userinput></screen>
[09043c0]82
[ddd5542]83 <variablelist>
84 <title>The meaning of the make parameter:</title>
[09043c0]85
[ddd5542]86 <varlistentry>
87 <term><parameter>DESTDIR=/</parameter></term>
88 <listitem>
89 <para>This prevents the Udev build process from killing any
90 <command>udevd</command> processes that may be running on the
91 host system.</para>
92 </listitem>
93 </varlistentry>
[9dfc02f]94
[ddd5542]95 </variablelist>
96
97 <para>Udev's configuration is far from ideal by default, so install
98 the configuration files here:</para>
[18da154]99
[3c19a9a]100<!-- FIXME: 90-bug.rules should be removed from the tarball once the book is released -->
101<screen><userinput>cp -v &udev-config;/[0-9]* /etc/udev/rules.d/</userinput></screen>
[18da154]102
[7d6d34b]103 <para>Now install a helper script that is not included in the main Udev
104 tarball:</para>
[d2c332bc]105
[3c19a9a]106<screen><userinput>install -v -m 744 &udev-config;/write_cd_aliases /lib/udev/</userinput></screen>
[d2c332bc]107
[ddd5542]108 <para>Install the documentation that explains how to create Udev rules:</para>
[7eac3e32]109
[2c558d69]110<screen><userinput>install -m644 -D -v docs/writing_udev_rules/index.html \
111 /usr/share/doc/udev-&udev-version;/index.html</userinput></screen>
[7eac3e32]112
[d2c332bc]113 <important>
114
115 <para>When Udev is started by the LFS-Bootscripts, a replay of all kernel
116 device events happens. These events tell Udev what devices exist.
117 Sometimes the Udev bootscript doesn't wait long enough for
118 <command>udevd</command> to process all of the replayed events and
119 consequently the devices for those missed events are not created before the
120 script exits. Since <command>udevd</command> is still running in the
121 background, the devices will be created a few milliseconds later, but the
122 next bootscript to run may require a device to exist before it has been
123 created. To avoid such missed events, and to avoid hardcoding an overly
124 long wait time, It is recommended that you run the following commands to
125 aid the LFS development team in debugging these missed events and finding
126 an acceptable solution more quickly.</para>
127
128 <para>First, create a simple C file:</para>
129
130<screen><userinput>cat &gt; bug.c &lt;&lt; EOF
131<literal>/* Simple event recorder */
132#define _GNU_SOURCE
133#include &lt;sys/types.h&gt;
134#include &lt;sys/stat.h&gt;
135#include &lt;fcntl.h&gt;
136#include &lt;unistd.h&gt;
137#include &lt;stdlib.h&gt;
138#include &lt;argz.h&gt;
139int main(int argc, char * argv[])
140{
141 char * envz;
142 size_t len;
143 int bug;
144 bug = open("/dev/bug", O_WRONLY | O_APPEND);
145 if (bug == -1)
146 return 0;
[2c558d69]147 setenv("_SEPARATOR", "-------------------------------", 1);
[d2c332bc]148 argz_create(environ, &amp;envz, &amp;len);
149 argz_stringify(envz, len, '\n');
150 envz[len-1]='\n';
151 write(bug, envz, len);
152 close(bug);
153 free(envz);
154 return 0;
155}</literal>
156EOF</userinput></screen>
157
158 <para>Now compile it:</para>
159
160<screen><userinput>gcc -o /lib/udev/bug bug.c</userinput></screen>
161
162 <para>When booting the new LFS system, if any events are missed, a warning
163 message will appear and a <filename>/dev/bugreport</filename> file will be
164 created. The warning message will tell you where to send feedback.</para>
165
166 </important>
[6135b95]167
[ddd5542]168 </sect2>
169
170 <sect2 id="contents-udev" role="content">
171 <title>Contents of Udev</title>
172
173 <segmentedlist>
174 <segtitle>Installed programs</segtitle>
175 <segtitle>Installed directory</segtitle>
176
177 <seglistitem>
[d2c332bc]178 <seg>ata_id, cdrom_id, create_floppy_devices, edd_id, firmware_helper,
[7d6d34b]179 path_id, scsi_id, udevcontrol, udevd, udevinfo, udevmonitor, udevsettle,
180 udevtest, udevtrigger, usb_id, vol_id, and write_cd_aliases</seg>
[ddd5542]181 <seg>/etc/udev</seg>
182 </seglistitem>
183 </segmentedlist>
184
185 <variablelist>
186 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
187 <?dbfo list-presentation="list"?>
188 <?dbhtml list-presentation="table"?>
189
[d2c332bc]190 <varlistentry id="ata_id">
191 <term><command>ata_id</command></term>
192 <listitem>
193 <para>Provides Udev with a unique string and
194 additional information (uuid, label) for an ATA drive</para>
195 <indexterm zone="ch-system-udev ata_id">
196 <primary sortas="b-ata_id">ata_id</primary>
197 </indexterm>
198 </listitem>
199 </varlistentry>
200
201 <varlistentry id="cdrom_id">
202 <term><command>cdrom_id</command></term>
203 <listitem>
204 <para>Provides Udev with the capabilities of a
205 CD-ROM or DVD-ROM drive</para>
206 <indexterm zone="ch-system-udev cdrom_id">
207 <primary sortas="b-cdrom_id">cdrom_id</primary>
208 </indexterm>
209 </listitem>
210 </varlistentry>
211
212 <varlistentry id="create_floppy_devices">
213 <term><command>create_floppy_devices</command></term>
[ddd5542]214 <listitem>
[d2c332bc]215 <para>Creates all possible floppy devices based on the CMOS type</para>
216 <indexterm zone="ch-system-udev create_floppy_devices">
217 <primary sortas="b-create_floppy_devices">create_floppy_devices</primary>
[ddd5542]218 </indexterm>
219 </listitem>
220 </varlistentry>
221
[d2c332bc]222 <varlistentry id="edd_id">
223 <term><command>edd_id</command></term>
[ddd5542]224 <listitem>
[d2c332bc]225 <para>Provides Udev with the EDD ID for a BIOS disk drive</para>
226 <indexterm zone="ch-system-udev edd_id">
227 <primary sortas="b-edd_id">edd_id</primary>
[ddd5542]228 </indexterm>
229 </listitem>
230 </varlistentry>
231
[d2c332bc]232 <varlistentry id="firmware_helper">
233 <term><command>firmware_helper</command></term>
[ddd5542]234 <listitem>
[d2c332bc]235 <para>Uploads firmware to devices</para>
236 <indexterm zone="ch-system-udev firmware_helper">
237 <primary sortas="b-firmware_helper">firmware_helper</primary>
238 </indexterm>
239 </listitem>
240 </varlistentry>
241
[7d6d34b]242 <varlistentry id="path_id">
243 <term><command>path_id</command></term>
244 <listitem>
245 <para>Provide the shortest possible unique hardware path to a
246 device</para>
247 <indexterm zone="ch-system-udev path_id">
248 <primary sortas="b-path_id">path_id</primary>
249 </indexterm>
250 </listitem>
251 </varlistentry>
252
[d2c332bc]253 <varlistentry id="scsi_id">
254 <term><command>scsi_id</command></term>
255 <listitem>
256 <para>Provides Udev with a unique SCSI identifier
257 based on the data returned from sending a SCSI INQUIRY command to
258 the specified device</para>
259 <indexterm zone="ch-system-udev scsi_id">
260 <primary sortas="b-scsi_id">scsi_id</primary>
[ddd5542]261 </indexterm>
262 </listitem>
263 </varlistentry>
264
265 <varlistentry id="udevcontrol">
266 <term><command>udevcontrol</command></term>
267 <listitem>
268 <para>Configures a number of options for the running
269 <command>udevd</command> daemon, such as the log level.</para>
270 <indexterm zone="ch-system-udev udevcontrol">
271 <primary sortas="b-udevcontrol">udevcontrol</primary>
272 </indexterm>
273 </listitem>
274 </varlistentry>
275
276 <varlistentry id="udevd">
277 <term><command>udevd</command></term>
278 <listitem>
[d2c332bc]279 <para>A daemon that listens for uevents on the netlink socket,
280 creates devices and runs the configured external programs in
281 response to these uevents</para>
[ddd5542]282 <indexterm zone="ch-system-udev udevd">
283 <primary sortas="b-udevd">udevd</primary>
284 </indexterm>
285 </listitem>
286 </varlistentry>
287
288 <varlistentry id="udevinfo">
289 <term><command>udevinfo</command></term>
290 <listitem>
[d2c332bc]291 <para>Allows users to query the Udev database for
[ddd5542]292 information on any device currently present on the system; it also
293 provides a way to query any device in the <systemitem
294 class="filesystem">sysfs</systemitem> tree to help create udev
295 rules</para>
296 <indexterm zone="ch-system-udev udevinfo">
297 <primary sortas="b-udevinfo">udevinfo</primary>
298 </indexterm>
299 </listitem>
300 </varlistentry>
301
302 <varlistentry id="udevmonitor">
303 <term><command>udevmonitor</command></term>
304 <listitem>
[d2c332bc]305 <para>Prints the event received from the kernel and the environment
306 which Udev sends out after rule processing</para>
[ddd5542]307 <indexterm zone="ch-system-udev udevmonitor">
308 <primary sortas="b-udevmonitor">udevmonitor</primary>
309 </indexterm>
310 </listitem>
311 </varlistentry>
312
[7d6d34b]313 <varlistentry id="udevsettle">
314 <term><command>udevsettle</command></term>
315 <listitem>
316 <para>Watches the Udev event queue and exits if all current uevents
317 have been handled</para>
318 <indexterm zone="ch-system-udev udevsettle">
319 <primary sortas="b-udevsettle">udevsettle</primary>
320 </indexterm>
321 </listitem>
322 </varlistentry>
323
[d2c332bc]324 <varlistentry id="udevtest">
325 <term><command>udevtest</command></term>
[ddd5542]326 <listitem>
[d2c332bc]327 <para>Simulates a uevent for the given device, and prints out the
328 name of the node the real <command>udevd</command> would have created,
329 or the name of the renamed network interface</para>
330 <indexterm zone="ch-system-udev udevtest">
331 <primary sortas="b-udevtest">udevtest</primary>
[ddd5542]332 </indexterm>
333 </listitem>
334 </varlistentry>
335
[7d6d34b]336 <varlistentry id="udevtrigger">
337 <term><command>udevtrigger</command></term>
338 <listitem>
339 <para>Triggers kernel device uevents to be replayed</para>
340 <indexterm zone="ch-system-udev udevtrigger">
341 <primary sortas="b-udevtrigger">udevtrigger</primary>
342 </indexterm>
343 </listitem>
344 </varlistentry>
345
[d2c332bc]346 <varlistentry id="usb_id">
347 <term><command>usb_id</command></term>
[ddd5542]348 <listitem>
[d2c332bc]349 <para>Provides Udev with information about USB
350 devices</para>
351 <indexterm zone="ch-system-udev usb_id">
352 <primary sortas="b-usb_id">usb_id</primary>
[ddd5542]353 </indexterm>
354 </listitem>
355 </varlistentry>
356
[d2c332bc]357 <varlistentry id="vol_id">
358 <term><command>vol_id</command></term>
[ddd5542]359 <listitem>
[d2c332bc]360 <para>Provides Udev with the label and uuid of a
361 filesystem</para>
362 <indexterm zone="ch-system-udev vol_id">
363 <primary sortas="b-vol_id">vol_id</primary>
[ddd5542]364 </indexterm>
365 </listitem>
366 </varlistentry>
367
368 <varlistentry id="etc-udev">
369 <term><filename class="directory">/etc/udev</filename></term>
370 <listitem>
[d2c332bc]371 <para>Contains Udev configuation files,
[ddd5542]372 device permissions, and rules for device naming</para>
373 <indexterm zone="ch-system-udev etc-udev">
374 <primary sortas="e-/etc/udev">/etc/udev</primary>
375 </indexterm>
376 </listitem>
377 </varlistentry>
378
379 </variablelist>
380
381 </sect2>
[9dfc02f]382
383</sect1>
Note: See TracBrowser for help on using the repository browser.