summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilton Miller <miltonm@us.ibm.com>2017-07-20 22:05:26 +0300
committerPatrick Williams <patrick@stwcx.xyz>2017-08-28 19:59:24 +0300
commit589ebdf3abb10ee55a0acb7364d9a0d8d434dbc5 (patch)
tree33bbcc6ab99cf3802ec89275a95e23f3db81d56f
parentaedc8fed04d909f32a7ebe4f1ad92dc54b79bbf4 (diff)
downloadopenbmc-589ebdf3abb10ee55a0acb7364d9a0d8d434dbc5.tar.xz
obmc-initfs shutdown: ping watchdog watchdog during flash update
Add code to start a watchdog daemon before calling the update script as erasing the flash can take over 10 minutes. This allows us to reduce the shutdown timeout to a much more useful value. The code kills the watchdog after the update script returns and also resets the timeout to a different value by invoking and killing the watchdog command a second time. Tested with the following code added before the reboot -f code and changing the timoeuts: while : do let count=$count+1 echo -ne "\rloop $count" usleep 100 done Change-Id: Ibe2337339af67421733230b6a5b6df962618a00a Signed-off-by: Milton Miller <miltonm@us.ibm.com>
-rw-r--r--meta-phosphor/common/recipes-phosphor/initfs/files/obmc-shutdown.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/meta-phosphor/common/recipes-phosphor/initfs/files/obmc-shutdown.sh b/meta-phosphor/common/recipes-phosphor/initfs/files/obmc-shutdown.sh
index 90e5dfbeb..c91f5efac 100644
--- a/meta-phosphor/common/recipes-phosphor/initfs/files/obmc-shutdown.sh
+++ b/meta-phosphor/common/recipes-phosphor/initfs/files/obmc-shutdown.sh
@@ -33,10 +33,21 @@ set +x
update=/run/initramfs/update
image=/run/initramfs/image-
+wdt="-t 1 -T 5"
+wdrst="-T 15"
+
if ls $image* > /dev/null 2>&1
then
if test -x $update
then
+ if test -c /dev/watchdog
+ then
+ echo Pinging watchdog ${wdt+with args $wdt}
+ watchdog $wdt -F /dev/watchdog &
+ wd=$!
+ else
+ wd=
+ fi
$update --clean-saved-files
remaining=$(ls $image*)
if test -n "$remaining"
@@ -46,6 +57,20 @@ then
else
echo "Flash update completed."
fi
+
+ if test -n "$wd"
+ then
+ kill -9 $wd
+ if test -n "$wdrst"
+ then
+ echo Reseting watchdog timeouts to $wdrst
+ watchdog $wdrst -F /dev/watchdog &
+ sleep 1
+ # Kill the watchdog daemon, setting a timeout
+ # for the remaining shutdown work
+ kill -9 $!
+ fi
+ fi
else
echo 1>&2 "Flash update requested but $update program missing!"
fi