CIP-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: cip-dev <cip-dev@lists.cip-project.org>,
	Quirin Gylstorff <quirin.gylstorff@siemens.com>
Subject: [isar-cip-core][PATCH v3] crypt-hook: Check if WATCHDOG_DEV is set and available
Date: Wed, 29 Apr 2026 00:20:01 +0200	[thread overview]
Message-ID: <3e88bc83-3502-4e8a-9bcb-5bb157485acb@siemens.com> (raw)

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This allows the user to disable the watchdog by emptying the variable
`INITRAMFS_WATCHDOG_DEVICE`.

Also add  a panic if the watchdog device is configured
and not available.

Reported-by: Stefan Koch <stefan.koch@siemens.com>
Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
[Jan: fix up device test, link INITRAMFS_WATCHDOG_DEVICE to WDOG_TIMEOUT]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Posting as the second change, conditional INITRAMFS_WATCHDOG_DEVICE 
default, deserves review.

 .../files/local-top-complete                    | 17 ++++++++++++-----
 ...ook_0.10.bb => initramfs-crypt-hook_0.11.bb} |  4 ++--
 2 files changed, 14 insertions(+), 7 deletions(-)
 rename recipes-initramfs/initramfs-crypt-hook/{initramfs-crypt-hook_0.10.bb => initramfs-crypt-hook_0.11.bb} (97%)

diff --git a/recipes-initramfs/initramfs-crypt-hook/files/local-top-complete b/recipes-initramfs/initramfs-crypt-hook/files/local-top-complete
index 4f3eafc6..b0335975 100644
--- a/recipes-initramfs/initramfs-crypt-hook/files/local-top-complete
+++ b/recipes-initramfs/initramfs-crypt-hook/files/local-top-complete
@@ -2,7 +2,7 @@
 #
 # CIP Core, generic profile
 #
-# Copyright (c) Siemens AG, 2023-2025
+# Copyright (c) Siemens AG, 2023-2026
 #
 # Authors:
 #  Quirin Gylstorff <quirin.gylstorff@siemens.com>
@@ -64,10 +64,17 @@ if [ -z "${create_file_system_cmd}" ]; then
 fi
 
 service_watchdog() {
-	for n in $(seq $(($SETUP_TIMEOUT / 10)) ); do
-		printf '\0'
-		sleep 10
-	done > "$WATCHDOG_DEV"
+	if [ -n "$WATCHDOG_DEV" ]; then
+		if [ ! -e "$WATCHDOG_DEV" ]; then
+			panic "Could not find '$WATCHDOG_DEV' - Please check your kernel configuration."
+		fi
+		for n in $(seq $(($SETUP_TIMEOUT / 10)) ); do
+			printf '\0'
+			sleep 10
+		done > "$WATCHDOG_DEV"
+	else
+		echo "Watchdog is disabled."
+	fi
 }
 
 check_partitions()
diff --git a/recipes-initramfs/initramfs-crypt-hook/initramfs-crypt-hook_0.10.bb b/recipes-initramfs/initramfs-crypt-hook/initramfs-crypt-hook_0.11.bb
similarity index 97%
rename from recipes-initramfs/initramfs-crypt-hook/initramfs-crypt-hook_0.10.bb
rename to recipes-initramfs/initramfs-crypt-hook/initramfs-crypt-hook_0.11.bb
index c0572f2f..3cb05201 100644
--- a/recipes-initramfs/initramfs-crypt-hook/initramfs-crypt-hook_0.10.bb
+++ b/recipes-initramfs/initramfs-crypt-hook/initramfs-crypt-hook_0.11.bb
@@ -1,7 +1,7 @@
 #
 # CIP Core, generic profile
 #
-# Copyright (c) Siemens AG, 2020-2025
+# Copyright (c) Siemens AG, 2020-2026
 #
 # Authors:
 #  Quirin Gylstorff <quirin.gylstorff@siemens.com>
@@ -88,7 +88,7 @@ CRYPT_CREATE_FILE_SYSTEM_CMD ??= "/usr/sbin/mke2fs -t ext4"
 # Timeout for creating / re-encrypting partitions on first boot
 CRYPT_SETUP_TIMEOUT ??= "600"
 # Watchdog to service during the initial setup of the crypto partitions
-INITRAMFS_WATCHDOG_DEVICE ??= "/dev/watchdog"
+INITRAMFS_WATCHDOG_DEVICE ??= "${@'/dev/watchdog' if int(d.getVar('WDOG_TIMEOUT') or 0) > 0 else ''}"
 # clevis needs tpm hash algorithm type
 CRYPT_HASH_TYPE ??= "sha256"
 CRYPT_KEY_ALGORITHM ??= "ecc"
-- 
2.47.3


                 reply	other threads:[~2026-04-28 22:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3e88bc83-3502-4e8a-9bcb-5bb157485acb@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=cip-dev@lists.cip-project.org \
    --cc=quirin.gylstorff@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox