summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/udev/udev/udev-cache18
1 files changed, 18 insertions, 0 deletions
diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
index 497d257397..a1410f5579 100644
--- a/meta/recipes-core/udev/udev/udev-cache
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -19,8 +19,22 @@ export TZ=/etc/localtime
19DEVCACHE_TMP="/dev/shm/udev-cache-tmp.tar" 19DEVCACHE_TMP="/dev/shm/udev-cache-tmp.tar"
20SYSCONF_CACHED="/etc/udev/cache.data" 20SYSCONF_CACHED="/etc/udev/cache.data"
21SYSCONF_TMP="/dev/shm/udev.cache" 21SYSCONF_TMP="/dev/shm/udev.cache"
22
23# A list of files which are used as a criteria to judge whether the udev cache could be reused.
24CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices /proc/atags"
22[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache 25[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
23 26
27readfiles () {
28 READDATA=""
29 for filename in $@; do
30 if [ -r $filename ]; then
31 while read line; do
32 READDATA="$READDATA$line"
33 done < $filename
34 fi
35 done
36}
37
24if [ "$ROOTFS_READ_ONLY" = "yes" ]; then 38if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
25 [ "$VERBOSE" != "no" ] && echo "udev-cache: read-only rootfs, skip generating udev-cache" 39 [ "$VERBOSE" != "no" ] && echo "udev-cache: read-only rootfs, skip generating udev-cache"
26 exit 0 40 exit 0
@@ -28,11 +42,15 @@ fi
28 42
29if [ "$DEVCACHE" != "" -a -e "$SYSCONF_TMP" ]; then 43if [ "$DEVCACHE" != "" -a -e "$SYSCONF_TMP" ]; then
30 echo "Populating dev cache" 44 echo "Populating dev cache"
45 udevadm control --stop-exec-queue
46 readfiles $CMP_FILE_LIST
47 echo "$READDATA" > "$SYSCONF_TMP"
31 find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \ 48 find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \
32 | xargs tar cf "${DEVCACHE_TMP}" -T- 49 | xargs tar cf "${DEVCACHE_TMP}" -T-
33 gzip < "${DEVCACHE_TMP}" > "$DEVCACHE" 50 gzip < "${DEVCACHE_TMP}" > "$DEVCACHE"
34 rm -f "${DEVCACHE_TMP}" 51 rm -f "${DEVCACHE_TMP}"
35 mv "$SYSCONF_TMP" "$SYSCONF_CACHED" 52 mv "$SYSCONF_TMP" "$SYSCONF_CACHED"
53 udevadm control --start-exec-queue
36fi 54fi
37 55
38exit 0 56exit 0