mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-23 23:42:43 +00:00
mediatek: use U-Boot FAT environment support for Banana Pi R2
Instead of building in a default environment which loads our environment from the FAT partition.... just ask U-Boot to do it. Submitted upstream at https://patchwork.ozlabs.org/project/uboot/list/?series=184688 Signed-off-by: David Woodhouse <dwmw2@infradead.org>
This commit is contained in:
parent
dc4699470b
commit
0c7bce7efd
@ -2,13 +2,16 @@ diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig
|
|||||||
index 6b9fbd7e22..fb2a004803 100644
|
index 6b9fbd7e22..fb2a004803 100644
|
||||||
--- a/configs/mt7623n_bpir2_defconfig
|
--- a/configs/mt7623n_bpir2_defconfig
|
||||||
+++ b/configs/mt7623n_bpir2_defconfig
|
+++ b/configs/mt7623n_bpir2_defconfig
|
||||||
@@ -52,3 +52,9 @@ CONFIG_TIMER=y
|
@@ -52,3 +52,12 @@ CONFIG_TIMER=y
|
||||||
CONFIG_WDT_MTK=y
|
CONFIG_WDT_MTK=y
|
||||||
CONFIG_LZMA=y
|
CONFIG_LZMA=y
|
||||||
# CONFIG_EFI_LOADER is not set
|
# CONFIG_EFI_LOADER is not set
|
||||||
+CONFIG_CMD_BOOTZ=y
|
+CONFIG_CMD_BOOTZ=y
|
||||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||||
+#enables savenenv-command
|
+#enables savenenv-command
|
||||||
+CONFIG_ENV_IS_IN_MMC=y
|
+CONFIG_ENV_IS_IN_FAT=y
|
||||||
|
+CONFIG_ENV_FAT_INTERFACE="mmc"
|
||||||
|
+CONFIG_ENV_FAT_DEVICE_AND_PART=":2"
|
||||||
|
+CONFIG_ENV_FAT_FILE="uboot.env"
|
||||||
+CONFIG_CMD_ASKENV=y
|
+CONFIG_CMD_ASKENV=y
|
||||||
+CONFIG_ENV_SIZE=0x2000
|
+CONFIG_ENV_SIZE=0x2000
|
||||||
|
@ -0,0 +1,88 @@
|
|||||||
|
From fb2810b2c7209d4ed690e48e5bffa52d1af2eda3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Woodhouse <dwmw2@infradead.org>
|
||||||
|
Date: Fri, 19 Jun 2020 22:57:04 +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.
|
||||||
|
|
||||||
|
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
|
||||||
|
---
|
||||||
|
env/Kconfig | 4 ++++
|
||||||
|
env/fat.c | 31 +++++++++++++++++++++++++++++--
|
||||||
|
2 files changed, 33 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/env/Kconfig b/env/Kconfig
|
||||||
|
index 0d6f559b39..a2020a8661 100644
|
||||||
|
--- a/env/Kconfig
|
||||||
|
+++ b/env/Kconfig
|
||||||
|
@@ -432,6 +432,10 @@ config ENV_FAT_DEVICE_AND_PART
|
||||||
|
If none, first valid partition in device D. If no
|
||||||
|
partition table then means device D.
|
||||||
|
|
||||||
|
+ If ENV_FAT_INTERFACE is set to "mmc" then device 'D' can be omitted,
|
||||||
|
+ leaving the string starting with a colon, and the boot device will
|
||||||
|
+ be used.
|
||||||
|
+
|
||||||
|
config ENV_FAT_FILE
|
||||||
|
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
|
||||||
|
--- a/env/fat.c
|
||||||
|
+++ b/env/fat.c
|
||||||
|
@@ -31,6 +31,33 @@
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#if defined(CMD_SAVEENV) || defined(CMD_LOADENV)
|
||||||
|
+__weak int mmc_get_env_dev(void)
|
||||||
|
+{
|
||||||
|
+ return CONFIG_SYS_MMC_ENV_DEV;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static char *env_fat_device_and_part(void)
|
||||||
|
+{
|
||||||
|
+#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] == ':') {
|
||||||
|
+ part_str = "0" CONFIG_ENV_FAT_DEVICE_AND_PART;
|
||||||
|
+ part_str[0] += mmc_get_env_dev();
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return part_str;
|
||||||
|
+#else
|
||||||
|
+ return CONFIG_ENV_FAT_DEVICE_AND_PART;
|
||||||
|
+#endif
|
||||||
|
+}
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#ifdef CMD_SAVEENV
|
||||||
|
static int env_fat_save(void)
|
||||||
|
{
|
||||||
|
@@ -46,7 +73,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,
|
||||||
|
+ env_fat_device_and_part(),
|
||||||
|
&dev_desc, &info, 1);
|
||||||
|
if (part < 0)
|
||||||
|
return 1;
|
||||||
|
@@ -93,7 +120,7 @@ static int env_fat_load(void)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
part = blk_get_device_part_str(CONFIG_ENV_FAT_INTERFACE,
|
||||||
|
- CONFIG_ENV_FAT_DEVICE_AND_PART,
|
||||||
|
+ env_fat_device_and_part(),
|
||||||
|
&dev_desc, &info, 1);
|
||||||
|
if (part < 0)
|
||||||
|
goto err_env_relocate;
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
Loading…
Reference in New Issue
Block a user