summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/udev
diff options
context:
space:
mode:
authorChangqing Li <changqing.li@windriver.com>2022-05-20 19:05:09 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-05-21 08:37:30 +0100
commit35e9ce18f57acf31cc49f0dddbb3346cf643f028 (patch)
treee5696e1ff137323ef5832bc95442a68df8e3a7e3 /meta/recipes-core/udev
parentd14c6c45fc918a58a66129e00b681f8e3a4123e3 (diff)
downloadpoky-35e9ce18f57acf31cc49f0dddbb3346cf643f028.tar.gz
eudev: create static-nodes in init script
dev in modules.devname should be populated in /dev on boot. remove create static mode from udevd will make these devices cannot be populated. Since commit [1], when use sysVinit, devices like /dev/net/tun will not be created. more info: udevd in systemd also remove create static mode in udevd, but using service kmod-static-nodes.service and systemd-tmpfiles-setup-dev.service in systemd to create these node, so systemd works well. For sysV, parse kmod static-nodes and generate the device nodes in init [1] https://gitweb.gentoo.org/proj/eudev.git/commit/?id=2b7abd5ec9cc47a8b895df6db77fb1537c6f1a39 (From OE-Core rev: 10940ee60864500f037a73d8bde8d74f9917959c) Signed-off-by: Changqing Li <changqing.li@windriver.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/udev')
-rw-r--r--meta/recipes-core/udev/eudev/init37
-rw-r--r--meta/recipes-core/udev/eudev_3.2.11.bb2
2 files changed, 39 insertions, 0 deletions
diff --git a/meta/recipes-core/udev/eudev/init b/meta/recipes-core/udev/eudev/init
index c60dbbf6d5..477a525b21 100644
--- a/meta/recipes-core/udev/eudev/init
+++ b/meta/recipes-core/udev/eudev/init
@@ -23,6 +23,42 @@ kill_udevd () {
23 [ -n "$pid" ] && kill $pid 23 [ -n "$pid" ] && kill $pid
24} 24}
25 25
26make_static_nodes () {
27 [ -e /lib/modules/$(uname -r)/modules.devname ] || return 0
28 [ -x @KMOD@ ] || return 0
29
30 #output to /proc/self/fd/1 since /dev/stdout not created by udevd yet
31 @KMOD@ static-nodes --format=tmpfiles --output=/proc/self/fd/1 |
32 while read TTYPE TPATH TMODE TUSER TGROUP TAGE TARG; do
33 case "${TTYPE}" in
34 'd')
35 test -d "${TPATH}" || mkdir -p -m "${TMODE}" "${TPATH}"
36 ;;
37
38 'c!')
39 if [ ! -c "${TPATH}" ]; then
40 old_ifs="${IFS}"
41 IFS=:
42 set -- ${TARG}
43 IFS="${old_ifs}"
44 mknod -m "${TMODE}" "${TPATH}" c "$@"
45 fi
46 ;;
47
48 *)
49 echo "Unparseable line (${TTYPE} ${TPATH} ${TMODE} ${TUSER} ${TGROUP} ${TAGE} ${TARG})"
50 return 1
51 ;;
52 esac
53 if [ "${TUSER}" != "-" ]; then
54 chown "${TUSER}" "${TPATH}"
55 fi
56 if [ "${TGROUP}" != "-" ]; then
57 chgrp "${TGROUP}" "${TPATH}"
58 fi
59 done
60}
61
26case "$1" in 62case "$1" in
27 start) 63 start)
28 export ACTION=add 64 export ACTION=add
@@ -51,6 +87,7 @@ case "$1" in
51 # make_extra_nodes 87 # make_extra_nodes
52 kill_udevd > "/dev/null" 2>&1 88 kill_udevd > "/dev/null" 2>&1
53 89
90 make_static_nodes
54 # trigger the sorted events 91 # trigger the sorted events
55 [ -e /proc/sys/kernel/hotplug ] && printf '\0\n' >/proc/sys/kernel/hotplug 92 [ -e /proc/sys/kernel/hotplug ] && printf '\0\n' >/proc/sys/kernel/hotplug
56 @UDEVD@ -d 93 @UDEVD@ -d
diff --git a/meta/recipes-core/udev/eudev_3.2.11.bb b/meta/recipes-core/udev/eudev_3.2.11.bb
index 841039f6d7..a0a19e501d 100644
--- a/meta/recipes-core/udev/eudev_3.2.11.bb
+++ b/meta/recipes-core/udev/eudev_3.2.11.bb
@@ -41,6 +41,7 @@ do_install:append() {
41 install -d ${D}${sysconfdir}/init.d 41 install -d ${D}${sysconfdir}/init.d
42 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev 42 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev
43 sed -i s%@UDEVD@%${base_sbindir}/udevd% ${D}${sysconfdir}/init.d/udev 43 sed -i s%@UDEVD@%${base_sbindir}/udevd% ${D}${sysconfdir}/init.d/udev
44 sed -i s%@KMOD@%${base_bindir}/kmod% ${D}${sysconfdir}/init.d/udev
44 45
45 install -d ${D}${sysconfdir}/udev/rules.d 46 install -d ${D}${sysconfdir}/udev/rules.d
46 install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules 47 install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules
@@ -73,6 +74,7 @@ FILES:libudev = "${base_libdir}/libudev.so.*"
73FILES:eudev-hwdb = "${sysconfdir}/udev/hwdb.d" 74FILES:eudev-hwdb = "${sysconfdir}/udev/hwdb.d"
74 75
75RDEPENDS:eudev-hwdb += "eudev" 76RDEPENDS:eudev-hwdb += "eudev"
77RDEPENDS:eudev += "kmod"
76 78
77RPROVIDES:${PN} = "hotplug udev" 79RPROVIDES:${PN} = "hotplug udev"
78RPROVIDES:eudev-hwdb += "udev-hwdb" 80RPROVIDES:eudev-hwdb += "udev-hwdb"