summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRasmus Villemoes <[email protected]>2026-07-25 00:07:04 +0200
committerTom Rini <[email protected]>2026-08-10 14:47:50 -0600
commit4cb0bd4702a623d69648496a352744e81bfaa95f (patch)
treec25cce1a2126f79643ca80542c7f6b1b72dc8992 /include
parent0ed1a87ad81f706c341f41af918219cf8619b6e0 (diff)
bootretry: only reinitialize retry_time when bootretry env variable has been touched
Commit aa5ef3c0a752 ("bootretry: check for bootretry variable changes") broke the feature where one can define different keys for "delaying" versus "stopping" boot. The way the latter is implemented is by the code in autoboot.c calling bootretry_dont_retry() when the stop sequence has been detected, and that simply sets the retry_time variable in bootretry.c to -1. However, with the mentioned commit, that is unconditionally overridden on every command, since it gets re-initialized from either the bootretry environment variable or CONFIG_BOOT_RETRY_TIME, thus making "delay" and "stop" effectively the same. To fix that, while still picking up changes to the bootretry environment variable, use the proper mechanism for C code to be notified about changes to environment variables. Since the callback is invoked before the change has actually been done to the environment (callbacks can reject the change from taking effect), we cannot simply call the existing bootretry_init_cmd_timeout() from the callback, as its env_get() would not see the new value. Instead, refactor most of it to an internal bootretry_parse(), and call that with the new value (which is NULL in the case bootretry is being deleted, so that works exactly as it should). Signed-off-by: Rasmus Villemoes <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/env_callback.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/env_callback.h b/include/env_callback.h
index 1181ab4a157..572cacde03e 100644
--- a/include/env_callback.h
+++ b/include/env_callback.h
@@ -70,6 +70,12 @@
#define DFU_CALLBACK
#endif
+#ifdef CONFIG_BOOT_RETRY
+#define BOOTRETRY_CALLBACK "bootretry:bootretry,"
+#else
+#define BOOTRETRY_CALLBACK
+#endif
+
/*
* This list of callback bindings is static, but may be overridden by defining
* a new association in the ".callbacks" environment variable.
@@ -81,6 +87,7 @@
NET6_CALLBACKS \
BOOTSTD_CALLBACK \
DFU_CALLBACK \
+ BOOTRETRY_CALLBACK \
"loadaddr:loadaddr," \
SILENT_CALLBACK \
"stdin:console,stdout:console,stderr:console," \