From d7d2f65e9bbcf405842855457c7edf476dbe01b6 Mon Sep 17 00:00:00 2001
From: j1nx
Date: Tue, 30 Mar 2021 13:06:29 +0200
Subject: [PATCH] Enable and configure the hardware watchdog. (reboots the
device after it hangs for 20 seconds or more)
---
.../board/raspberrypi/config.txt | 1 +
.../configs/rpi4_64-gui_defconfig | 1 -
.../rootfs-overlay/etc/systemd/system.conf | 71 +++++++++++++++++++
3 files changed, 72 insertions(+), 1 deletion(-)
create mode 100644 buildroot-external/rootfs-overlay/etc/systemd/system.conf
diff --git a/buildroot-external/board/raspberrypi/config.txt b/buildroot-external/board/raspberrypi/config.txt
index 3c08832f..3c72b5f7 100644
--- a/buildroot-external/board/raspberrypi/config.txt
+++ b/buildroot-external/board/raspberrypi/config.txt
@@ -43,6 +43,7 @@ dtparam=i2c_arm=on
dtoverlay=i2s-mmap
dtparam=i2s=on
dtparam=spi=on
+dtparam=watchdog=on
# Disable GPIO IRQ
# dtoverlay=gpio-no-irq
diff --git a/buildroot-external/configs/rpi4_64-gui_defconfig b/buildroot-external/configs/rpi4_64-gui_defconfig
index d0b87dad..96f169d8 100644
--- a/buildroot-external/configs/rpi4_64-gui_defconfig
+++ b/buildroot-external/configs/rpi4_64-gui_defconfig
@@ -46,7 +46,6 @@ BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL)/busybox.config"
BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES=y
-BR2_PACKAGE_BUSYBOX_WATCHDOG=y
BR2_PACKAGE_ALSA_UTILS=y
BR2_PACKAGE_ALSA_UTILS_ALSACONF=y
BR2_PACKAGE_ALSA_UTILS_ACONNECT=y
diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system.conf b/buildroot-external/rootfs-overlay/etc/systemd/system.conf
new file mode 100644
index 00000000..270c8d13
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/etc/systemd/system.conf
@@ -0,0 +1,71 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# Entries in this file show the compile time defaults.
+# You can change settings by editing this file.
+# Defaults can be restored by simply deleting this file.
+#
+# See systemd-system.conf(5) for details.
+
+[Manager]
+#LogLevel=info
+#LogTarget=journal-or-kmsg
+#LogColor=yes
+#LogLocation=no
+#LogTime=no
+#DumpCore=yes
+#ShowStatus=yes
+#CrashChangeVT=no
+#CrashShell=no
+#CrashReboot=no
+#CtrlAltDelBurstAction=reboot-force
+#CPUAffinity=1 2
+#NUMAPolicy=default
+#NUMAMask=
+RuntimeWatchdogSec=20s
+RebootWatchdogSec=10min
+#ShutdownWatchdogSec=10min
+#KExecWatchdogSec=0
+#WatchdogDevice=
+#CapabilityBoundingSet=
+#NoNewPrivileges=no
+#SystemCallArchitectures=
+#TimerSlackNSec=
+#StatusUnitFormat=description
+#DefaultTimerAccuracySec=1min
+#DefaultStandardOutput=journal
+#DefaultStandardError=inherit
+#DefaultTimeoutStartSec=90s
+#DefaultTimeoutStopSec=90s
+#DefaultTimeoutAbortSec=
+#DefaultRestartSec=100ms
+#DefaultStartLimitIntervalSec=10s
+#DefaultStartLimitBurst=5
+#DefaultEnvironment=
+#DefaultCPUAccounting=no
+#DefaultIOAccounting=no
+#DefaultIPAccounting=no
+#DefaultBlockIOAccounting=no
+#DefaultMemoryAccounting=yes
+#DefaultTasksAccounting=yes
+#DefaultTasksMax=15%
+#DefaultLimitCPU=
+#DefaultLimitFSIZE=
+#DefaultLimitDATA=
+#DefaultLimitSTACK=
+#DefaultLimitCORE=
+#DefaultLimitRSS=
+#DefaultLimitNOFILE=1024:524288
+#DefaultLimitAS=
+#DefaultLimitNPROC=
+#DefaultLimitMEMLOCK=
+#DefaultLimitLOCKS=
+#DefaultLimitSIGPENDING=
+#DefaultLimitMSGQUEUE=
+#DefaultLimitNICE=
+#DefaultLimitRTPRIO=
+#DefaultLimitRTTIME=