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