summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/udev
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2011-12-20 14:13:14 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-02-02 16:55:32 +0000
commitac62f06e09be6d8b00ce1a0c7b8d90f776792471 (patch)
tree8b9bc6be10d71dd8d5c21e0d03dc1a0559af98e9 /meta/recipes-core/udev
parent7923ba87a220a216292fcb498bf11149189a3cbb (diff)
downloadpoky-ac62f06e09be6d8b00ce1a0c7b8d90f776792471.tar.gz
udev: improve udev-cache robustness
* allow udev-cache to be disabled at runtime (using /etc/default/udev-cache); * make cache invalidated if kernel, bootparams or device list changes; (From OE-Core rev: 22b72b23653736436f10d394de36201c32630d5d) Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/udev')
-rw-r--r--meta/recipes-core/udev/udev.inc8
-rw-r--r--meta/recipes-core/udev/udev/init33
-rw-r--r--meta/recipes-core/udev/udev/udev-cache14
-rw-r--r--meta/recipes-core/udev/udev/udev-cache.default4
-rw-r--r--meta/recipes-core/udev/udev_164.bb2
5 files changed, 53 insertions, 8 deletions
diff --git a/meta/recipes-core/udev/udev.inc b/meta/recipes-core/udev/udev.inc
index 0e571d6646..e5fbe403af 100644
--- a/meta/recipes-core/udev/udev.inc
+++ b/meta/recipes-core/udev/udev.inc
@@ -25,6 +25,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \
25 file://network.sh \ 25 file://network.sh \
26 file://local.rules \ 26 file://local.rules \
27 file://udev-cache \ 27 file://udev-cache \
28 file://udev-cache.default \
28 file://init" 29 file://init"
29 30
30inherit autotools pkgconfig update-rc.d 31inherit autotools pkgconfig update-rc.d
@@ -58,7 +59,7 @@ FILES_libgudev = "${base_libdir}/libgudev*.so.* ${libdir}/libgudev*.so.*"
58FILES_libgudev-dbg = "${base_libdir}/.debug/libgudev*.so.* ${libdir}/.debug/libgudev*.so.*" 59FILES_libgudev-dbg = "${base_libdir}/.debug/libgudev*.so.* ${libdir}/.debug/libgudev*.so.*"
59FILES_libgudev-dev = "${includedir}/gudev* ${libdir}/libgudev*.so ${libdir}/libgudev*.la \ 60FILES_libgudev-dev = "${includedir}/gudev* ${libdir}/libgudev*.so ${libdir}/libgudev*.la \
60 ${libdir}/libgudev*.a ${libdir}/pkgconfig/gudev*.pc" 61 ${libdir}/libgudev*.a ${libdir}/pkgconfig/gudev*.pc"
61FILES_udev-cache = "${sysconfdir}/init.d/udev-cache" 62FILES_udev-cache = "${sysconfdir}/init.d/udev-cache ${sysconfdir}/default/udev-cache"
62 63
63FILES_udev-acl = "${base_libdir}/udev/udev-acl ${base_libdir}/udev/rules.d/70-acl.rules" 64FILES_udev-acl = "${base_libdir}/udev/udev-acl ${base_libdir}/udev/rules.d/70-acl.rules"
64 65
@@ -72,6 +73,11 @@ do_install_append () {
72 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev 73 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev
73 install -m 0755 ${WORKDIR}/udev-cache ${D}${sysconfdir}/init.d/udev-cache 74 install -m 0755 ${WORKDIR}/udev-cache ${D}${sysconfdir}/init.d/udev-cache
74 75
76 install -d ${D}${sysconfdir}/default
77 install -m 0755 ${WORKDIR}/udev-cache.default ${D}${sysconfdir}/default/udev-cache
78
79 touch ${D}${sysconfdir}/udev/cache.data
80
75 install -d ${D}${sysconfdir}/udev/rules.d/ 81 install -d ${D}${sysconfdir}/udev/rules.d/
76 82
77 install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules 83 install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules
diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init
index 6a4464c639..78b5b1c4b6 100644
--- a/meta/recipes-core/udev/udev/init
+++ b/meta/recipes-core/udev/udev/init
@@ -14,8 +14,19 @@ export TZ=/etc/localtime
14[ -d /sys/class ] || exit 1 14[ -d /sys/class ] || exit 1
15[ -r /proc/mounts ] || exit 1 15[ -r /proc/mounts ] || exit 1
16[ -x /sbin/udevd ] || exit 1 16[ -x /sbin/udevd ] || exit 1
17[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
17[ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf 18[ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
18 19
20readfile () {
21 filename=$1
22 READDATA=""
23 if [ -r $filename ]; then
24 while read line; do
25 READDATA="$READDATA$line"
26 done < $filename
27 fi
28}
29
19kill_udevd() { 30kill_udevd() {
20 if [ -x /sbin/pidof ]; then 31 if [ -x /sbin/pidof ]; then
21 pid=`/sbin/pidof -x udevd` 32 pid=`/sbin/pidof -x udevd`
@@ -34,10 +45,26 @@ LANG=C awk '$2 == "/dev" && ($3 == "tmpfs" || $3 == "devtmpfs") { exit 1 }' /pro
34[ -e /dev/pts ] || mkdir -m 0755 /dev/pts 45[ -e /dev/pts ] || mkdir -m 0755 /dev/pts
35[ -e /dev/shm ] || mkdir -m 1777 /dev/shm 46[ -e /dev/shm ] || mkdir -m 1777 /dev/shm
36 47
48# cache handling
49if [ "$DEVCACHE" != "" ]; then
50 readfile /proc/version
51 VERSION="$READDATA"
52 readfile /proc/cmdline
53 CMDLINE="$READDATA"
54 readfile /proc/devices
55 DEVICES="$READDATA"
56 readfile /proc/atags
57 ATAGS="$READDATA"
37 58
38if [ -e /etc/dev.tar ]; then 59 if [ -e $DEVCACHE ]; then
39 (cd /; tar xf /etc/dev.tar 2>&1 | grep -v 'time stamp' || true) 60 readfile /etc/udev/cache.data
40 not_first_boot=1 61 if [ "$READDATA" = "$VERSION$CMDLINE$DEVICES$ATAGS" ]; then
62 (cd /; tar xf $DEVCACHE > /dev/null 2>&1)
63 not_first_boot=1
64 fi
65
66 echo "$VERSION$CMDLINE$DEVICES$ATAGS" > /dev/shm/udev.cache
67 fi
41fi 68fi
42 69
43# make_extra_nodes 70# make_extra_nodes
diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
index 77bbda6f1b..9c24e76514 100644
--- a/meta/recipes-core/udev/udev/udev-cache
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -9,12 +9,20 @@
9# Short-Description: cache /dev to speedup the udev next boot 9# Short-Description: cache /dev to speedup the udev next boot
10### END INIT INFO 10### END INIT INFO
11 11
12[ -d /sys/class ] || exit 1 12export TZ=/etc/localtime
13
13[ -r /proc/mounts ] || exit 1 14[ -r /proc/mounts ] || exit 1
14[ -x /sbin/udevd ] || exit 1 15[ -x /sbin/udevd ] || exit 1
16[ -d /sys/class ] || exit 1
17
18[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
15 19
16if [ ! -e /etc/dev.tar ]; then 20if [ "$DEVCACHE" != "" ]; then
17 (cd /; tar cf /etc/dev.tar dev) 21 echo "Populating dev cache"
22 (cd /; tar cf "$DEVCACHE" dev)
23 mv /dev/shm/udev.cache /etc/udev/cache.data
24else
25 rm -f /dev/shm/udev.cache
18fi 26fi
19 27
20exit 0 28exit 0
diff --git a/meta/recipes-core/udev/udev/udev-cache.default b/meta/recipes-core/udev/udev/udev-cache.default
new file mode 100644
index 0000000000..5c4937a9a0
--- /dev/null
+++ b/meta/recipes-core/udev/udev/udev-cache.default
@@ -0,0 +1,4 @@
1# Default for /etc/init.d/udev
2
3# Comment this out to disable device cache
4DEVCACHE="/etc/dev.tar"
diff --git a/meta/recipes-core/udev/udev_164.bb b/meta/recipes-core/udev/udev_164.bb
index c89eab4016..6d71f4dc1b 100644
--- a/meta/recipes-core/udev/udev_164.bb
+++ b/meta/recipes-core/udev/udev_164.bb
@@ -1,6 +1,6 @@
1include udev.inc 1include udev.inc
2 2
3PR = "r9" 3PR = "r10"
4 4
5SRC_URI += "file://udev-166-v4l1-1.patch" 5SRC_URI += "file://udev-166-v4l1-1.patch"
6 6