[PATCH] fsl-layerscape/soc.c: do not destroy bootcmd environment
Mike Looijmans
mike.looijmans at topic.nl
Tue Jan 30 15:26:56 CET 2024
When an XXX_BOOTCOMMAND isn't defined, the result is that bootcmd is set
to some random memory content. Fix it so that the function does nothing
in that case and leaves the bootcmd environment unmodified.
Signed-off-by: Mike Looijmans <mike.looijmans at topic.nl>
---
arch/arm/cpu/armv8/fsl-layerscape/soc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
index 3bfdc3f774..4c61d28c20 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
@@ -811,6 +811,8 @@ __weak int fsl_setenv_bootcmd(void)
enum boot_src src = get_boot_src();
char bootcmd_str[MAX_BOOTCMD_SIZE];
+ bootcmd_str[0] = 0;
+
switch (src) {
#ifdef IFC_NOR_BOOTCOMMAND
case BOOT_SOURCE_IFC_NOR:
@@ -859,6 +861,9 @@ __weak int fsl_setenv_bootcmd(void)
break;
}
+ if (!bootcmd_str[0])
+ return 0;
+
ret = env_set("bootcmd", bootcmd_str);
if (ret) {
printf("Failed to set bootcmd: ret = %d\n", ret);
--
2.34.1
Met vriendelijke groet / kind regards,
Mike Looijmans
System Expert
TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands
T: +31 (0) 499 33 69 69
E: mike.looijmans at topic.nl
W: www.topic.nl
Please consider the environment before printing this e-mail
More information about the U-Boot
mailing list