From 789354ab40b56c2447a23a5c007cf64c114b9a4a Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Wed, 27 Jul 2016 19:28:42 +0200 Subject: [PATCH] Improve udev support on non-embedded systems Embedded Linux systems usually employ BusyBox mdev. This patch assumes that all non-embedded systems employ udev. Adding support for cleaning up the udev db after the initramfs, or mounting /dev if that not done. It also runs the udev-finish script at the end. Signed-off-by: Joachim Nilsson --- finit.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/finit.c b/finit.c index ac2d7ecd..c4c15588 100644 --- a/finit.c +++ b/finit.c @@ -189,6 +189,13 @@ int main(int argc, char* argv[]) mount("none", "/proc/bus/usb", "usbfs", 0, NULL); mount("none", "/sys", "sysfs", 0, NULL); +#ifndef EMBEDDED_SYSTEM + if (!fismnt("/dev")) + mount("udev", "/dev", "devtmpfs", MS_RELATIME, "size=10%,nr_inodes=61156,mode=755"); + else + run_interactive("/sbin/udevadm info --cleanup-db", "Cleaning up udev db"); +#endif + /* Some systems use /dev/pts */ makedir("/dev/pts", 0755); mount("devpts", "/dev/pts", "devpts", 0, "gid=5,mode=620"); @@ -253,6 +260,10 @@ int main(int argc, char* argv[]) mount(SYSROOT, "/", NULL, MS_MOVE, NULL); #endif +#ifndef EMBEDDED_SYSTEM + run_interactive("/lib/udev/udev-finish", "Finalizing udev"); +#endif + _d("Root FS up, calling hooks ..."); plugin_run_hooks(HOOK_ROOTFS_UP);