Fix #195: add mdevd plugin as complement to hotplug.sh

This patch adds the mdevd[1] plugin from Andy's fork of Finit, only
minor whitespace adjustment and group fix introduced, along with
updates to configure.ac and the documentation.

Currently the hotplug.sh calls mdevd-coldplug (instad of mdev -s), but
since mdevd is not guaranteed to have started and be ready, it is also
started with mdevd -C.  A better solution is to use the s6 notify code
to synchronize the start of mdevd-coldplug.  Support for this is coming
soon to Finit.

[1]: https://github.com/hongkongkiwi/finit/blob/master/plugins/mdevd.c

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2022-08-16 14:00:57 +02:00
1 parent a61a8015d7
commit d6f35903d6
5 files changed
+150 -1

No files matched your search

+15 -1
View File
@@ -39,6 +39,19 @@ static void setup(void *arg)
return;
}
/*
* If the mdevd plugin is enabled and loaded we assume this
* system is mdevd based, skipping below udev/mdev checks.
*/
if (plugin_find("mdevd")) {
path = which("mdevd-coldplug");
if (path) {
run_interactive(path, "Populating device tree");
free(path);
}
return;
}
/*
* Populate /dev and prepare for runtime events from kernel.
* Prefer udev if mdev is also available on the system.
@@ -90,12 +103,13 @@ static void setup(void *arg)
}
}
/* mdevd optional, if installed & loaded changes behavior of setup() */
static plugin_t plugin = {
.name = __FILE__,
.hook[HOOK_BASEFS_UP] = {
.cb = setup
},
.depends = { "bootmisc", "modprobe" },
.depends = { "bootmisc", "mdevd", "modprobe" },
};
PLUGIN_INIT(plugin_init)