There is a hardware watchdog in the CPU. The kernel driver is already built by default.
To get a userspace watchdog binary:
1. Edit:
slug/openembedded/packages/busybox/busybox{busybox version}/slugos/defconfig
and set WATCHDOG=y
2. Rebuild busybox (remove appropriate files from under tmp/stamps/)
busybox will now include a /usr/sbin/watchdog binary.
3. Add:
/sbin/watchdog /dev/watchdog
to your startup scripts.
e.g.
#!/bin/sh
case "$1" in
start)
echo -n "Starting watchdog: "
start-stop-daemon -S -n watchdog -x /sbin/watchdog -- /dev/watchdog
echo "done"
;;
stop)
echo -n "Not stopping watchdog (that would be daft)."
echo -n "If that's really what you want, use \"reallystop\"."
;;
reallystop)
start-stop-daemon -K -n watchdog
echo "done"
;;
restart)
$0 reallystop
$0 start
;;
*)
echo "Usage: $0 { start | stop | reallystop | restart }" >&2
exit 1
;;
esac
exit 0
FIXME - this should really be in the repository, along with the relevant init.d script, I think.