uboot-airoha: fix eMMC boot failure caused by redundant env

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>
This commit is contained in:
Yalei Zang 2026-07-24 14:39:11 +08:00 committed by Jonas Jelonek
parent 4797e145b3
commit 5b05779b90
No known key found for this signature in database

View file

@ -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