[oe] [PATCH] udev 124: add cache invalidation logic on kernel change or its bootargs/cmdline

Denys Dmytriyenko denis at denix.org
Tue Apr 14 23:49:58 UTC 2009


Signed-off-by: Denys Dmytriyenko <denis at denix.org>
---
 recipes/udev/udev-124/init |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/recipes/udev/udev-124/init b/recipes/udev/udev-124/init
index 9e11f08..840cddd 100644
--- a/recipes/udev/udev-124/init
+++ b/recipes/udev/udev-124/init
@@ -34,7 +34,10 @@ LANG=C awk "\$2 == \"/dev\" && \$4 == \"tmpfs\" { exit 1 }" /proc/mounts && {
         mkdir -m 0755 /dev/shm
 }
 
-if [ -e /etc/dev.tar ]; 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
+if [ -e /etc/dev.tar ] && cmp -s /tmp/uname /etc/uname && cmp -s /tmp/cmdline /etc/cmdline; then
 	(cd /; tar xf /etc/dev.tar)
 	not_first_boot=1
 fi
@@ -50,10 +53,15 @@ 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=)&
+			rm -f /tmp/uname
+			rm -f /tmp/cmdline
 		else
 			/sbin/udevadm trigger
 			/sbin/udevadm settle
+			echo -n " and populating dev cache"
 			(cd /; tar cf /etc/dev.tar dev)
+			mv /tmp/uname /etc/uname
+			mv /tmp/cmdline /etc/cmdline
 		fi
 
 echo
-- 
1.6.0.6





More information about the Openembedded-devel mailing list