summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Koch <akoch@initse.com>2026-06-12 00:48:34 +0200
committerTom Rini <trini@konsulko.com>2026-06-29 15:29:44 -0600
commita51f24ac31fbb910afc66824e8299a417b297536 (patch)
tree41e2abb0ae88d5b3ef140a5c92f926105239b1e7
parent1537ec5ceb7d80edaefb55743bb44e17f303285b (diff)
downloadu-boot-a51f24ac31fbb910afc66824e8299a417b297536.tar.gz
u-boot-a51f24ac31fbb910afc66824e8299a417b297536.zip
env: Avoid mixing of environment and driver prints on env load
The current environment loading code prints a partial string "Loading Environment from %s..." and then triggers env driver loading function. That env driver loading function may trigger further prints, either from the env driver itself or from any other driver that gets probed at that time. The result is a print which mixed environment loading code prints and driver code prints, as follows: " Environment code print _________________________ vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vv Loading Environment from SPIFlash... SF: Detected w25q128jw... OK ^^^^^^^^^^^^^^^^^^^^^^ Driver code print " Adjust the environment loading code print such, that it places CR at the end of the line. This way, when the driver code prints something, it overwrites the previous "Loading Environment from %s" output and the result is not mixed. Furthermore, in case the env was loaded correctly, print the "Loading Environment from %s ... OK" in full again. This either overwrites the "Loading Environment from" message and appends the print with "OK", or, it prints the line in full after all the driver code prints. This is not ideal, but it is the best we can do with only CR and without ANSI control sequences. The result looks as follows: " SF: Detected w25q128jw with page size 256 Bytes, erase size 4 KiB, total 16 MiB Loading Environment from SPIFlash... OK " Signed-off-by: Alexander Koch <akoch@initse.com> Signed-off-by: Marek Vasut <marex@nabladev.com>
-rw-r--r--env/env.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/env/env.c b/env/env.c
index 7a9c96b4078..404e8b7a26c 100644
--- a/env/env.c
+++ b/env/env.c
@@ -189,7 +189,7 @@ int env_load(void)
if (!env_has_inited(drv->location))
continue;
- printf("Loading Environment from %s... ", drv->name);
+ printf("Loading Environment from %s...\r", drv->name);
/*
* In error case, the error message must be printed during
* drv->load() in some underlying API, and it must be exactly
@@ -197,7 +197,7 @@ int env_load(void)
*/
ret = drv->load();
if (!ret) {
- printf("OK\n");
+ printf("Loading Environment from %s... OK\n", drv->name);
gd->env_load_prio = prio;
return 0;
@@ -206,7 +206,7 @@ int env_load(void)
if (best_prio == -1)
best_prio = prio;
} else {
- debug("Failed (%d)\n", ret);
+ debug("Loading Environment from %s... Failed (%d)\n", drv->name, ret);
}
}