summaryrefslogtreecommitdiff
path: root/package/kernel/om-watchdog
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2016-03-03 20:24:33 +0000
committerJohn Crispin <john@openwrt.org>2016-03-03 20:24:33 +0000
commitab196b75ea5e556848a84556d9ce54f57a4308e2 (patch)
treeb6f4a01119dde2f7537d9757ec60d48472c88380 /package/kernel/om-watchdog
parent678dcef7a5f75303ea801bc23be854fd7bb619c0 (diff)
downloadmtk-20170518-ab196b75ea5e556848a84556d9ce54f57a4308e2.zip
mtk-20170518-ab196b75ea5e556848a84556d9ce54f57a4308e2.tar.gz
mtk-20170518-ab196b75ea5e556848a84556d9ce54f57a4308e2.tar.bz2
om-watchdog: Stop om-watchdog via procd before rebooting
It was noticed that the system can hang during the reboot before the kernel actually triggers the system reset and before all processes are stopped. The watchdog didn't automatically restart the system because the om-watchdog process was still running and triggering the hardware watchdog. Instead the system should stop the watchdog during the shutdown to get the benefit of an hardware reset in case of an software related problem. This stop can be done quite easily with procd because it keeps track of its started processes. Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com> SVN-Revision: 48889
Diffstat (limited to 'package/kernel/om-watchdog')
-rw-r--r--package/kernel/om-watchdog/files/om-watchdog.init32
1 files changed, 24 insertions, 8 deletions
diff --git a/package/kernel/om-watchdog/files/om-watchdog.init b/package/kernel/om-watchdog/files/om-watchdog.init
index c792968..47105f2 100644
--- a/package/kernel/om-watchdog/files/om-watchdog.init
+++ b/package/kernel/om-watchdog/files/om-watchdog.init
@@ -4,33 +4,49 @@
#
START=11
+STOP=11
-SERVICE_DAEMONIZE=1
+USE_PROCD=1
+NAME=om-watchdog
+PROG=/sbin/om-watchdog
-boot() {
+get_gpio() {
if [ -r /lib/ar71xx.sh ]; then
. /lib/ar71xx.sh
local board=$(ar71xx_board_name)
case "$board" in
"om2p"|"om2p-hs"|"om2p-hsv2")
- service_start /sbin/om-watchdog 12
+ return 12
;;
"om2pv2"|"om2p-lc")
- service_start /sbin/om-watchdog 26
+ return 26
;;
"om5p"|"om5p-an")
- service_start /sbin/om-watchdog 11
+ return 11
;;
"mr600v2")
- service_start /sbin/om-watchdog 15
+ return 15
;;
"mr900"|"mr900v2"|"mr1750")
- service_start /sbin/om-watchdog 16
+ return 16
;;
esac
else
#we assume it is om1p in this case
- service_start /sbin/om-watchdog 3
+ return 3
fi
+
+ return 255
+}
+
+start_service() {
+ get_gpio
+ gpio="$?"
+ [ "$gpio" != "255" ] || return
+
+ procd_open_instance
+ procd_set_param command "${PROG}" "${gpio}"
+ procd_set_param respawn
+ procd_close_instance
}