From: igeiser@devonit.com
To: openembedded-core@lists.openembedded.org
Subject: [PATCH ] add shutdown hook for udev
Date: Sun, 3 Feb 2013 14:17:02 -0500 [thread overview]
Message-ID: <1359919022-13375-1-git-send-email-igeiser@devonit.com> (raw)
From: Ian Reinhart Geiser <igeiser@devonit.com>
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@devonit.com>
---
.../initrdscripts/initramfs-framework/udev | 12 ++++++++++--
1 file 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
}
--
1.7.9.5
next reply other threads:[~2013-02-03 19:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-03 19:17 igeiser [this message]
2013-02-04 12:47 ` [PATCH ] add shutdown hook for udev Richard Purdie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1359919022-13375-1-git-send-email-igeiser@devonit.com \
--to=igeiser@devonit.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.