env: mmc: print MMC device being read
PATCH 1/1 env: mmc: print MMC device being read
From: Quentin Schulz <[email protected]>
This prints the MMC device being read similar to how we print the MMC device we write to when e.g. calling saveenv.
One of the side effects is that the boot log now shows from which MMC device the env was loaded:
Loading Environment from MMC... Reading from MMC(1)... OK
This is useful to identify which MMC device the environment was loaded from for boards where there are more than one (e.g. eMMC and SD card) without adding some debug messages manually.
Sadly, there's no way to know which of the default or redundant environment is being read from env_mmc_load before env_import_redund is called so it is printing a bit later (and possibly after error/warning messages).
--- env/mmc.c | 3 +++ 1 file changed, 3 insertions(+)
env/mmc.c +3 -0
@@ -436,6 +436,7 @@ static int env_mmc_load(void) ret =env_import_redund ((char *)tmp_env1, read1_fail, (char *)tmp_env2, read2_fail,H_EXTERNAL ); +printf ("Reading from %sMMC(%d)... " , gd->env_valid ==ENV_REDUND ?"redundant " :"" , dev); fini:fini_mmc_for_env (mmc);
@@ -475,6 +476,8 @@ static int env_mmc_load(void) goto fini; } +printf ("Reading from MMC(%d)... " , dev); + ret =env_import (buf,1 ,H_EXTERNAL );if (!ret) { ep = (env_t *)buf;
---
base-commit: b03b49046af5dfca599d2ce8f0aafed89b97aa91
change-id: 20240415-mmc-loadenv-dev-ced678171e98
Best regards,
Signature · 1 line
Quentin Schulz <[email protected]>
Quoted 14 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
This prints the MMC device being read similar to how we print the MMC device we write to when e.g. calling saveenv.
One of the side effects is that the boot log now shows from which MMC device the env was loaded:
Loading Environment from MMC... Reading from MMC(1)... OK
This is useful to identify which MMC device the environment was loaded from for boards where there are more than one (e.g. eMMC and SD card) without adding some debug messages manually.
Quoted 7 lines
Sadly, there's no way to know which of the default or redundant environment is being read from
env_mmc_loadbeforeenv_import_redundis called so it is printing a bit later (and possibly after error/warning messages).Cc Quentin Schulz <[email protected]>Signed-off-by Quentin Schulz <[email protected]>
Signature · 1 line
Tom
Quoted 14 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
This prints the MMC device being read similar to how we print the MMC device we write to when e.g. calling saveenv.
One of the side effects is that the boot log now shows from which MMC device the env was loaded:
Loading Environment from MMC... Reading from MMC(1)... OK
This is useful to identify which MMC device the environment was loaded from for boards where there are more than one (e.g. eMMC and SD card) without adding some debug messages manually.
Quoted 7 lines
Sadly, there's no way to know which of the default or redundant environment is being read from
env_mmc_loadbeforeenv_import_redundis called so it is printing a bit later (and possibly after error/warning messages).Cc Quentin Schulz <[email protected]>Signed-off-by Quentin Schulz <[email protected]>
Looking great to me.
Quoted 33 lines
--- env/mmc.c | 3 +++ 1 file changed, 3 insertions(+)env/mmc.c +1
-0@@ -436,6 +436,7 @@ static int env_mmc_load(void) ret =env_import_redund ((char *)tmp_env1, read1_fail, (char *)tmp_env2, read2_fail,H_EXTERNAL ); +printf ("Reading from %sMMC(%d)... " , gd->env_valid ==ENV_REDUND ?"redundant " :"" , dev);fini:
env/mmc.c +2
-1fini_mmc_for_env (mmc);@@ -475,6 +476,8 @@ static int env_mmc_load(void) goto fini; } +printf ("Reading from MMC(%d)... " , dev); + ret =env_import (buf,1 ,H_EXTERNAL );if (!ret) { ep = (env_t *)buf; ---base-commit:
b03b49046af5dfca599d2ce8f0aafed89b97aa91
change-id: 20240415-mmc-loadenv-dev-ced678171e98Best regards,
Quoted 9 lines · Quentin Schulz
This prints the MMC device being read similar to how we print the MMC device we write to when e.g. calling saveenv.
One of the side effects is that the boot log now shows from which MMC device the env was loaded:
Loading Environment from MMC... Reading from MMC(1)... OK
[...]
Applied to u-boot/master, thanks!
Signature · 1 line
Tom