diff options
| -rw-r--r-- | meta/recipes-core/udev/udev/init | 5 | ||||
| -rw-r--r-- | meta/recipes-core/udev/udev/udev-cache | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init index ee7967063a..337b6d4c11 100644 --- a/meta/recipes-core/udev/udev/init +++ b/meta/recipes-core/udev/udev/init | |||
| @@ -16,6 +16,7 @@ export TZ=/etc/localtime | |||
| 16 | [ -x @UDEVD@ ] || exit 1 | 16 | [ -x @UDEVD@ ] || exit 1 |
| 17 | SYSCONF_CACHED="/etc/udev/cache.data" | 17 | SYSCONF_CACHED="/etc/udev/cache.data" |
| 18 | SYSCONF_TMP="/dev/shm/udev.cache" | 18 | SYSCONF_TMP="/dev/shm/udev.cache" |
| 19 | DEVCACHE_REGEN="/dev/shm/udev-regen" # create to request cache regen | ||
| 19 | [ -f /etc/default/udev-cache ] && . /etc/default/udev-cache | 20 | [ -f /etc/default/udev-cache ] && . /etc/default/udev-cache |
| 20 | [ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf | 21 | [ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf |
| 21 | [ -f /etc/default/rcS ] && . /etc/default/rcS | 22 | [ -f /etc/default/rcS ] && . /etc/default/rcS |
| @@ -62,6 +63,7 @@ case "$1" in | |||
| 62 | not_first_boot=1 | 63 | not_first_boot=1 |
| 63 | [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE" | 64 | [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE" |
| 64 | [ -e $SYSCONF_TMP ] && rm -f "$SYSCONF_TMP" | 65 | [ -e $SYSCONF_TMP ] && rm -f "$SYSCONF_TMP" |
| 66 | [ -e "$DEVCACHE_REGEN" ] && rm -f "$DEVCACHE_REGEN" | ||
| 65 | else | 67 | else |
| 66 | # Output detailed reason why the cached /dev is not used | 68 | # Output detailed reason why the cached /dev is not used |
| 67 | if [ "$VERBOSE" != "no" ]; then | 69 | if [ "$VERBOSE" != "no" ]; then |
| @@ -70,12 +72,13 @@ case "$1" in | |||
| 70 | echo "udev: cached sysconf: $SYSCONF_CACHED" | 72 | echo "udev: cached sysconf: $SYSCONF_CACHED" |
| 71 | echo "udev: current sysconf: $SYSCONF_TMP" | 73 | echo "udev: current sysconf: $SYSCONF_TMP" |
| 72 | fi | 74 | fi |
| 75 | touch "$DEVCACHE_REGEN" | ||
| 73 | fi | 76 | fi |
| 74 | else | 77 | else |
| 75 | if [ "$ROOTFS_READ_ONLY" != "yes" ]; then | 78 | if [ "$ROOTFS_READ_ONLY" != "yes" ]; then |
| 76 | # If rootfs is not read-only, it's possible that a new udev cache would be generated; | 79 | # If rootfs is not read-only, it's possible that a new udev cache would be generated; |
| 77 | # otherwise, we do not bother to read files. | 80 | # otherwise, we do not bother to read files. |
| 78 | cat -- "$CMP_FILE_LIST" > "$SYSCONF_TMP" | 81 | touch "$DEVCACHE_REGEN" |
| 79 | fi | 82 | fi |
| 80 | fi | 83 | fi |
| 81 | fi | 84 | fi |
diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache index e0e1c39488..814ef54c3c 100644 --- a/meta/recipes-core/udev/udev/udev-cache +++ b/meta/recipes-core/udev/udev/udev-cache | |||
| @@ -19,6 +19,7 @@ export TZ=/etc/localtime | |||
| 19 | DEVCACHE_TMP="/dev/shm/udev-cache-tmp.tar" | 19 | DEVCACHE_TMP="/dev/shm/udev-cache-tmp.tar" |
| 20 | SYSCONF_CACHED="/etc/udev/cache.data" | 20 | SYSCONF_CACHED="/etc/udev/cache.data" |
| 21 | SYSCONF_TMP="/dev/shm/udev.cache" | 21 | SYSCONF_TMP="/dev/shm/udev.cache" |
| 22 | DEVCACHE_REGEN="/dev/shm/udev-regen" # create to request cache regen | ||
| 22 | 23 | ||
| 23 | # 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. |
| 24 | CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices" | 25 | CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices" |
| @@ -30,7 +31,7 @@ if [ "$ROOTFS_READ_ONLY" = "yes" ]; then | |||
| 30 | exit 0 | 31 | exit 0 |
| 31 | fi | 32 | fi |
| 32 | 33 | ||
| 33 | if [ "$DEVCACHE" != "" -a -e "$SYSCONF_TMP" ]; then | 34 | if [ "$DEVCACHE" != "" -a -e "$DEVCACHE_REGEN" ]; then |
| 34 | echo "Populating dev cache" | 35 | echo "Populating dev cache" |
| 35 | udevadm control --stop-exec-queue | 36 | udevadm control --stop-exec-queue |
| 36 | cat -- $CMP_FILE_LIST > "$SYSCONF_TMP" | 37 | cat -- $CMP_FILE_LIST > "$SYSCONF_TMP" |
| @@ -40,6 +41,7 @@ if [ "$DEVCACHE" != "" -a -e "$SYSCONF_TMP" ]; then | |||
| 40 | rm -f "${DEVCACHE_TMP}" | 41 | rm -f "${DEVCACHE_TMP}" |
| 41 | mv "$SYSCONF_TMP" "$SYSCONF_CACHED" | 42 | mv "$SYSCONF_TMP" "$SYSCONF_CACHED" |
| 42 | udevadm control --start-exec-queue | 43 | udevadm control --start-exec-queue |
| 44 | rm -f "$DEVCACHE_REGEN" | ||
| 43 | fi | 45 | fi |
| 44 | 46 | ||
| 45 | exit 0 | 47 | exit 0 |
