summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/udev/udev/init
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/udev/init
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/udev/init')
-rw-r--r--meta/recipes-core/udev/udev/init33
1 files changed, 30 insertions, 3 deletions
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