eudev: Remove udev-cache

As eudev requires devtmpfs it is not necessary to keep a cache anymore
as the kernel handles entries in /dev itself.

(From OE-Core rev: 048f4149b8438c521e8b65a3c96d850a9b4a3e5b)

Signed-off-by: Oliver Stäbler <oliver.staebler@bytesatwork.ch>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Oliver Stäbler
2017-08-02 11:37:10 +02:00
committed by Richard Purdie
parent c3e2ad0695
commit 44f550f392
4 changed files with 2 additions and 147 deletions

View File

@@ -14,25 +14,7 @@ export TZ=/etc/localtime
[ -d /sys/class ] || exit 1
[ -r /proc/mounts ] || exit 1
[ -x @UDEVD@ ] || exit 1
SYSCONF_CACHED="/etc/udev/cache.data"
SYSCONF_TMP="/dev/shm/udev.cache"
DEVCACHE_REGEN="/dev/shm/udev-regen" # create to request cache regen
# A list of files which are used as a criteria to judge whether the udev cache could be reused.
CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices"
[ -f /proc/atags ] && CMP_FILE_LIST="$CMP_FILE_LIST /proc/atags"
# List of files whose metadata (size/mtime/name) will be included in cached
# system state.
META_FILE_LIST="lib/udev/rules.d/* etc/udev/rules.d/*"
# Command to compute system configuration.
sysconf_cmd () {
cat -- $CMP_FILE_LIST
stat -c '%s %Y %n' -- $META_FILE_LIST | awk -F/ '{print $1 " " $NF;}'
}
[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
[ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
[ -f /etc/default/rcS ] && . /etc/default/rcS
@@ -66,37 +48,6 @@ case "$1" in
# /var/volatile/tmp directory to be available.
mkdir -m 1777 -p /var/volatile/tmp
# Cache handling.
if [ "$DEVCACHE" != "" ]; then
if [ -e $DEVCACHE ]; then
sysconf_cmd > "$SYSCONF_TMP"
if cmp $SYSCONF_CACHED $SYSCONF_TMP >/dev/null; then
tar xmf $DEVCACHE -C / -m
not_first_boot=1
[ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
[ -e $SYSCONF_TMP ] && rm -f "$SYSCONF_TMP"
[ -e "$DEVCACHE_REGEN" ] && rm -f "$DEVCACHE_REGEN"
else
# Output detailed reason why the cached /dev is not used
cat <<EOF
udev: Not using udev cache because of changes detected in the following files:
udev: $CMP_FILE_LIST
udev: $META_FILE_LIST
udev: The udev cache will be regenerated. To identify the detected changes,
udev: compare the cached sysconf at $SYSCONF_CACHED
udev: against the current sysconf at $SYSCONF_TMP
EOF
touch "$DEVCACHE_REGEN"
fi
else
if [ "$ROOTFS_READ_ONLY" != "yes" ]; then
# If rootfs is not read-only, it's possible that a new udev cache would be generated;
# otherwise, we do not bother to read files.
touch "$DEVCACHE_REGEN"
fi
fi
fi
# make_extra_nodes
kill_udevd > "/dev/null" 2>&1

View File

@@ -1,75 +0,0 @@
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: udev-cache
# Required-Start: mountall
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: cache /dev to speedup the udev next boot
### END INIT INFO
export TZ=/etc/localtime
[ -r /proc/mounts ] || exit 1
[ -x @UDEVD@ ] || exit 1
[ -d /sys/class ] || exit 1
[ -f /etc/default/rcS ] && . /etc/default/rcS
DEVCACHE_TMP="/dev/shm/udev-cache-tmp.tar"
SYSCONF_CACHED="/etc/udev/cache.data"
SYSCONF_TMP="/dev/shm/udev.cache"
DEVCACHE_REGEN="/dev/shm/udev-regen" # create to request cache regen
# A list of files which are used as a criteria to judge whether the udev cache could be reused.
CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices"
[ -f /proc/atags ] && CMP_FILE_LIST="$CMP_FILE_LIST /proc/atags"
# List of files whose metadata (size/mtime/name) will be included in cached
# system state.
META_FILE_LIST="lib/udev/rules.d/* etc/udev/rules.d/*"
# Command to compute system configuration.
sysconf_cmd () {
cat -- $CMP_FILE_LIST
stat -c '%s %Y %n' -- $META_FILE_LIST | awk -F/ '{print $1 " " $NF;}'
}
[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
[ "$VERBOSE" != "no" ] && echo "udev-cache: read-only rootfs, skip generating udev-cache"
exit 0
fi
[ "$DEVCACHE" != "" ] || exit 0
[ "${VERBOSE}" == "no" ] || echo -n "udev-cache: checking for ${DEVCACHE_REGEN}... "
if ! [ -e "$DEVCACHE_REGEN" ]; then
[ "${VERBOSE}" == "no" ] || echo "not found."
exit 0
fi
[ "${VERBOSE}" == "no" ] || echo "found."
echo "Populating dev cache"
err_cleanup () {
echo "udev-cache: update failed!"
udevadm control --start-exec-queue
rm -f -- "$SYSCONF_TMP" "$DEVCACHE_TMP" "$DEVCACHE" "$SYSCONF_CACHED"
}
(
set -e
trap 'err_cleanup' EXIT
udevadm control --stop-exec-queue
sysconf_cmd > "$SYSCONF_TMP"
find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \
| xargs tar cf "${DEVCACHE_TMP}"
gzip < "${DEVCACHE_TMP}" > "$DEVCACHE"
rm -f "${DEVCACHE_TMP}"
mv "$SYSCONF_TMP" "$SYSCONF_CACHED"
udevadm control --start-exec-queue
rm -f "$DEVCACHE_REGEN"
trap - EXIT
) &
exit 0

View File

@@ -1,5 +0,0 @@
# Default for /etc/init.d/udev
# Comment this out to disable device cache
DEVCACHE="/etc/udev-cache.tar.gz"
PROBE_PLATFORM_BUS="yes"

View File

@@ -17,8 +17,6 @@ SRC_URI = "https://github.com/gentoo/${BPN}/archive/v${PV}.tar.gz;downloadfilena
file://local.rules \
file://permissions.rules \
file://run.rules \
file://udev-cache \
file://udev-cache.default \
file://udev.rules \
"
UPSTREAM_CHECK_URI = "https://github.com/gentoo/eudev/releases"
@@ -40,14 +38,7 @@ PACKAGECONFIG[hwdb] = "--enable-hwdb,--disable-hwdb"
do_install_append() {
install -d ${D}${sysconfdir}/init.d
install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev
install -m 0755 ${WORKDIR}/udev-cache ${D}${sysconfdir}/init.d/udev-cache
sed -i s%@UDEVD@%${base_sbindir}/udevd% ${D}${sysconfdir}/init.d/udev
sed -i s%@UDEVD@%${base_sbindir}/udevd% ${D}${sysconfdir}/init.d/udev-cache
install -d ${D}${sysconfdir}/default
install -m 0755 ${WORKDIR}/udev-cache.default ${D}${sysconfdir}/default/udev-cache
touch ${D}${sysconfdir}/udev/cache.data
install -d ${D}${sysconfdir}/udev/rules.d
install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules
@@ -59,14 +50,10 @@ do_install_append() {
rm -f ${D}${base_libdir}/udev/hid2hci
}
INITSCRIPT_PACKAGES = "eudev udev-cache"
INITSCRIPT_NAME_eudev = "udev"
INITSCRIPT_PARAMS_eudev = "start 04 S ."
INITSCRIPT_NAME_udev-cache = "udev-cache"
INITSCRIPT_PARAMS_udev-cache = "start 36 S ."
INITSCRIPT_NAME = "udev"
INITSCRIPT_PARAMS = "start 04 S ."
PACKAGES =+ "libudev"
PACKAGES =+ "udev-cache"
PACKAGES =+ "eudev-hwdb"
@@ -76,13 +63,10 @@ FILES_${PN}-dev = "${datadir}/pkgconfig/udev.pc \
${includedir}/udev.h ${libdir}/libudev.la \
${libdir}/libudev.a ${libdir}/pkgconfig/libudev.pc"
FILES_libudev = "${base_libdir}/libudev.so.*"
FILES_udev-cache = "${sysconfdir}/init.d/udev-cache ${sysconfdir}/default/udev-cache"
FILES_eudev-hwdb = "${sysconfdir}/udev/hwdb.d"
RDEPENDS_eudev-hwdb += "eudev"
RRECOMMENDS_${PN} += "udev-cache"
RPROVIDES_${PN} = "hotplug udev"
RPROVIDES_eudev-hwdb += "udev-hwdb"