]> code.ossystems Code Review - openembedded-core.git/commitdiff
udev-cache: fix to use udev-cache correctly
authorChen Qi <Qi.Chen@windriver.com>
Tue, 18 Jun 2013 04:48:17 +0000 (12:48 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 25 Jun 2013 16:30:33 +0000 (17:30 +0100)
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@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
meta/recipes-core/systemd/systemd/init
meta/recipes-core/udev/udev/init
meta/recipes-core/udev/udev/udev-cache

index 41c41366bdf50e330a5399ef4c11cc748f69dd42..47a142883cb518a00a73965b60579ba56fecc12e 100644 (file)
@@ -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
index 95f9c0355fe4cf61258f30a46c703f9160eb2b9a..9b81700ba23e682147360974e69903c2775fd9f1 100644 (file)
@@ -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
index 01fec6e96e62d896e9106922d100cba23c246dea..8a84fa9dc8ffa1b684b8a0169ebd3b0aad76cb89 100644 (file)
@@ -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