DECLARE_GLOBAL_DATA_PTR;
-static char *env_fat_device_and_part(void)
+__weak char *env_fat_get_interface(void)
+{
+ return CONFIG_ENV_FAT_INTERFACE;
+}
+
+static char *env_fat_device_and_part(char *interface)
{
#ifdef CONFIG_MMC
static char *part_str;
if (!part_str) {
part_str = CONFIG_ENV_FAT_DEVICE_AND_PART;
- if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "mmc") && part_str[0] == ':') {
+ if (!strcmp(interface, "mmc") && part_str[0] == ':') {
part_str = "0" CONFIG_ENV_FAT_DEVICE_AND_PART;
part_str[0] += mmc_get_env_dev();
}
struct blk_desc *dev_desc = NULL;
struct disk_partition info;
const char *file = CONFIG_ENV_FAT_FILE;
+ char *interface;
int dev, part;
int err;
loff_t size;
if (err)
return err;
- part = blk_get_device_part_str(CONFIG_ENV_FAT_INTERFACE,
- env_fat_device_and_part(),
+ interface = env_fat_get_interface();
+ part = blk_get_device_part_str(interface,
+ env_fat_device_and_part(interface),
&dev_desc, &info, 1);
if (part < 0)
return 1;
* This printf is embedded in the messages from env_save that
* will calling it. The missing \n is intentional.
*/
- printf("Unable to use %s %d:%d... ",
- CONFIG_ENV_FAT_INTERFACE, dev, part);
+ printf("Unable to use %s %d:%d... ", interface, dev, part);
return 1;
}
* will calling it. The missing \n is intentional.
*/
printf("Unable to write \"%s\" from %s%d:%d... ",
- file, CONFIG_ENV_FAT_INTERFACE, dev, part);
+ file, interface, dev, part);
return 1;
}
#endif
struct blk_desc *dev_desc = NULL;
struct disk_partition info;
+ char *interface;
int dev, part;
int err1;
+ interface = env_fat_get_interface();
+
#ifdef CONFIG_MMC
- if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "mmc"))
+ if (!strcmp(interface, "mmc"))
mmc_initialize(NULL);
#endif
- part = blk_get_device_part_str(CONFIG_ENV_FAT_INTERFACE,
- env_fat_device_and_part(),
+ part = blk_get_device_part_str(interface,
+ env_fat_device_and_part(interface),
&dev_desc, &info, 1);
if (part < 0)
goto err_env_relocate;
* This printf is embedded in the messages from env_save that
* will calling it. The missing \n is intentional.
*/
- printf("Unable to use %s %d:%d... ",
- CONFIG_ENV_FAT_INTERFACE, dev, part);
+ printf("Unable to use %s %d:%d... ", interface, dev, part);
goto err_env_relocate;
}
* will calling it. The missing \n is intentional.
*/
printf("Unable to read \"%s\" from %s%d:%d... ",
- CONFIG_ENV_FAT_FILE, CONFIG_ENV_FAT_INTERFACE, dev, part);
+ CONFIG_ENV_FAT_FILE, interface, dev, part);
goto err_env_relocate;
}