summaryrefslogtreecommitdiff
path: root/recipes/udev/udev-141/init
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/udev/udev-141/init')
-rw-r--r--recipes/udev/udev-141/init29
1 files changed, 25 insertions, 4 deletions
diff --git a/recipes/udev/udev-141/init b/recipes/udev/udev-141/init
index 9e11f08989..efe44708ca 100644
--- a/recipes/udev/udev-141/init
+++ b/recipes/udev/udev-141/init
@@ -14,6 +14,7 @@ export TZ=/etc/localtime
[ -d /sys/class ] || exit 1
[ -r /proc/mounts ] || exit 1
[ -x /sbin/udevd ] || exit 1
+[ -f /etc/default/udev ] && . /etc/default/udev
[ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
kill_udevd() {
@@ -34,9 +35,18 @@ LANG=C awk "\$2 == \"/dev\" && \$4 == \"tmpfs\" { exit 1 }" /proc/mounts && {
mkdir -m 0755 /dev/shm
}
-if [ -e /etc/dev.tar ]; then
- (cd /; tar xf /etc/dev.tar)
- not_first_boot=1
+if [ "$DEVCACHE" != "" ]; then
+ # Invalidate udev cache if the kernel or its bootargs/cmdline have changed
+ [ -x /bin/uname ] && /bin/uname -mrspv > /tmp/uname || touch /tmp/uname
+ [ -r /proc/cmdline ] && cat /proc/cmdline > /tmp/cmdline || touch /tmp/cmdline
+ [ -r /proc/atags ] && cat /proc/atags > /tmp/atags || touch /tmp/atags
+ if [ -e $DEVCACHE ] && \
+ cmp -s /tmp/uname /etc/udev/saved.uname && \
+ cmp -s /tmp/cmdline /etc/udev/saved.cmdline && \
+ cmp -s /tmp/atags /etc/udev/saved.atags; then
+ (cd /; tar xf $DEVCACHE)
+ not_first_boot=1
+ fi
fi
# make_extra_nodes
@@ -50,10 +60,21 @@ kill_udevd > "/dev/null" 2>&1
if [ "$not_first_boot" != "" ];then
/sbin/udevadm trigger --subsystem-nomatch=tty --subsystem-nomatch=mem --subsystem-nomatch=vc --subsystem-nomatch=vtconsole --subsystem-nomatch=misc --subsystem-nomatch=dcon --subsystem-nomatch=pci_bus --subsystem-nomatch=graphics --subsystem-nomatch=backlight --subsystem-nomatch=video4linux --subsystem-nomatch=platform
(/sbin/udevadm settle --timeout=3; /sbin/udevadm control env STARTUP=)&
+ if [ "$DEVCACHE" != "" ]; then
+ rm -f /tmp/uname
+ rm -f /tmp/cmdline
+ rm -f /tmp/atags
+ fi
else
/sbin/udevadm trigger
/sbin/udevadm settle
- (cd /; tar cf /etc/dev.tar dev)
+ if [ "$DEVCACHE" != "" ]; then
+ echo -n " and populating dev cache"
+ (cd /; tar cf $DEVCACHE dev)
+ mv /tmp/uname /etc/udev/saved.uname
+ mv /tmp/cmdline /etc/udev/saved.cmdline
+ mv /tmp/atags /etc/udev/saved.atags
+ fi
fi
echo