[PATCH] sunxi: fix initial environment loading without MMC

Andre Przywara andre.przywara at arm.com
Thu Apr 21 02:34:48 CEST 2022


Commit e42dad4168fe ("sunxi: use boot source for determining environment
location") changed our implementation of env_get_location() and enabled
it for every board, even those without MMC support (like the C.H.I.P.
boards). However the default fallback location of ENVL_FAT does not cope
very well without MMC support compiled in, so the board hangs when trying
to initially load the environment.

Change the default fallback location to be ENVL_FAT only when the FAT
environment support is enabled, and use ENVL_NOWHERE and ENVL_UBI as
alternative fallbacks, when those sources are enabled.

This fixes U-Boot loading on the C.H.I.P. boards.

Fixes: e42dad4168fe ("sunxi: use boot source for determining environment location")
Reported-by: Chris Morgan <macroalpha82 at gmail.com>
Signed-off-by: Andre Przywara <andre.przywara at arm.com>
---
 board/sunxi/board.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 89324159d55..befb6076ca6 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -132,7 +132,14 @@ void i2c_init_board(void)
  */
 enum env_location env_get_location(enum env_operation op, int prio)
 {
-	enum env_location boot_loc = ENVL_FAT;
+	enum env_location boot_loc;
+
+	if (IS_ENABLED(CONFIG_ENV_IS_NOWHERE))
+		boot_loc = ENVL_NOWHERE;
+	else if (IS_ENABLED(CONFIG_ENV_IS_IN_FAT))
+		boot_loc = ENVL_FAT;
+	else if (IS_ENABLED(CONFIG_ENV_IS_IN_UBI))
+		boot_loc = ENVL_UBI;
 
 	gd->env_load_prio = prio;
 
-- 
2.35.3



More information about the U-Boot mailing list