[oe-commits] Koen Kooi : udev 141: add /dev cache, install binaries to the correct locations

GIT User account git at amethyst.openembedded.net
Tue May 19 10:57:08 UTC 2009


Module: openembedded.git
Branch: xora/angstrom-srcpv
Commit: 563519c6361bd09c89d05aae40b4a36c775dd4c5
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=563519c6361bd09c89d05aae40b4a36c775dd4c5

Author: Koen Kooi <koen at openembedded.org>
Date:   Mon May 18 11:43:32 2009 +0200

udev 141: add /dev cache, install binaries to the correct locations

---

 recipes/udev/udev-141/akita/default |    4 ++++
 recipes/udev/udev-141/c7x0/default  |    4 ++++
 recipes/udev/udev-141/default       |    4 ++++
 recipes/udev/udev-141/init          |   29 +++++++++++++++++++++++++----
 recipes/udev/udev-141/spitz/default |    4 ++++
 recipes/udev/udev-141/tosa/default  |    4 ++++
 recipes/udev/udev_141.bb            |   23 ++++++++++++++++++-----
 7 files changed, 63 insertions(+), 9 deletions(-)

diff --git a/recipes/udev/udev-141/akita/default b/recipes/udev/udev-141/akita/default
new file mode 100644
index 0000000..d0050b8
--- /dev/null
+++ b/recipes/udev/udev-141/akita/default
@@ -0,0 +1,4 @@
+# Default for /etc/init.d/udev
+
+# Comment this out to disable device cache
+#DEVCACHE="/etc/dev.tar"
diff --git a/recipes/udev/udev-141/c7x0/default b/recipes/udev/udev-141/c7x0/default
new file mode 100644
index 0000000..d0050b8
--- /dev/null
+++ b/recipes/udev/udev-141/c7x0/default
@@ -0,0 +1,4 @@
+# Default for /etc/init.d/udev
+
+# Comment this out to disable device cache
+#DEVCACHE="/etc/dev.tar"
diff --git a/recipes/udev/udev-141/default b/recipes/udev/udev-141/default
new file mode 100644
index 0000000..5c4937a
--- /dev/null
+++ b/recipes/udev/udev-141/default
@@ -0,0 +1,4 @@
+# Default for /etc/init.d/udev
+
+# Comment this out to disable device cache
+DEVCACHE="/etc/dev.tar"
diff --git a/recipes/udev/udev-141/init b/recipes/udev/udev-141/init
index 9e11f08..efe4470 100644
--- a/recipes/udev/udev-141/init
+++ b/recipes/udev/udev-141/init
@@ -14,6 +14,7 @@ export TZ=/etc/localtime
 [ -d /sys/class ] || exit 1
 [ -r /proc/mounts ] || exit 1
 [ -x /sbin/udevd ] || exit 1
