Skip to contentSkip to conversation

sandbox: use env_get() for time offset instead of getenv()

PATCH In review Osama Abdelkader 2 participants 2 messages Sep 14, 2025 – Sep 24, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sandbox: use env_get() for time offset instead of getenv()

The sandbox time offset is intended to be controlled via the U-Boot environment, not the host process environment. Update os_get_time_offset() to use env_get() instead of the libc getenv().

Leave other getenv() uses (e.g. U_BOOT_PERSISTENT_DATA_DIR, UBOOT_SB_FUZZ_TEST) unchanged, since those refer to host environment variables needed by sandbox tests.

---
 arch/sandbox/cpu/os.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/sandbox/cpu/os.c +2 -1
index f5c9a8aecf2..e48eb23cdc0 100644
@@ -35,6 +35,7 @@
 #include <asm/state.h>
 #include <os.h>
 #include <rtc_def.h>
+#include <env.h>
 
 /* Environment variable for time offset */
 #define ENV_TIME_OFFSET "UBOOT_SB_TIME_OFFSET"
@@ -1014,7 +1015,7 @@ long os_get_time_offset(void)
 {
 	const char *offset;
 
-	offset = getenv(ENV_TIME_OFFSET);
+	offset = env_get(ENV_TIME_OFFSET);
 	if (offset)
 		return strtol(offset, NULL, 0);
 	return 0;
Signature · 1 line
2.43.0
#1 lore raw
Quoted 9 lines · Osama Abdelkader

The sandbox time offset is intended to be controlled via the U-Boot environment, not the host process environment. Update os_get_time_offset() to use env_get() instead of the libc getenv().

Leave other getenv() uses (e.g. U_BOOT_PERSISTENT_DATA_DIR, UBOOT_SB_FUZZ_TEST) unchanged, since those refer to host environment variables needed by sandbox tests.

[...]

Applied to u-boot/next, thanks!

[1/1] sandbox: use env_get() for time offset instead of getenv()

      commit: 8558aaa3cf9065ab5ec9a0b241ce567e7393dbc3
Signature · 1 line
Tom