[PATCH] env: mmc: Use correct eMMC HW partition size when calculating end of HW partition
Marek Vasut
marex at nabladev.com
Wed Apr 29 14:13:06 CEST 2026
When calculating the end of eMMC HW partition, it is necessary to
use the length of that eMMC HW partition, not the length of the
eMMC HW USER partition unconditionally, otherwise the end of e.g.
eMMC HW BOOT partition will be way past the actual end of that eMMC
HW BOOT partition. Add the missing distinction. eMMC HW GP partitions
are not supported, so those are not considered here.
Signed-off-by: Marek Vasut <marex at nabladev.com>
---
Cc: Jaehoon Chung <jh80.chung at samsung.com>
Cc: Jasper Orschulko <jasper at fancydomain.eu>
Cc: Joe Hershberger <joe.hershberger at ni.com>
Cc: Michael Heimpold <mhei at heimpold.de>
Cc: Michael Walle <mwalle at kernel.org>
Cc: Patrice Chotard <patrice.chotard at foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay at foss.st.com>
Cc: Peng Fan <peng.fan at nxp.com>
Cc: Tom Rini <trini at konsulko.com>
Cc: u-boot at lists.denx.de
---
env/mmc.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/env/mmc.c b/env/mmc.c
index 1eddba3b0f8..4c1448bd05e 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -239,8 +239,12 @@ __weak int mmc_get_env_addr(struct mmc *mmc, int copy, u32 *env_addr)
return -ENOENT;
}
- if (offset < 0)
- offset += mmc->capacity;
+ if (offset < 0) {
+ if (CONFIG_ENV_MMC_EMMC_HW_PARTITION)
+ offset += mmc->capacity_boot;
+ else
+ offset += mmc->capacity;
+ }
*env_addr = offset;
--
2.53.0
More information about the U-Boot
mailing list