summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Tollerton <rich.tollerton@ni.com>2014-12-08 17:37:29 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-12-19 18:08:01 +0000
commit0002d46e784c9877ea4172de4d5c95b09a7de602 (patch)
tree0ee9d61be3be4130504259774c367b744a4613c4 /meta
parentc6e8f075a943dd897d7976e29109897856bba821 (diff)
downloadpoky-0002d46e784c9877ea4172de4d5c95b09a7de602.tar.gz
udev-cache: refactor sysconf generation
The current system configuration needs to be generated both inside udev (to compare against the cached system configuration) and udev-cache (to regenerate the cached system configuration). Use a single function definition for this task, duplicated across both initscripts. This also allows administrators to modify it for machine-specific requirements. (From OE-Core rev: 34957afcfe663eed4f5ebec0891a84467e67a48d) Signed-off-by: Richard Tollerton <rich.tollerton@ni.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-core/udev/udev/init15
-rw-r--r--meta/recipes-core/udev/udev/udev-cache8
2 files changed, 18 insertions, 5 deletions
diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init
index 337b6d4c11..96578bc15b 100644
--- a/meta/recipes-core/udev/udev/init
+++ b/meta/recipes-core/udev/udev/init
@@ -17,6 +17,16 @@ export TZ=/etc/localtime
17SYSCONF_CACHED="/etc/udev/cache.data" 17SYSCONF_CACHED="/etc/udev/cache.data"
18SYSCONF_TMP="/dev/shm/udev.cache" 18SYSCONF_TMP="/dev/shm/udev.cache"
19DEVCACHE_REGEN="/dev/shm/udev-regen" # create to request cache regen 19DEVCACHE_REGEN="/dev/shm/udev-regen" # create to request cache regen
20
21# A list of files which are used as a criteria to judge whether the udev cache could be reused.
22CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices"
23[ -f /proc/atags ] && CMP_FILE_LIST="$CMP_FILE_LIST /proc/atags"
24
25# Command to compute system configuration.
26sysconf_cmd () {
27 cat -- $CMP_FILE_LIST
28}
29
20[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache 30[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
21[ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf 31[ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
22[ -f /etc/default/rcS ] && . /etc/default/rcS 32[ -f /etc/default/rcS ] && . /etc/default/rcS
@@ -52,12 +62,9 @@ case "$1" in
52 mkdir -m 1777 -p /var/volatile/tmp 62 mkdir -m 1777 -p /var/volatile/tmp
53 63
54 # Cache handling. 64 # Cache handling.
55 # A list of files which are used as a criteria to judge whether the udev cache could be reused.
56 CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices"
57 [ -f /proc/atags ] && CMP_FILE_LIST="$CMP_FILE_LIST /proc/atags"
58 if [ "$DEVCACHE" != "" ]; then 65 if [ "$DEVCACHE" != "" ]; then
59 if [ -e $DEVCACHE ]; then 66 if [ -e $DEVCACHE ]; then
60 cat -- "$CMP_FILE_LIST" > "$SYSCONF_TMP" 67 sysconf_cmd > "$SYSCONF_TMP"
61 if cmp $SYSCONF_CACHED $SYSCONF_TMP >/dev/null; then 68 if cmp $SYSCONF_CACHED $SYSCONF_TMP >/dev/null; then
62 tar xmf $DEVCACHE -C / -m 69 tar xmf $DEVCACHE -C / -m
63 not_first_boot=1 70 not_first_boot=1
diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
index 814ef54c3c..4d50876b64 100644
--- a/meta/recipes-core/udev/udev/udev-cache
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -24,6 +24,12 @@ DEVCACHE_REGEN="/dev/shm/udev-regen" # create to request cache regen
24# A list of files which are used as a criteria to judge whether the udev cache could be reused. 24# A list of files which are used as a criteria to judge whether the udev cache could be reused.
25CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices" 25CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices"
26[ -f /proc/atags ] && CMP_FILE_LIST="$CMP_FILE_LIST /proc/atags" 26[ -f /proc/atags ] && CMP_FILE_LIST="$CMP_FILE_LIST /proc/atags"
27
28# Command to compute system configuration.
29sysconf_cmd () {
30 cat -- $CMP_FILE_LIST
31}
32
27[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache 33[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
28 34
29if [ "$ROOTFS_READ_ONLY" = "yes" ]; then 35if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
@@ -34,7 +40,7 @@ fi
34if [ "$DEVCACHE" != "" -a -e "$DEVCACHE_REGEN" ]; then 40if [ "$DEVCACHE" != "" -a -e "$DEVCACHE_REGEN" ]; then
35 echo "Populating dev cache" 41 echo "Populating dev cache"
36 udevadm control --stop-exec-queue 42 udevadm control --stop-exec-queue
37 cat -- $CMP_FILE_LIST > "$SYSCONF_TMP" 43 sysconf_cmd > "$SYSCONF_TMP"
38 find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \ 44 find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \
39 | xargs tar cf "${DEVCACHE_TMP}" -T- 45 | xargs tar cf "${DEVCACHE_TMP}" -T-
40 gzip < "${DEVCACHE_TMP}" > "$DEVCACHE" 46 gzip < "${DEVCACHE_TMP}" > "$DEVCACHE"