Skip to content

Instantly share code, notes, and snippets.

@bonzini
Last active January 2, 2022 16:12
Show Gist options
  • Save bonzini/64a45b4404431747d10519302babcd27 to your computer and use it in GitHub Desktop.
Save bonzini/64a45b4404431747d10519302babcd27 to your computer and use it in GitHub Desktop.
Protecting the initrd with a watchdog
#!/bin/sh
# /etc/initramfs-tools/hooks/sunxi_wdt
set -e
PREREQS=""
prereqs() { echo "$PREREQS"; }
case $1 in
prereqs)
prereqs
exit 0
;;
esac
. /usr/share/initramfs-tools/hook-functions
manual_add_modules sunxi_wdt
exit 0
#! /bin/sh
# /etc/initramfs-tools/scripts/init-premount/sunxi_wdt
if test -e /dev/watchdog; then
echo "$(date) /dev/watchdog starting"
echo 1 > /dev/watchdog
fi
#! /bin/sh
# /etc/initramfs-tools/scripts/local-premount/sunxi_wdt
if test -e /dev/watchdog; then
echo "$(date) /dev/watchdog stopping"
echo V > /dev/watchdog
echo "$(date) /dev/watchdog stopped"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment