sonic-buildimage/files/image_config/watchdog-control/watchdog-control.sh
Sujin Kang ff6cb6c402 Add disabling HW watchdog during boot for fast-reboot and warm-reboot (#4927)
* Add disabling HW watchdog during boot for fast-reboot and warm-reboot case

* typo
2020-08-09 11:25:31 -07:00

45 lines
831 B
Bash
Executable File

#! /bin/bash
VERBOSE=no
WATCHDOG_UTIL="/usr/bin/watchdogutil"
function debug()
{
/usr/bin/logger "$0 : $1"
if [[ x"${VERBOSE}" == x"yes" ]]; then
echo "$(date) $0: $1"
fi
}
function getBootType()
{
# same code snippet in files/scripts/syncd.sh
case "$(cat /proc/cmdline)" in
*SONIC_BOOT_TYPE=warm*)
TYPE='warm'
;;
*SONIC_BOOT_TYPE=fastfast*)
TYPE='fastfast'
;;
*SONIC_BOOT_TYPE=fast*|*fast-reboot*)
TYPE='fast'
;;
*)
TYPE='cold'
esac
echo "${TYPE}"
}
function disable_watchdog()
{
# Obtain boot type from kernel arguments
BOOT_TYPE=`getBootType`
if [[ -x ${WATCHDOG_UTIL} ]]; then
debug "Disabling Watchdog during bootup after $BOOT_TYPE"
${WATCHDOG_UTIL} disarm
fi
}
disable_watchdog