env/ext4.c: allow loading from an EXT4 partition on the MMC boot device
[platform/kernel/u-boot.git] / env / ext4.c
index f823b69..e666f7b 100644 (file)
@@ -41,7 +41,21 @@ __weak const char *env_ext4_get_intf(void)
 
 __weak const char *env_ext4_get_dev_part(void)
 {
+#ifdef CONFIG_MMC
+       static char *part_str;
+
+       if (!part_str) {
+               part_str = CONFIG_ENV_EXT4_DEVICE_AND_PART;
+               if (!strcmp(CONFIG_ENV_EXT4_INTERFACE, "mmc") && part_str[0] == ':') {
+                       part_str = "0" CONFIG_ENV_EXT4_DEVICE_AND_PART;
+                       part_str[0] += mmc_get_env_dev();
+               }
+       }
+
+       return part_str;
+#else
        return (const char *)CONFIG_ENV_EXT4_DEVICE_AND_PART;
+#endif
 }
 
 static int env_ext4_save_buffer(env_t *env_new)