[oe-commits] Chen Qi : udev-cache: fix to use udev-cache correctly

git at git.openembedded.org git at git.openembedded.org
Tue Jun 25 16:38:02 UTC 2013


Module: openembedded-core.git
Branch: master
Commit: 84e0ec2e677fb0236a38478372cdd75797cf5a2e
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=84e0ec2e677fb0236a38478372cdd75797cf5a2e

Author: Chen Qi <Qi.Chen at windriver.com>
Date:   Tue Jun 18 12:48:17 2013 +0800

udev-cache: fix to use udev-cache correctly

Previouly, the udev-cache has no real effect even if it's installed
into the system. The key problem here is that at first boot, the
/etc/dev.tar is not present, thus resulting /dev/shm/udev.cache not
created on first boot even if udev-cache is enabled.

This patch fixes this problem. The /dev/shm/udev.cache will be created
if necessary, that is, on first boot or when some part of the system is
changed. In the latter case, the udev cache may not be valid.

[YOCTO #4738]

Signed-off-by: Chen Qi <Qi.Chen at windriver.com>
Signed-off-by: Saul Wold <sgw at linux.intel.com>

---

 meta/recipes-core/systemd/systemd/init |    6 +++++-
 meta/recipes-core/udev/udev/init       |    6 +++++-
 meta/recipes-core/udev/udev/udev-cache |    4 +---
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-core/systemd/systemd/init b/meta/recipes-core/systemd/systemd/init
index 41c4136..47a1428 100644
--- a/meta/recipes-core/systemd/systemd/init
+++ b/meta/recipes-core/systemd/systemd/init
@@ -59,8 +59,12 @@ case "$1" in
                     if [ "$READDATA" = "$VERSION$CMDLINE$DEVICES$ATAGS" ]; then
                             (cd /; tar xf $DEVCACHE > /dev/null 2>&1)
                             not_first_boot=1
+                            [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
+                            [ -e /dev/shm/udev.cache ] && rm -f /dev/shm/udev.cache
+                    else
+                            echo "$VERSION$CMDLINE$DEVICES$ATAGS" > /dev/shm/udev.cache
                     fi
-
+            else
                     echo "$VERSION$CMDLINE$DEVICES$ATAGS" > /dev/shm/udev.cache
             fi
     fi
diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init
index 95f9c03..9b81700 100644
--- a/meta/recipes-core/udev/udev/init
+++ b/meta/recipes-core/udev/udev/init
@@ -68,8 +68,12 @@ case "$1" in
                     if [ "$READDATA" = "$VERSION$CMDLINE$DEVICES$ATAGS" ]; then
                             (cd /; tar xf $DEVCACHE > /dev/null 2>&1)
                             not_first_boot=1
+                            [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
+                            [ -e /dev/shm/udev.cache ] && rm -f /dev/shm/udev.cache
+                    else
+                            echo "$VERSION$CMDLINE$DEVICES$ATAGS" > /dev/shm/udev.cache
                     fi
-
+            else
                     echo "$VERSION$CMDLINE$DEVICES$ATAGS" > /dev/shm/udev.cache
             fi
     fi
diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
index 01fec6e..8a84fa9 100644
--- a/meta/recipes-core/udev/udev/udev-cache
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -17,12 +17,10 @@ export TZ=/etc/localtime
 
 [ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
 
-if [ "$DEVCACHE" != "" ]; then
+if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
 	echo "Populating dev cache"
 	(cd /; tar cf "$DEVCACHE" dev)
 	mv /dev/shm/udev.cache /etc/udev/cache.data
-else
-	rm -f /dev/shm/udev.cache
 fi
 
 exit 0



More information about the Openembedded-commits mailing list