diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2011-12-20 14:13:14 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-02-02 14:55:44 +0000 |
commit | 22b72b23653736436f10d394de36201c32630d5d (patch) | |
tree | fd60a191a8702bbb3c15f7c680ad44efdeb805b2 /meta/recipes-core/udev/udev/init | |
parent | 4346516a6a719355d2793af289f93e14d3dedd0c (diff) | |
download | openembedded-core-contrib-22b72b23653736436f10d394de36201c32630d5d.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;
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'meta/recipes-core/udev/udev/init')
-rw-r--r-- | meta/recipes-core/udev/udev/init | 33 |
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 [ -d /sys/class ] || exit 1 [ -r /proc/mounts ] || exit 1 [ -x /sbin/udevd ] || exit 1 +[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache [ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf +readfile () { + filename=$1 + READDATA="" + if [ -r $filename ]; then + while read line; do + READDATA="$READDATA$line" + done < $filename + fi +} + kill_udevd() { if [ -x /sbin/pidof ]; then pid=`/sbin/pidof -x udevd` @@ -34,10 +45,26 @@ LANG=C awk '$2 == "/dev" && ($3 == "tmpfs" || $3 == "devtmpfs") { exit 1 }' /pro [ -e /dev/pts ] || mkdir -m 0755 /dev/pts [ -e /dev/shm ] || mkdir -m 1777 /dev/shm +# cache handling +if [ "$DEVCACHE" != "" ]; then + readfile /proc/version + VERSION="$READDATA" + readfile /proc/cmdline + CMDLINE="$READDATA" + readfile /proc/devices + DEVICES="$READDATA" + readfile /proc/atags + ATAGS="$READDATA" -if [ -e /etc/dev.tar ]; then - (cd /; tar xf /etc/dev.tar 2>&1 | grep -v 'time stamp' || true) - not_first_boot=1 + if [ -e $DEVCACHE ]; then + readfile /etc/udev/cache.data + if [ "$READDATA" = "$VERSION$CMDLINE$DEVICES$ATAGS" ]; then + (cd /; tar xf $DEVCACHE > /dev/null 2>&1) + not_first_boot=1 + fi + + echo "$VERSION$CMDLINE$DEVICES$ATAGS" > /dev/shm/udev.cache + fi fi # make_extra_nodes |