From: Fabio Estevam <festevam@gmail.com>
To: sbabic@denx.de
Cc: uboot-imx@nxp.com, u-boot@lists.denx.de,
Fabio Estevam <festevam@denx.de>
Subject: [PATCH 1/2] mx6sabresd: Fix U-Boot corruption after saving the environment
Date: Thu, 1 Feb 2024 22:48:48 -0300 [thread overview]
Message-ID: <20240202014849.4022787-1-festevam@gmail.com> (raw)
From: Fabio Estevam <festevam@denx.de>
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 increasing the CONFIG_ENV_OFFSET.
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 = 0xd000 - 69 * 1024
CONFIG_BOARD_SIZE_LIMIT = 781312
Signed-off-by: Fabio Estevam <festevam@denx.de>
---
configs/mx6sabresd_defconfig | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/configs/mx6sabresd_defconfig b/configs/mx6sabresd_defconfig
index a90efe4a7786..f19df607e7ae 100644
--- a/configs/mx6sabresd_defconfig
+++ b/configs/mx6sabresd_defconfig
@@ -9,7 +9,7 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y
CONFIG_NR_DRAM_BANKS=1
CONFIG_SF_DEFAULT_SPEED=20000000
CONFIG_ENV_SIZE=0x2000
-CONFIG_ENV_OFFSET=0xC0000
+CONFIG_ENV_OFFSET=0xd0000
CONFIG_MX6QDL=y
CONFIG_TARGET_MX6SABRESD=y
CONFIG_DM_GPIO=y
@@ -24,6 +24,8 @@ CONFIG_PCI=y
CONFIG_FIT=y
CONFIG_SPL_FIT_PRINT=y
CONFIG_SPL_LOAD_FIT=y
+CONFIG_HAS_BOARD_SIZE_LIMIT=y
+CONFIG_BOARD_SIZE_LIMIT=781312
CONFIG_SUPPORT_RAW_INITRD=y
CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="run findfdt;mmc dev ${mmcdev};if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else run netboot; fi"
--
2.34.1
next reply other threads:[~2024-02-02 1:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-02 1:48 Fabio Estevam [this message]
2024-02-02 1:48 ` [PATCH 2/2] mx6sabresd: Convert to watchdog driver model Fabio Estevam
2024-02-02 13:51 ` [PATCH 1/2] mx6sabresd: Fix U-Boot corruption after saving the environment Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240202014849.4022787-1-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=festevam@denx.de \
--cc=sbabic@denx.de \
--cc=u-boot@lists.denx.de \
--cc=uboot-imx@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox