]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
uboot-airoha: fix eMMC boot failure caused by redundant env 24397/head
authorYalei Zang <yalei.zang@airoha.com>
Fri, 24 Jul 2026 06:39:11 +0000 (14:39 +0800)
committerJonas Jelonek <jelonek.jonas@gmail.com>
Sun, 2 Aug 2026 20:59:57 +0000 (22:59 +0200)
The an7581/an7583 configs enable redundant environment support,
but do not define CONFIG_ENV_OFFSET_REDUND.

When running `saveenv`, U-Boot tries to write the redundant environment
to MMC. Without a valid redundant environment offset, the data may be
written to an incorrect location and overwrite critical boot data such
as the GPT, BL2/preloader or BL31+U-Boot FIP.

This causes the board to fail booting after saving the environment.

Define CONFIG_ENV_OFFSET_REDUND so the redundant environment is stored
at a valid eMMC offset and no longer corrupts the bootchain.

Signed-off-by: Yalei Zang <yalei.zang@airoha.com>
Link: https://github.com/openwrt/openwrt/pull/24397
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
package/boot/uboot-airoha/patches/904-configs-airoha-add-missing-config-env-offset-redund.patch [new file with mode: 0644]

diff --git a/package/boot/uboot-airoha/patches/904-configs-airoha-add-missing-config-env-offset-redund.patch b/package/boot/uboot-airoha/patches/904-configs-airoha-add-missing-config-env-offset-redund.patch
new file mode 100644 (file)
index 0000000..f07e5ea
--- /dev/null
@@ -0,0 +1,46 @@
+From a919f4797049a82cd3367138a20d06c2e0126534 Mon Sep 17 00:00:00 2001
+From: Yalei Zang <yalei.zang@airoha.com>
+Date: Fri, 24 Jul 2026 14:16:33 +0800
+Subject: [PATCH] configs: airoha: add missing CONFIG_ENV_OFFSET_REDUND
+
+The an7581/an7583 defconfigs enable CONFIG_ENV_REDUNDANT to support
+redundant environment, but miss the CONFIG_ENV_OFFSET_REDUND option.
+
+Without a valid redundant offset, executing `saveenv` causes U-Boot to
+write the redundant environment data to an incorrect location (likely
+offset 0 or overlapping), which destroys the eMMC BL2 or FIP partitions.
+This leads to a boot failure (bricked device) after a simple reset.
+
+Signed-off-by: Yalei Zang <yalei.zang@airoha.com>
+---
+ configs/an7581_evb_defconfig | 1 +
+ configs/an7583_evb_defconfig | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/configs/an7581_evb_defconfig b/configs/an7581_evb_defconfig
+index b39ebac8..5e89d418 100644
+--- a/configs/an7581_evb_defconfig
++++ b/configs/an7581_evb_defconfig
+@@ -10,6 +10,7 @@ CONFIG_ENV_OFFSET=0x7c000
+ CONFIG_DM_GPIO=y
+ CONFIG_DEFAULT_DEVICE_TREE="airoha/en7581-evb"
+ CONFIG_SYS_LOAD_ADDR=0x81800000
++CONFIG_ENV_OFFSET_REDUND=0x80000
+ CONFIG_BUILD_TARGET="u-boot.bin"
+ # CONFIG_EFI_LOADER is not set
+ CONFIG_FIT=y
+diff --git a/configs/an7583_evb_defconfig b/configs/an7583_evb_defconfig
+index 4c5bd6dd..48e43b86 100644
+--- a/configs/an7583_evb_defconfig
++++ b/configs/an7583_evb_defconfig
+@@ -10,6 +10,7 @@ CONFIG_ENV_OFFSET=0x7c000
+ CONFIG_DM_GPIO=y
+ CONFIG_DEFAULT_DEVICE_TREE="an7583-evb"
+ CONFIG_SYS_LOAD_ADDR=0x81800000
++CONFIG_ENV_OFFSET_REDUND=0x80000
+ CONFIG_BUILD_TARGET="u-boot.bin"
+ # CONFIG_EFI_LOADER is not set
+ CONFIG_FIT=y
+-- 
+2.43.0
+