[oe-commits] Ian Reinhart Geiser : initramds-framework: add shutdown hook for udev

git at git.openembedded.org git at git.openembedded.org
Mon Feb 4 13:19:37 UTC 2013


Module: openembedded-core.git
Branch: master-next
Commit: ce690659ef797bd26dc2be59167aa01744841510
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=ce690659ef797bd26dc2be59167aa01744841510

Author: Ian Reinhart Geiser <igeiser at devonit.com>
Date:   Sun Feb  3 14:17:02 2013 -0500

initramds-framework: add shutdown hook for udev

In cases where other initramfs modules need to rely on
udev running (ie in my case I have to load firmware on
a device that is slow to start) there needs to be a way
to keep it running during the lifecycle of the initramfs
but still be shut down before swith_root is called.  I
added a  module_pre_hook that will shut down udev before
the finish module is called.

Signed-off-by: Ian Reinhart Geiser <igeiser at devonit.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 .../initrdscripts/initramfs-framework/udev         |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/udev b/meta/recipes-core/initrdscripts/initramfs-framework/udev
index 7fbcc61..50c9349 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework/udev
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/udev
@@ -2,6 +2,14 @@
 # Copyright (C) 2011, 2012 O.S. Systems Software LTDA.
 # Licensed on MIT
 
+udev_shutdown_hook_handler() {
+	status=$1
+	module=$2
+	if [ "$status" = "pre" ] && [ "$module" = "finish" ]; then
+		killall `basename $_UDEV_DAEMON` 2>/dev/null
+	fi
+}
+
 udev_daemon() {
 	OPTIONS="/sbin/udevd /lib/udev/udevd /lib/systemd/systemd-udevd"
 
@@ -27,11 +35,11 @@ udev_enabled() {
 }
 
 udev_run() {
+	add_module_pre_hook "udev_shutdown_hook_handler"
+
 	mkdir -p /run
 
 	$_UDEV_DAEMON --daemon
 	udevadm trigger --action=add
 	udevadm settle
-
-	killall `basename $_UDEV_DAEMON` 2>/dev/null
 }





More information about the Openembedded-commits mailing list