warp7: Fix U-Boot corruption after saving the environment
PATCH v2 1/1 warp7: Fix U-Boot corruption after saving the environment
U-Boot binary has grown in such a way that it goes beyond the reserved area for the environment variables.
Running "saveenv" followed by a "reset" causes U-Boot to hang because of this overlap.
Fix this problem by increasing the CONFIG_ENV_OFFSET size.
Also, in order to prevent this same problem in the future, use CONFIG_BOARD_SIZE_LIMIT, which will detect the overlap in build-time.
CONFIG_BOARD_SIZE_LIMIT does not accept math expressions, so declare CONFIG_ENV_OFFSET with its direct value instead.
---
Changes since v1:
- Rebased against master as CONFIG_ENV_OFFSET has moved to Kconfig
configs/warp7_defconfig | 2 +- include/configs/warp7.h | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-)
configs/warp7_defconfig +1 -1
@@ -3,7 +3,7 @@ CONFIG_ARCH_MX7=y CONFIG_SYS_TEXT_BASE=0x87800000 CONFIG_TARGET_WARP7=y CONFIG_ENV_SIZE=0x2000 -CONFIG_ENV_OFFSET=0x80000 +CONFIG_ENV_OFFSET=0xC0000 CONFIG_NR_DRAM_BANKS=1 CONFIG_ARMV7_BOOT_SEC_DEFAULT=y # CONFIG_ARMV7_VIRT is not set
include/configs/warp7.h +13 -0
@@ -125,6 +125,19 @@#define CONFIG_SYS_INIT_SP_ADDR \ (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) +/* +* Environment starts at CONFIG_ENV_OFFSET= 0xC0000 = 768k = 768*1024 = 786432 +* +* Detect overlap between U-Boot image and environment area in build-time +* +* CONFIG_BOARD_SIZE_LIMIT = CONFIG_ENV_OFFSET - u-boot.imx offset +* CONFIG_BOARD_SIZE_LIMIT = 768k - 1k = 767k = 785408 +* +* Currently CONFIG_BOARD_SIZE_LIMIT does not handle expressions, so +* write the direct value here +*/ +#define CONFIG_BOARD_SIZE_LIMIT 785408 +/* I2C configs */ #define CONFIG_SYS_I2C_MXC #define CONFIG_SYS_I2C_SPEED 100000
Signature · 1 line
2.17.1
PATCH v2 1/1 warp7: Fix U-Boot corruption after saving the environment
Quoted 19 lines · Fabio Estevam
U-Boot binary has grown in such a way that it goes beyond the reserved area for the environment variables.
Running "saveenv" followed by a "reset" causes U-Boot to hang because of this overlap.
Fix this problem by increasing the
CONFIG_ENV_OFFSETsize.Also, in order to prevent this same problem in the future, use
CONFIG_BOARD_SIZE_LIMIT, which will detect the overlap in build-time.
CONFIG_BOARD_SIZE_LIMITdoes not accept math expressions, so declareCONFIG_ENV_OFFSETwith its direct value instead.Signed-off-by Fabio Estevam <[email protected]>Tested-by Pierre-Jean Texier <[email protected]>Acked-by Joris Offouga <[email protected]>Tested-by Joris Offouga <[email protected]>
Quoted 7 lines
---
Changes since v1:
- Rebased against master asCONFIG_ENV_OFFSEThas moved toKconfigconfigs/warp7_defconfig | 2 +- include/configs/warp7.h | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-)
Is there a reason we can't use CONFIG_SYS_THUMB_BUILD on these platforms? It's not default y as I seem to recall some thumb problems with very early ARMv7 cores, but it should almost certainly be set here (and a large number of other i.MX platforms). I'd much rather see that than moving the environment offset. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191202/a4ae39d5/attachment.sig>
PATCH v2 1/1 warp7: Fix U-Boot corruption after saving the environment
Quoted 5 lines · Tom Rini
Is there a reason we can't use
CONFIG_SYS_THUMB_BUILDon these platforms? It's not default y as I seem to recall some thumb problems with very early ARMv7 cores, but it should almost certainly be set here (and a large number of other i.MX platforms). I'd much rather see that than moving the environment offset. Thanks!
Just sent v3 with CONFIG_SYS_THUMB_BUILD=y.