summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
authorRichard Tollerton <rich.tollerton@ni.com>2014-08-22 16:30:52 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-23 23:01:59 +0100
commitab5c95ffbf579109b30edf8024c8e71888124482 (patch)
tree96e2c06b38929c8e18ee6e74d528c127322b63c2 /meta/recipes-core
parent79f5a3bc584d13fcf12eed0f47657dd4e51ac781 (diff)
downloadpoky-ab5c95ffbf579109b30edf8024c8e71888124482.tar.gz
udev-cache: omit sockets and filesystems mounted under /dev
Archiving sockets causes tar to report an error and return a nonzero exit status. Archiving a mounted filesystem is harmless, but may greatly bloat the size of the cache tarball, and wastes time on boot. To fix these issues, use `find` to only include the files we want, which are the file types that udev will create (block/char devices and symlinks) that are on the same filesystem as /dev. While we're at it, remove a subshell by archiving /dev as an absolute path. However, `tar` will complain about stripping the leading slash on stderr. To inhibit this, `cut` out the leading slash. An alternative solution is to use `tar --exclude`, but that is modestly more brittle, since we'd need to explicitly list every socket and filesystem to exclude. Note that `tar --one-file-system` is GNU-specific, and tar implementations generally have nothing equivalent to `find -type`. If using busybox `find`, this change requires CONFIG_FEATURE_FIND_TYPE=y and CONFIG_FEATURE_FIND_XDEV=y. If using busybox `tar`, this change requires CONFIG_FEATURE_TAR_FROM=y. (From OE-Core rev: e89df123e2ec516ae61763eab3c9e78e067e28d5) Signed-off-by: Richard Tollerton <rich.tollerton@ni.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/udev/udev/udev-cache3
1 files changed, 2 insertions, 1 deletions
diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
index ec07f50cc0..aaf1ddd1ac 100644
--- a/meta/recipes-core/udev/udev/udev-cache
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -26,7 +26,8 @@ fi
26 26
27if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then 27if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
28 echo "Populating dev cache" 28 echo "Populating dev cache"
29 (cd /; tar cf "${DEVCACHE_TMP}" dev) 29 find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \
30 | xargs tar cf "${DEVCACHE_TMP}" -T-
30 gzip < "${DEVCACHE_TMP}" > "$DEVCACHE" 31 gzip < "${DEVCACHE_TMP}" > "$DEVCACHE"
31 rm -f "${DEVCACHE_TMP}" 32 rm -f "${DEVCACHE_TMP}"
32 mv /dev/shm/udev.cache /etc/udev/cache.data 33 mv /dev/shm/udev.cache /etc/udev/cache.data