6.60. Udev-208 (Extracted from systemd-208)

The Udev package contains programs for dynamic creation of device nodes. The development of udev has been merged with systemd, but most of systemd is incompatible with LFS. Here we build and install just the needed udev files.

Approximate build time: 0.1 SBU
Required disk space: 29 MB

6.60.1. Installation of Udev

[Note]

Note

This package is a little different from other packages. The initial package that is extracted is systemd-208.tar.xz even though the application we are installing is udev. After changing to the systemd directory, follow the instructions below.

The udev-lfs tarball contains LFS-specific files used to build Udev. Unpack it into the systemd source directory:

tar -xvf ../udev-lfs-208-3.tar.bz2

Create two symbolic links to header files and set an environment variable to properly use Section 5.33, “Util-linux-2.24.1”.

ln -svf /tools/include/blkid /usr/include
ln -svf /tools/include/uuid  /usr/include
export LD_LIBRARY_PATH=/tools/lib

Build the package:

make -f udev-lfs-208-3/Makefile.lfs

Install the package:

make -f udev-lfs-208-3/Makefile.lfs install
[Caution]

Caution

There are several places within the systemd source code that have explicit directory paths embedded. For instance, the binary version of the hardware database's path and file name used at run time, /etc/udev/hwdb.bin, cannot be changed without explicit changes to the source code.

Now initialize the hardware database:

build/udevadm hwdb --update

Finally set up the persistent network udev rules. This task will be explained in detail in Section 7.2.1, “Creating stable names for network interfaces”. Note that the /sys and /proc filesystems must be mounted in the chroot environment as explained at the beginning of this chapter for the following script to work.

bash udev-lfs-208-3/init-net-rules.sh

Do some cleanup:

rm -fv /usr/include/{uuid,blkid}
unset LD_LIBRARY_PATH

6.60.2. Contents of Udev

Installed programs: accelerometer, ata_id, cdrom_id, collect, mtd_probe, scsi_id, v4l_id, udevadm, and udevd
Installed libraries: libudev.so
Installed directories: /etc/udev, /lib/udev, /lib/firmware, /usr/share/doc/udev

Short Descriptions

ata_id

Provides Udev with a unique string and additional information (uuid, label) for an ATA drive

cdrom_id

Provides Udev with the capabilities of a CD-ROM or DVD-ROM drive

collect

Given an ID for the current uevent and a list of IDs (for all target uevents), registers the current ID and indicates whether all target IDs have been registered

scsi_id

Provides Udev with a unique SCSI identifier based on the data returned from sending a SCSI INQUIRY command to the specified device

udevadm

Generic udev administration tool: controls the udevd daemon, provides info from the Udev database, monitors uevents, waits for uevents to finish, tests Udev configuration, and triggers uevents for a given device

udevd

A daemon that listens for uevents on the netlink socket, creates devices and runs the configured external programs in response to these uevents

libudev

A library interface to udev device information

/etc/udev

Contains Udev configuration files, device permissions, and rules for device naming