]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
systemd: Add WATCHDOG_RUNTIME_SEC optional variable
authorBenjamin Szőke <egyszeregy@freemail.hu>
Thu, 19 Dec 2024 11:16:15 +0000 (12:16 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 8 Jan 2025 13:03:18 +0000 (13:03 +0000)
To make use of the hardware watchdog it is sufficient to set
the RuntimeWatchdogSec= option in /etc/systemd/system.conf.
It defaults to 0 (i.e. no hardware watchdog use). Set it to
a value like 20s and the watchdog is enabled.

ref: https://0pointer.de/blog/projects/watchdog.html
Signed-off-by: Benjamin Szőke <egyszeregy@freemail.hu>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/systemd/systemd_257.1.bb

index 9f9c83a7c3ade60580252cd86f222178b6b56074..8330157fb653266a95cdb614fac632c8f0b86fff 100644 (file)
@@ -265,6 +265,11 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
 # The 60 seconds is watchdog's default vaule.
 WATCHDOG_TIMEOUT ??= "60"
 
+# To make use of the hardware watchdog it is sufficient to set WATCHDOG_RUNTIME_SEC
+# (RuntimeWatchdogSec= option in /etc/systemd/system.conf) to a value like 20s
+# and the watchdog is enabled. (defaults is no hardware watchdog use)
+WATCHDOG_RUNTIME_SEC ??= ""
+
 do_install() {
        meson_do_install
 
@@ -382,6 +387,11 @@ do_install() {
                        ${D}/${sysconfdir}/systemd/system.conf
        fi
 
+       if [ -n "${WATCHDOG_RUNTIME_SEC}" ]; then
+               sed -i -e 's/#RuntimeWatchdogSec=off/RuntimeWatchdogSec=${WATCHDOG_RUNTIME_SEC}/' \
+                       ${D}/${sysconfdir}/systemd/system.conf
+       fi
+
        if ${@bb.utils.contains('PACKAGECONFIG', 'pni-names', 'true', 'false', d)}; then
                if ! grep -q '^NamePolicy=.*mac' ${D}${nonarch_libdir}/systemd/network/99-default.link; then
                        sed -i '/^NamePolicy=/s/$/ mac/' ${D}${nonarch_libdir}/systemd/network/99-default.link