]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mx6sabresd: Fix U-Boot corruption after saving the environment
authorFabio Estevam <festevam@denx.de>
Fri, 2 Feb 2024 16:04:03 +0000 (13:04 -0300)
committerFabio Estevam <festevam@denx.de>
Thu, 8 Feb 2024 12:18:32 +0000 (09:18 -0300)
U-Boot binary has grown in such a way that it goes beyond the reserved
area for the environment variables.

Running "saveenv" and rebooting the board causes U-Boot to hang because
of this overlap.

Fix this problem by selecting CONFIG_LTO so that the U-Boot proper
size can be reduced.

Also, to prevent this same problem to happen in the future, use
CONFIG_BOARD_SIZE_LIMIT, which can detect the overlap in build-time.

CONFIG_BOARD_SIZE_LIMIT is calculated as follows:

CONFIG_BOARD_SIZE_LIMIT = CONFIG_ENV_OFFSET - u-boot-img.dtb offset
CONFIG_BOARD_SIZE_LIMIT = 0xc000 - 69 * 1024
CONFIG_BOARD_SIZE_LIMIT = 715766

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>
configs/mx6sabresd_defconfig

index a90efe4a7786c36dc374ae5a0e2d75be25d2efb7..d4fb55622cf1df9346179084c908d8ae0fe74edb 100644 (file)
@@ -21,6 +21,9 @@ CONFIG_SPL_SERIAL=y
 CONFIG_SPL=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_PCI=y
+CONFIG_LTO=y
+CONFIG_HAS_BOARD_SIZE_LIMIT=y
+CONFIG_BOARD_SIZE_LIMIT=715766
 CONFIG_FIT=y
 CONFIG_SPL_FIT_PRINT=y
 CONFIG_SPL_LOAD_FIT=y