[Buildroot] [PATCH] eudev: generate /etc/udev/hwdb.bin at system startup
Carlos Santos
casantos at datacom.ind.br
Mon Jan 29 04:19:31 UTC 2018
Programs that use libudev (e.g. lsusb, from usbutils) need the hwdb.bin
file to work properly.
If BR2_PACKAGE_EUDEV_ENABLE_HWDB is selected then the eudev installation
populates /etc/udev/hwdb.d/ but does not genarete /etc/udev/hwdb.bin. It
must be created running "udevadm hwdb --update" on the target device.
Signed-off-by: Carlos Santos <casantos at datacom.ind.br>
---
package/eudev/S10udev | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/package/eudev/S10udev b/package/eudev/S10udev
index 8382bec2bb..5c25e51317 100755
--- a/package/eudev/S10udev
+++ b/package/eudev/S10udev
@@ -25,14 +25,22 @@ UDEV_CONFIG=/etc/udev/udev.conf
test -r $UDEV_CONFIG || exit 6
. $UDEV_CONFIG
+UDEV_HWDB_BIN=/etc/udev/hwdb.bin
+UDEV_HWDB_D=/etc/udev/hwdb.d
+
case "$1" in
start)
printf "Populating ${udev_root:-/dev} using udev: "
printf '\000\000\000\000' > /proc/sys/kernel/hotplug
- $UDEV_BIN -d || (echo "FAIL" && exit 1)
+ $UDEV_BIN -d || { echo "FAIL" && exit 1; }
udevadm trigger --type=subsystems --action=add
udevadm trigger --type=devices --action=add
- udevadm settle --timeout=30 || echo "udevadm settle failed"
+ udevadm settle --timeout=30 || { echo "udevadm settle failed" && exit 1; }
+ [ -d "$UDEV_HWDB_D" ] && {
+ echo "done"
+ printf "Compiling hardware database information $UDEV_HWDB_BIN: "
+ udevadm hwdb --update || { echo "FAIL" && exit 1; }
+ }
echo "done"
;;
stop)
--
2.14.3
More information about the buildroot
mailing list