[U-Boot] [PATCHv3] env: enable accessing the environment in an EXT4 partition

Jorge Ramirez-Ortiz jorge.ramirez-ortiz at linaro.org
Mon Nov 27 17:45:35 UTC 2017


the following commit enables accessing the environment in an ext4
partition. In order to do that, some definitions need to be added to
include/configs/board_x.h file.

For example to store the environment in a file named "/uboot.env" in MMC
"0", where partition "1" contains the EXT4 filesystem, you should define:

  EXT4_ENV_DEVICE_AND_PART        "0:1"
  EXT4_ENV_INTERFACE              "mmc"
  EXT4_ENV_FILE                   "/uboot.env"
---
 env/Kconfig | 7 +++++++
 env/env.c   | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/env/Kconfig b/env/Kconfig
index 2477bf8..09309ab 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -81,6 +81,13 @@ config ENV_IS_IN_FAT
 	  - CONFIG_FAT_WRITE:
 	  This must be enabled. Otherwise it cannot save the environment file.
 
+config ENV_IS_IN_EXT4
+	bool "Environment is in a EXT4 filesystem"
+	depends on !CHAIN_OF_TRUST
+	select EXT4_WRITE
+	help
+	  Define this if you want to use the EXT4 file system for the environment.
+
 config ENV_IS_IN_FLASH
 	bool "Environment in flash memory"
 	depends on !CHAIN_OF_TRUST
diff --git a/env/env.c b/env/env.c
index 76a5608..7455632 100644
--- a/env/env.c
+++ b/env/env.c
@@ -32,6 +32,8 @@ static enum env_location env_get_default_location(void)
 		return ENVL_EEPROM;
 	else if IS_ENABLED(CONFIG_ENV_IS_IN_FAT)
 		return ENVL_FAT;
+	else if IS_ENABLED(CONFIG_ENV_IS_IN_EXT4)
+		return ENVL_EXT4;
 	else if IS_ENABLED(CONFIG_ENV_IS_IN_FLASH)
 		return ENVL_FLASH;
 	else if IS_ENABLED(CONFIG_ENV_IS_IN_MMC)
-- 
2.7.4



More information about the U-Boot mailing list