diff options
Diffstat (limited to 'package/boot/uboot-mediatek/patches/007-env-fat-use-bootdevice.patch')
-rw-r--r-- | package/boot/uboot-mediatek/patches/007-env-fat-use-bootdevice.patch | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/package/boot/uboot-mediatek/patches/007-env-fat-use-bootdevice.patch b/package/boot/uboot-mediatek/patches/007-env-fat-use-bootdevice.patch index 20b6620d71..a0236785d0 100644 --- a/package/boot/uboot-mediatek/patches/007-env-fat-use-bootdevice.patch +++ b/package/boot/uboot-mediatek/patches/007-env-fat-use-bootdevice.patch @@ -1,22 +1,28 @@ -From fb2810b2c7209d4ed690e48e5bffa52d1af2eda3 Mon Sep 17 00:00:00 2001 +From 6731bef6966ea2b26cdcfe0109ff5a950003fd03 Mon Sep 17 00:00:00 2001 From: David Woodhouse <dwmw2@infradead.org> -Date: Fri, 19 Jun 2020 22:57:04 +0100 +Date: Fri, 19 Jun 2020 23:07:17 +0100 Subject: [PATCH] env/fat.c: allow loading from a FAT partition on the MMC boot device I don't want to have to specify the device; only the partition. +This allows me to use the same image on internal eMMC or SD card for +Banana Pi R2, and it finds its own environment either way. + Signed-off-by: David Woodhouse <dwmw2@infradead.org> +[trini: Add #if/#else/#endif logic around CONFIG_SYS_MMC_ENV_DEV usage, + whitespace changes] +Signed-off-by: Tom Rini <trini@konsulko.com> --- env/Kconfig | 4 ++++ - env/fat.c | 31 +++++++++++++++++++++++++++++-- - 2 files changed, 33 insertions(+), 2 deletions(-) + env/fat.c | 32 ++++++++++++++++++++++++++++++-- + 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/env/Kconfig b/env/Kconfig -index 0d6f559b39..a2020a8661 100644 +index 38e7fadbb9..5784136674 100644 --- a/env/Kconfig +++ b/env/Kconfig -@@ -432,6 +432,10 @@ config ENV_FAT_DEVICE_AND_PART +@@ -434,6 +434,10 @@ config ENV_FAT_DEVICE_AND_PART If none, first valid partition in device D. If no partition table then means device D. @@ -28,17 +34,21 @@ index 0d6f559b39..a2020a8661 100644 string "Name of the FAT file to use for the environment" depends on ENV_IS_IN_FAT diff --git a/env/fat.c b/env/fat.c -index 1836556f36..1c32d17bd5 100644 +index 35a1955e63..63aced9317 100644 --- a/env/fat.c +++ b/env/fat.c -@@ -31,6 +31,33 @@ +@@ -29,6 +29,36 @@ # endif #endif +#if defined(CMD_SAVEENV) || defined(CMD_LOADENV) +__weak int mmc_get_env_dev(void) +{ -+ return CONFIG_SYS_MMC_ENV_DEV; ++#ifdef CONFIG_SYS_MMC_ENV_DEV ++ return CONFIG_SYS_MMC_ENV_DEV; ++#else ++ return 0; ++#endif +} + +static char *env_fat_device_and_part(void) @@ -48,8 +58,7 @@ index 1836556f36..1c32d17bd5 100644 + + if (!part_str) { + part_str = CONFIG_ENV_FAT_DEVICE_AND_PART; -+ if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "mmc") -+ && part_str[0] == ':') { ++ if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "mmc") && part_str[0] == ':') { + part_str = "0" CONFIG_ENV_FAT_DEVICE_AND_PART; + part_str[0] += mmc_get_env_dev(); + } @@ -65,7 +74,7 @@ index 1836556f36..1c32d17bd5 100644 #ifdef CMD_SAVEENV static int env_fat_save(void) { -@@ -46,7 +73,7 @@ static int env_fat_save(void) +@@ -43,7 +71,7 @@ static int env_fat_save(void) return err; part = blk_get_device_part_str(CONFIG_ENV_FAT_INTERFACE, @@ -74,7 +83,7 @@ index 1836556f36..1c32d17bd5 100644 &dev_desc, &info, 1); if (part < 0) return 1; -@@ -93,7 +120,7 @@ static int env_fat_load(void) +@@ -89,7 +117,7 @@ static int env_fat_load(void) #endif part = blk_get_device_part_str(CONFIG_ENV_FAT_INTERFACE, |