[oe-commits] Mike Westerhof : SlugOS: initscripts - rework reboot for clean kexec

git version control git at git.openembedded.org
Sun Jan 30 15:12:54 UTC 2011


Module: openembedded.git
Branch: org.openembedded.dev
Commit: aa479cdc92fa0549b351d600bd406d4f18c193f8
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=aa479cdc92fa0549b351d600bd406d4f18c193f8

Author: Mike Westerhof <mwester at dls.net>
Date:   Sun Jan 30 09:11:23 2011 -0600

SlugOS: initscripts - rework reboot for clean kexec
(Borrowed extensively from the HIPOX reboot/kexec technique)
Signed-off-by: Mike Westerhof <mike at mwester.net>

---

 recipes/initscripts/initscripts-1.0/slugos/reboot |   17 ++++++++++-------
 recipes/initscripts/initscripts-slugos_1.0.bb     |    5 ++++-
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/recipes/initscripts/initscripts-1.0/slugos/reboot b/recipes/initscripts/initscripts-1.0/slugos/reboot
index f98b87f..ca640fe 100755
--- a/recipes/initscripts/initscripts-1.0/slugos/reboot
+++ b/recipes/initscripts/initscripts-1.0/slugos/reboot
@@ -2,15 +2,18 @@
 #
 # reboot	Execute the reboot command.
 #
-# Version:      @(#)reboot  2.75  22-Jun-1998  miquels at cistron.nl
-#
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
-echo "Rebooting... "
-if [ -x /usr/sbin/kexec ] ; then
-	echo " trying kexec..."
-	kexec -f -e -x
+# Test if we should boot into the new kernel
+if test -x /usr/sbin/kexec -a -f /sys/kernel/kexec_loaded ; then
+    read loaded < /sys/kernel/kexec_loaded
+    if test "$loaded" = "1" ; then
+        echo -n "Loaded kernel image found, executing ... "
+        /usr/sbin/kexec --exec --force --no-ifdown
+        echo "${warn}failed, doing normal reboot${norm}"
+    fi
 fi
-echo " normal reboot..."
+
+echo -n "Rebooting... "
 reboot -d -f -i
diff --git a/recipes/initscripts/initscripts-slugos_1.0.bb b/recipes/initscripts/initscripts-slugos_1.0.bb
index b048277..ce80fe5 100644
--- a/recipes/initscripts/initscripts-slugos_1.0.bb
+++ b/recipes/initscripts/initscripts-slugos_1.0.bb
@@ -17,7 +17,7 @@ RDEPENDS_${PN} = "update-rc.d"
 # All other standard definitions inherited from initscripts
 # Except the PR which is hacked here.  The format used is
 # a suffix
-PR := "${PR}.25"
+PR := "${PR}.26"
 
 # Avoid a clash on /etc/device_table by ensuring that it gets removed
 # from the list of configuration files handled specially by opkg.
@@ -174,6 +174,9 @@ do_install_append() {
 	# any network file systems which failed to umount before.
 	update-rc.d -r ${D} umountfs		start 70 0 6 .
 
+	# Remount /sys here, the reboot script needs it to check for kexec
+	update-rc.d -r ${D} sysfs.sh		start 80 6 .
+
 	update-rc.d -r ${D} halt		start 90 0 .
 	update-rc.d -r ${D} reboot		start 90 6 .
 }





More information about the Openembedded-commits mailing list