+[ -f /etc/default/udev ] && . /etc/default/udev
 [ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
 
 kill_udevd() {
@@ -34,9 +35,18 @@ LANG=C awk "\$2 == \"/dev\" && \$4 == \"tmpfs\" { exit 1 }" /proc/mounts && {
         mkdir -m 0755 /dev/shm
 }
 
-if [ -e /etc/dev.tar ]; then
-	(cd /; tar xf /etc/dev.tar)
-	not_first_boot=1
+if [ "$DEVCACHE" != "" ]; then
+	# Invalidate udev cache if the kernel or its bootargs/cmdline have changed
+	[ -x /bin/uname ] && /bin/uname -mrspv > /tmp/uname || touch /tmp/uname
+	[ -r /proc/cmdline ] && cat /proc/cmdline > /tmp/cmdline || touch /tmp/cmdline
+	[ -r /proc/atags ] && cat /proc/atags > /tmp/atags || touch /tmp/atags
+	if [ -e $DEVCACHE ] && \
+	   cmp -s /tmp/uname /etc/udev/saved.uname && \
+	   cmp -s /tmp/cmdline /etc/udev/saved.cmdline && \
+	   cmp -s /tmp/atags /etc/udev/saved.atags; then
+		(cd /; tar xf $DEVCACHE)
+		not_first_boot=1
+	fi
 fi
 
 # make_extra_nodes
@@ -50,10 +60,21 @@ kill_udevd > "/dev/null" 2>&1
 		if [ "$not_first_boot" != "" ];then
 			/sbin/udevadm trigger --subsystem-nomatch=tty --subsystem-nomatch=mem --subsystem-nomatch=vc --subsystem-nomatch=vtconsole --subsystem-nomatch=misc --subsystem-nomatch=dcon --subsystem-nomatch=pci_bus  --subsystem-nomatch=graphics  --subsystem-nomatch=backlight --subsystem-nomatch=video4linux  --subsystem-nomatch=platform
 			(/sbin/udevadm settle --timeout=3; /sbin/udevadm control env STARTUP=)&
+			if [ "$DEVCACHE" != "" ]; then
+				rm -f /tmp/uname
+				rm -f /tmp/cmdline
+				rm -f /tmp/atags
+			fi
 		else
 			/sbin/udevadm trigger
 			/sbin/udevadm settle
-			(cd /; tar cf /etc/dev.tar dev)
+			if [ "$DEVCACHE" != "" ]; then
+				echo -n " and populating dev cache"
+				(cd /; tar cf $DEVCACHE dev)
+				mv /tmp/uname /etc/udev/saved.uname
+				mv /tmp/cmdline /etc/udev/saved.cmdline
+				mv /tmp/atags /etc/udev/saved.atags
+			fi
 		fi
 
 echo
diff --git a/recipes/udev/udev-141/spitz/default b/recipes/udev/udev-141/spitz/default
new file mode 100644
index 0000000..d0050b8
--- /dev/null
+++ b/recipes/udev/udev-141/spitz/default
@@ -0,0 +1,4 @@
+# Default for /etc/init.d/udev
+
+# Comment this out to disable device cache
+#DEVCACHE="/etc/dev.tar"
diff --git a/recipes/udev/udev-141/tosa/default b/recipes/udev/udev-141/tosa/default
new file mode 100644
index 0000000..d0050b8
--- /dev/null
+++ b/recipes/udev/udev-141/tosa/default
@@ -0,0 +1,4 @@
+# Default for /etc/init.d/udev
+
+# Comment this out to disable device cache
+#DEVCACHE="/etc/dev.tar"
diff --git a/recipes/udev/udev_141.bb b/recipes/udev/udev_141.bb
index 2368cb9..63d75dc 100644
--- a/recipes/udev/udev_141.bb
+++ b/recipes/udev/udev_141.bb
@@ -3,10 +3,10 @@ DESCRIPTION = "udev is a daemon which dynamically creates and removes device nod
 the hotplug package and requires a kernel not older than 2.6.12."
 LICENSE = "GPL"
 
-# Untested, fails to create shared libs
+# Untested
 DEFAULT_PREFERENCE = "-1"
 
-PR = "r1"
+PR = "r3"
 
 SRC_URI = "http://kernel.org/pub/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \
 	   file://mount.blacklist \
@@ -20,6 +20,7 @@ SRC_URI += " \
        file://mount.sh \
        file://network.sh \
        file://local.rules \
+       file://default \
        file://init"
 
 SRC_URI_append_h2200 = " file://50-hostap_cs.rules "
@@ -27,6 +28,13 @@ PACKAGE_ARCH_h2200 = "h2200"
 
 inherit update-rc.d autotools_stage
 
+# Put stuff in /lib and /sbin
+export sbindir="${base_sbindir}"
+export exec_prefix=""
+EXTRA_OECONF += " --with-udev-prefix= \
+                  --with-libdir-name=${base_libdir} \
+"
+
 INITSCRIPT_NAME = "udev"
 INITSCRIPT_PARAMS = "start 03 S ."
 
@@ -40,7 +48,7 @@ RPROVIDES_${PN} = "hotplug"
 FILES_${PN} += "${usrbindir}/* ${usrsbindir}/udevd"
 FILES_${PN}-dbg += "${usrbindir}/.debug ${usrsbindir}/.debug"
 
-FILES_${PN} += "${base_libdir}/udev/*"
+FILES_${PN} += "${libdir}/udev/* ${base_libdir}/udev/*"
 FILES_${PN}-dbg += "${base_libdir}/udev/.debug"
 
 do_install () {
@@ -50,6 +58,9 @@ do_install () {
 	install -d ${D}${sysconfdir}/init.d
 	install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev
 
+	install -d ${D}${sysconfdir}/default
+	install -m 0755 ${WORKDIR}/default ${D}${sysconfdir}/default/udev
+
 	install -d ${D}${sysconfdir}/udev/rules.d/
 
 	install -m 0644 ${WORKDIR}/mount.blacklist     ${D}${sysconfdir}/udev/
@@ -62,12 +73,14 @@ do_install () {
 		install -m 0644 ${WORKDIR}/devfs-udev.rules ${D}${sysconfdir}/udev/rules.d/devfs-udev.rules
 	fi
 
+	touch ${D}${sysconfdir}/udev/saved.uname
+	touch ${D}${sysconfdir}/udev/saved.cmdline
+	touch ${D}${sysconfdir}/udev/saved.atags
+
 	install -d ${D}${sysconfdir}/udev/scripts/
 
 	install -m 0755 ${WORKDIR}/mount.sh ${D}${sysconfdir}/udev/scripts/mount.sh
 	install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts
-
-	install -d ${D}${base_libdir}/udev/
 }
 
 do_install_append_h2200() {





More information about the Openembedded-commits mailing list