[PATCH uboot v2016.05-aspeed-openbmc 8/9] aspeed/ast-g4: add a force saveenv config

Cédric Le Goater clg at kaod.org
Thu Jun 30 02:09:50 AEST 2016


That was a feature in the previous Aspeed branch which is was left out
in the v2016.05 port. So let's use the new aspeed Kconfig to add it.

Signed-off-by: Cédric Le Goater <clg at kaod.org>
---
 arch/arm/Kconfig     | 1 +
 board/aspeed/Kconfig | 6 ++++++
 common/env_common.c  | 3 +++
 3 files changed, 10 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index bfbeb4842380..b2c19b912834 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -756,6 +756,7 @@ config TARGET_WITHERSPOON_BMC
 config TARGET_AST_G4
        bool "Support ast2400"
        select CPU_ARM926EJS
+       select ASPEED_WRITE_DEFAULT_ENV
 
 endchoice
 
diff --git a/board/aspeed/Kconfig b/board/aspeed/Kconfig
index a92b9bc0c934..fca65d0206f6 100644
--- a/board/aspeed/Kconfig
+++ b/board/aspeed/Kconfig
@@ -1,3 +1,9 @@
+config ASPEED_WRITE_DEFAULT_ENV
+       bool "force  write of default environment"
+       help
+	 when the environment CRC is bad, force a saveenv to update
+	 the flash with a sane default environment
+
 source "board/aspeed/ast-g5/Kconfig"
 source "board/aspeed/ast-g4/Kconfig"
 source "board/aspeed/witherspoon-bmc/Kconfig"
diff --git a/common/env_common.c b/common/env_common.c
index af59c72e1fd7..5d6aac551b26 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -262,6 +262,9 @@ void env_relocate(void)
 #else
 		bootstage_error(BOOTSTAGE_ID_NET_CHECKSUM);
 		set_default_env("!bad CRC");
+#ifdef CONFIG_ASPEED_WRITE_DEFAULT_ENV
+		saveenv();
+#endif
 #endif
 	} else {
 		env_relocate_spec();
-- 
2.1.4



More information about the openbmc mailing list