From 7f9b94a8a29bb3c173e90c0f702d7b752085b5a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Sz=C5=91ke?= Date: Thu, 19 Dec 2024 12:16:15 +0100 Subject: [PATCH] systemd: Add WATCHDOG_RUNTIME_SEC optional variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (From OE-Core rev: 1c61a1eb9c4faa9ab32b0440bbdd88c22c3cd945) Signed-off-by: Benjamin Szőke Signed-off-by: Richard Purdie --- meta/recipes-core/systemd/systemd_257.1.bb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/meta/recipes-core/systemd/systemd_257.1.bb b/meta/recipes-core/systemd/systemd_257.1.bb index 9f9c83a7c3..8330157fb6 100644 --- a/meta/recipes-core/systemd/systemd_257.1.bb +++ b/meta/recipes-core/systemd/systemd_257.1.bb @@ -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