%general-entities; ]> Udev-&udev-version; Udev <para>The Udev package contains programs for dynamic creation of device nodes.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> <seg>0.1 SBU</seg> <seg>4.8 MB</seg> </seglistitem> </segmentedlist> <segmentedlist> <segtitle>&dependencies;</segtitle> <seglistitem> <seg>Coreutils, GCC, Make, and Perl</seg> </seglistitem> </segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Udev Create some devices and directories that Udev cannot handle due to them being required very early in the boot process: install -dv /lib/{firmware,udev/devices/{pts,shm}} mknod -m0666 /lib/udev/devices/null c 1 3 ln -sv /proc/self/fd /lib/udev/devices/fd ln -sv /proc/self/fd/0 /lib/udev/devices/stdin ln -sv /proc/self/fd/1 /lib/udev/devices/stdout ln -sv /proc/self/fd/2 /lib/udev/devices/stderr ln -sv /proc/kcore /lib/udev/devices/core Compile the package: make EXTRAS="extras/ata_id extras/cdrom_id extras/edd_id \ extras/firmware extras/floppy extras/scsi_id \ extras/usb_id extras/volume_id" The meaning of the make option: EXTRAS=... This builds several helper binaries that can aid in writing custom Udev rules. To test the results, issue: make test. Install the package: make DESTDIR=/ \ EXTRAS="extras/ata_id extras/cdrom_id extras/edd_id \ extras/firmware extras/floppy extras/scsi_id \ extras/usb_id extras/volume_id" install The meaning of the make parameter: DESTDIR=/ This prevents the Udev build process from killing any udevd processes that may be running on the host system. Udev's configuration is far from ideal by default, so install the configuration files here: cp -v ../&udev-config-file; /etc/udev/rules.d/25-lfs.rules Create some rules that work around broken sysfs attribute creation timing in linux-2.6.15: cat >> /etc/udev/rules.d/10-wait_for_sysfs.rules << "EOF" ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" EOF Install the documentation that explains how to create Udev rules: install -m644 -D -v docs/writing_udev_rules/index.html /usr/share/doc/udev-&udev-version;/index.html When Udev is started by the LFS-Bootscripts, a replay of all kernel device events happens. These events tell Udev what devices exist. Sometimes the Udev bootscript doesn't wait long enough for udevd to process all of the replayed events and consequently the devices for those missed events are not created before the script exits. Since udevd is still running in the background, the devices will be created a few milliseconds later, but the next bootscript to run may require a device to exist before it has been created. To avoid such missed events, and to avoid hardcoding an overly long wait time, It is recommended that you run the following commands to aid the LFS development team in debugging these missed events and finding an acceptable solution more quickly. First, create a simple C file: cat > bug.c << EOF /* Simple event recorder */ #define _GNU_SOURCE #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include <argz.h> int main(int argc, char * argv[]) { char * envz; size_t len; int bug; bug = open("/dev/bug", O_WRONLY | O_APPEND); if (bug == -1) return 0; setenv("_SEPARATOR", "--------------------------------------", 1); argz_create(environ, &envz, &len); argz_stringify(envz, len, '\n'); envz[len-1]='\n'; write(bug, envz, len); close(bug); free(envz); return 0; } EOF Now compile it: gcc -o /lib/udev/bug bug.c The next step adds a simple logging rule to run this program. cat > /etc/udev/rules.d/90-bug.rules << "EOF" ACTION=="add", RUN+="bug" EOF When booting the new LFS system, if any events are missed, a warning message will appear and a /dev/bugreport file will be created. The warning message will tell you where to send feedback. Contents of Udev Installed programs Installed directory ata_id, cdrom_id, create_floppy_devices, edd_id, firmware_helper, scsi_id, udevcontrol, udevd, udevinfo, udevmonitor, udevtest, usb_id and vol_id /etc/udev Short Descriptions ata_id Provides Udev with a unique string and additional information (uuid, label) for an ATA drive ata_id cdrom_id Provides Udev with the capabilities of a CD-ROM or DVD-ROM drive cdrom_id create_floppy_devices Creates all possible floppy devices based on the CMOS type create_floppy_devices edd_id Provides Udev with the EDD ID for a BIOS disk drive edd_id firmware_helper Uploads firmware to devices firmware_helper scsi_id Provides Udev with a unique SCSI identifier based on the data returned from sending a SCSI INQUIRY command to the specified device scsi_id udevcontrol Configures a number of options for the running udevd daemon, such as the log level. udevcontrol udevd A daemon that listens for uevents on the netlink socket, creates devices and runs the configured external programs in response to these uevents udevd udevinfo Allows users to query the Udev database for information on any device currently present on the system; it also provides a way to query any device in the sysfs tree to help create udev rules udevinfo udevmonitor Prints the event received from the kernel and the environment which Udev sends out after rule processing udevmonitor udevtest Simulates a uevent for the given device, and prints out the name of the node the real udevd would have created, or the name of the renamed network interface udevtest usb_id Provides Udev with information about USB devices usb_id vol_id Provides Udev with the label and uuid of a filesystem vol_id /etc/udev Contains Udev configuation files, device permissions, and rules for device naming /etc/udev