39.16. eudev-3.2.14
Programs for dynamic creation of device nodes
The build-state snapshot was taken from 3.2.14-1; this recipe is 3.2.14-2, so the size, time and contents below describe the earlier build.
| Version | 3.2.14, release 2 |
| Shelf | base — The minimal userland and system daemons that every KDOS image boots with |
| Phase | 30_foundation (Build Foundation), 77 of 127 in build order |
| Licence | GPL-2.0-or-later AND LGPL-2.1-or-later |
| Homepage | https://github.com/eudev-project/eudev |
| Build time | 0.8 SBU |
| Installed size | 10.0 MiB in 80 files |
| Recipe | ports/core/base/eudev/kpkgbuild |
About
eudev is the device manager: udevd receives the kernel’s device events, creates and names the nodes and links under /dev, sets their owners and permissions from its rules, loads the driver a device needs, and tells the rest of the system through libudev. It is a fork of systemd’s udev that builds without systemd, and KDOS uses it in place of systemd-udevd (see No systemd). The 01_udev boot script starts it, the initramfs carries udevd and udevadm with the rules (see The initramfs), and libudev is what the session’s input, storage, audio, Bluetooth and camera stacks link to find their devices.
KDOS’s own rules are the files in fs/etc/udev/rules.d, which the file-system overlay places in /etc/udev/rules.d. The hardware database is compiled once over the finished tree rather than by this port (see Databases stamped into the image).
Sources
eudev-3.2.14.tar.gz(2.2 MiB)
sha256c340e6c51dfc5531ac0c0fa84a34b72162acf525f9023eb9cf4931b782c8f177
upstream: https://github.com/eudev-project/eudev/archive/v3.2.14.tar.gz
archive copy: sources-1/base--eudev-3.2.14.tar.gz
Dependencies
Depends on: util-linux, kmod, gperf.
Required by (82): ardour, bluez, bolt, brltty, btrfs-progs, chromium, ddcutil, dhcpcd, direwolf, e2fsprogs, elogind, f3, fuse, glmark2, gvfs, hatari, hidapi, hwloc, iio-sensor-proxy, kcoreaddons, kdeconnect, kdeplasma-addons, kinfocenter, kodi, kpmcore, ksystemstats, kwin, libatasmart, libblockdev, libcamera, libcanberra, libcec, libfido2, libfprint, libgudev, libinput, libksysguard, libqmi, libstoragemgmt, libusb, libvirt, libwacom, linuxcnc, lirc, lvm2, mdadm, mesa, mesa-opencl, modemmanager, ndctl, nut, nvtop, obs-studio, opencpn, openfpgaloader, orcaslicer, pciutils, pcsc-lite, pipewire, plasma-desktop, plasma-workspace, powerdevil, prusaslicer, qemu, qt5-qtbase, qt5-qtserialport, qt6-qtbase, qt6-qtserialport, qt6-qtwebengine, qv4l2, retroarch, sdl3, solid, spice, switcheroo-control, udftools, udisks2, usbmuxd, usbutils, v4l-utils, vlc, wine.
Patches
build.sh applies these; kpkg applies nothing by itself.
watch-reread-changed-table.patch changes synthesize_change() in src/udev/udevd.c, which runs when a program closes a watched disk it had open for writing (60-block.rules puts OPTIONS+="watch" on the sd*, vd*, nvme*, mmcblk*, loop* and other block devices it lists). Upstream takes the disk’s lock and asks the kernel to re-read its partition table (BLKRRPART) on every such close, and the re-read removes and re-adds every partition node even when the table is the same.
The patch first reads the table on the disk with libblkid, read-only, and compares it with the kernel’s partitions by number, start and size (an extended partition by its start alone, because the kernel gives it a size of one or two sectors). When they match, it skips the re-read and sends change for the disk and each partition, which re-runs the rules without touching the nodes. When the table differs, or libblkid cannot read it, the table is re-read as upstream does.
Without the patch, a program that writes the whole disk, closes it and then opens one of its partitions finds the node gone while udevd’s own re-read runs. Ventoy’s Ventoy2Disk.sh -I does exactly that between cleaning its second partition and formatting the first with mkexfatfs, and loses /dev/sda1 in a live session.
The patch also gives udevd libblkid’s compiler flags and library in src/udev/Makefile.am, which autoreconf carries into the build. It is to be offered upstream to eudev.
watch-reread-changed-table.patch— udevd: re-read a closed disk's partition table only when it changed
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/30_foundation/phase.env && kpkg install eudev'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/base/eudev.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/base/eudev
echo 'c340e6c51dfc5531ac0c0fa84a34b72162acf525f9023eb9cf4931b782c8f177 eudev-3.2.14.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/eudev
SRC=$SRC_ROOT/eudev-3.2.14
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf eudev-3.2.14.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/watch-reread-changed-table.patch"
autoreconf -f -i -s
./configure --enable-manpages \
--prefix=/usr \
--bindir=/sbin \
--sbindir=/sbin \
--libdir=/usr/lib \
--sysconfdir=/etc \
--libexecdir=/lib \
--with-rootprefix= \
--with-rootlibdir=/lib \
--enable-blkid \
--enable-kmod \
--disable-selinux
make
mkdir -pv $PKG/lib/udev/rules.d
mkdir -pv $PKG/etc/udev/rules.d
make DESTDIR=$PKG install
The switches, and why each is set:
--enable-manpages— Install the manual pagesudev(7),udevadm(8),udevd(8),udev.conf(5)andhwdb(7). They are off by default; the source ships them already formatted, so this needs no XSLT tool.--bindir=/sbin,--sbindir=/sbin— Installudevadmandudevdin/sbin, which is a link to/usr/sbin. With the two directories equal, the install makes no secondudevadmlink insbindir.--libexecdir=/lib— A directory nothing in eudev’s build uses: its helpers go to the root libexec directory, which follows--with-rootlibdir.--with-rootprefix=— An empty root prefix. The build passes it to the compiler asROOTPREFIX, which no source file reads; its effect is on configure’s split-/usrtest, which a root prefix other than the default and other than${prefix}turns on.udevdthen also reads rules from/lib/udev/rules.dand/usr/lib/udev/rules.d, and finds a helper a rule names without a path in/usr/lib/udevor/lib/udev. On KDOS’s merged layout each pair is one directory, the one the rules and helpers are installed in.--with-rootlibdir=/lib— Putlibudev.so.1in/lib, and with it the helpers and rules in/lib/udev.--libdir=/usr/libstill places the development linklibudev.so,libudev.aandlibudev.pcunder/usr/lib.--enable-blkid— Build udev’sblkidbuiltin, which probes each block device for its file system type, label and UUID and gives the rulesID_FS_*properties, the source of the/dev/disk/by-uuidand/dev/disk/by-labellinks. It links libblkid from util-linux, andyesmakes configure stop when libblkid is missing.--enable-kmod— Build thekmodbuiltin, through which a rule loads a module for a device’sMODALIAS(80-drivers.rulesdoes this for every device that has one). It links libkmod from kmod, and configure stops when it is missing.--disable-selinux— Build without libselinux, which is not a port in the tree.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/eudev, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf eudev-3.2.14-2.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/eudev, and runs the triggers its paths call for.
Contents
Installed programs: udevadm, udevd.
Installed libraries: libudev.a, libudev.so.
Installed directories: /etc/udev, /usr/share/licenses/eudev.
Short descriptions
udevadm |
udev management tool |
udevd |
Device event managing daemon |
libudev.pc |
Library to access udev device information |
udev.pc |
eudev |
Notes
The source is a GitHub tag archive with no generated configure, so build.sh runs autoreconf -f -i -s first; the autotools are in the phase’s opening run, ahead of every shelf.
eudev needs util-linux’s libblkid, so util-linux is built before it, and without libudev. The cost is in Known gaps.
udev.pc carries udevdir=/lib/udev, and a port that installs rules or helpers by asking pkg-config for that variable puts them there.