[U-Boot] [PATCH v3 28/58] env: fat: Add func to get fat device, partition
Jagan Teki
jagan at amarulasolutions.com
Sun Aug 19 13:56:45 UTC 2018
Get a fat device and partition for multiple families
of same SoC type can be difficult to handle with static
CONFIG_ENV_FAT_DEVICE_AND_PART via Kconfig.
So, add a generic weak function to get the device, partition
and give relevant users to define their own logic to setup
fat device and partition.
Signed-off-by: Jagan Teki <jagan at amarulasolutions.com>
---
env/fat.c | 9 +++++++--
include/fat.h | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/env/fat.c b/env/fat.c
index 7f74c64dfe..2147cc0326 100644
--- a/env/fat.c
+++ b/env/fat.c
@@ -30,6 +30,11 @@
# endif
#endif
+__weak char *get_env_fat_dev_part(void)
+{
+ return CONFIG_ENV_FAT_DEVICE_AND_PART;
+}
+
#ifdef CMD_SAVEENV
static int env_fat_save(void)
{
@@ -45,7 +50,7 @@ static int env_fat_save(void)
return err;
part = blk_get_device_part_str(CONFIG_ENV_FAT_INTERFACE,
- CONFIG_ENV_FAT_DEVICE_AND_PART,
+ get_env_fat_dev_part(),
&dev_desc, &info, 1);
if (part < 0)
return 1;
@@ -92,7 +97,7 @@ static int env_fat_load(void)
#endif
part = blk_get_device_part_str(CONFIG_ENV_FAT_INTERFACE,
- CONFIG_ENV_FAT_DEVICE_AND_PART,
+ get_env_fat_dev_part(),
&dev_desc, &info, 1);
if (part < 0)
goto err_env_relocate;
diff --git a/include/fat.h b/include/fat.h
index 09e1423685..0552fa54b5 100644
--- a/include/fat.h
+++ b/include/fat.h
@@ -185,6 +185,7 @@ static inline u32 sect_to_clust(fsdata *fsdata, int sect)
return (sect - fsdata->data_begin) / fsdata->clust_size;
}
+char *get_env_fat_dev_part(void);
int file_fat_detectfs(void);
int fat_exists(const char *filename);
int fat_size(const char *filename, loff_t *size);
--
2.18.0.321.gffc6fa0e3
More information about the U-Boot
mailing list