Skip to contentSkip to conversation

udev-cache: fix to use udev-cache correctly

PATCH New [email protected] 1 participant 2 messages Jun 18, 2013

lore
Share & tools
lore
#0 lore raw

cover udev-cache: fix to use udev-cache correctly

From: Chen Qi <[email protected]>

The following changes since commit 7abcaf14ec9cd760fe94c777f0cd8426163de2c5:

oe-buildenv-internal: Fix exit verses return (2013-06-17 10:41:01 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib ChenQi/udev-cache-fix
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/udev-cache-fix

Chen Qi (1):
udev-cache: fix to use udev-cache correctly

 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(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 udev-cache: fix to use udev-cache correctly

From: Chen Qi <[email protected]>

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]

---
 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(-)
meta/recipes-core/systemd/systemd/init +5 -1
index 7e67a50..e369110 100644
@@ -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
meta/recipes-core/udev/udev/init +5 -1
index 95f9c03..9b81700 100644
@@ -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
meta/recipes-core/udev/udev/udev-cache +1 -3
index 01fec6e..8a84fa9 100644
@@ -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
Signature · 1 line
1.7.9.5