From 5196daeb4e36b321e42a8bec8302cad31c6ff690 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Mon, 13 Nov 2023 19:27:23 +0800 Subject: udev: Adjust some command Set -Dlogind=false -Dvconsole=false to disable out-of-scope udev rules. Use "ninja -n" to list the targets, so the disabled udev rules won't show up then we can remove some "rm" commands. Do not remove 70-power-switch.rules from the source directory so we won't break multilib. --- chapter08/udev.xml | 49 +++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/chapter08/udev.xml b/chapter08/udev.xml index acc23172f..3c7d7d25c 100644 --- a/chapter08/udev.xml +++ b/chapter08/udev.xml @@ -66,6 +66,8 @@ meson setup \ -Dmode=release \ -Ddev-kvm-mode=0660 \ -Dlink-udev-shared=false \ + -Dlogind=false \ + -Dvconsole=false \ .. @@ -107,38 +109,41 @@ meson setup \ and it's too overkill for a udev-only installation. + + + -Dlogind=false -Dvconsole=false + + These options prevent the generation of several udev rule + files belonging to the other Systemd components that we won't + install. + + Only build the components needed for udev: - ninja udevadm systemd-hwdb \ - $(grep -o -E "^build (src/libudev|src/udev|rules.d|hwdb.d)[^:]*" \ - build.ninja | awk '{ print $2 }') \ + ninja udevadm systemd-hwdb \ + $(ninja -n | grep -Eo '(src/(lib)?udev|rules.d|hwdb.d)/[^ ]*') \ $(realpath libudev.so --relative-to .) - Remove one udev rule file requiring a full Systemd - installation and four udev rule files for the login manager (if you need - a login manager, install the BLFS elogind package after finishing LFS; - the elogind package will install these udev rules as well): - -rm rules.d/{70-uaccess,71-seat,73-seat-late,90-vconsole}.rules -rm ../rules.d/70-power-switch.rules - Install the package: install -vm755 -d {/usr/lib,/etc}/udev/{hwdb,rules}.d install -vm755 -d /usr/{lib,share}/pkgconfig -install -vm755 udevadm /usr/bin/ -install -vm755 systemd-hwdb /usr/bin/udev-hwdb -ln -svfn ../bin/udevadm /usr/sbin/udevd -cp -av libudev.so{,*[0-9]} /usr/lib/ -install -vm644 ../src/libudev/libudev.h /usr/include/ -install -vm644 src/libudev/*.pc /usr/lib/pkgconfig/ -install -vm644 src/udev/*.pc /usr/share/pkgconfig/ -install -vm644 ../src/udev/udev.conf /etc/udev/ -install -vm644 rules.d/* ../rules.d/{*.rules,README} /usr/lib/udev/rules.d/ -install -vm644 hwdb.d/* ../hwdb.d/{*.hwdb,README} /usr/lib/udev/hwdb.d/ -install -vm755 $(find src/udev -type f | grep -F -v ".") /usr/lib/udev +install -vm755 udevadm /usr/bin/ +install -vm755 systemd-hwdb /usr/bin/udev-hwdb +ln -svfn ../bin/udevadm /usr/sbin/udevd +cp -av libudev.so{,*[0-9]} /usr/lib/ +install -vm644 ../src/libudev/libudev.h /usr/include/ +install -vm644 src/libudev/*.pc /usr/lib/pkgconfig/ +install -vm644 src/udev/*.pc /usr/share/pkgconfig/ +install -vm644 ../src/udev/udev.conf /etc/udev/ +install -vm644 rules.d/* ../rules.d/README /usr/lib/udev/rules.d/ +install -vm644 $(echo ../rules.d/*.rules | + sed 's/70-power-switch.rules//') /usr/lib/udev/rules.d/ +install -vm644 hwdb.d/* ../hwdb.d/{*.hwdb,README} /usr/lib/udev/hwdb.d/ +install -vm755 $(find src/udev -type f \ + -not -name '*.*') /usr/lib/udev Install some custom rules and support files useful in an LFS environment: -- cgit v1.2.3-54-g00ecf