[U-Boot] [PATCH 53/53] armv8: skip setenv if gd->env_addr is not default env.

Rajesh Bhagat rajesh.bhagat at nxp.com
Wed Oct 3 11:37:36 UTC 2018


From: Pankit Garg <pankit.garg at nxp.com>

Set mc and bootcmd env variables only when gd->env_addr is
default environment.

Signed-off-by: Rajesh Bhagat <rajesh.bhagat at nxp.com>
Signed-off-by: Pankit Garg <pankit.garg at nxp.com>
---
 arch/arm/cpu/armv8/fsl-layerscape/soc.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
index cbf0f20332..b3063fa9a6 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
@@ -24,6 +24,11 @@
 #include <fsl_validate.h>
 #endif
 #include <fsl_immap.h>
+#ifdef CONFIG_TFABOOT
+#include <environment.h>
+DECLARE_GLOBAL_DATA_PTR;
+#endif
+
 
 bool soc_has_dp_ddr(void)
 {
@@ -800,8 +805,14 @@ int board_late_init(void)
 	fsl_setenv_chain_of_trust();
 #endif
 #ifdef CONFIG_TFABOOT
-	fsl_setenv_bootcmd();
-	fsl_setenv_mcinitcmd();
+	/*
+	 * check if gd->env_addr is default_environment; then setenv bootcmd
+	 * and mcinitcmd
+	 */
+	if (gd->env_addr + gd->reloc_off == (ulong)&default_environment[0]) {
+		fsl_setenv_bootcmd();
+		fsl_setenv_mcinitcmd();
+	}
 #endif
 #ifdef CONFIG_QSPI_AHB_INIT
 	qspi_ahb_init();
-- 
2.17.1



More information about the U-Boot mailing list