public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: sbabic@denx.de, trini@konsulko.com
Cc: uboot-imx@nxp.com, u-boot@lists.denx.de,
	Fabio Estevam <festevam@denx.de>
Subject: [PATCH v2 1/3] mx6sabresd: Fix U-Boot corruption after saving the environment
Date: Fri,  2 Feb 2024 13:04:03 -0300	[thread overview]
Message-ID: <20240202160405.4126192-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 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>
---
Changes since v1:
- Select LTO. (Tom)

 configs/mx6sabresd_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/mx6sabresd_defconfig b/configs/mx6sabresd_defconfig
index a90efe4a7786..d4fb55622cf1 100644
--- a/configs/mx6sabresd_defconfig
+++ b/configs/mx6sabresd_defconfig
@@ -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
-- 
2.34.1


             reply	other threads:[~2024-02-02 16:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02 16:04 Fabio Estevam [this message]
2024-02-02 16:04 ` [PATCH v2 2/3] mx6sabresd: Convert to watchdog driver model Fabio Estevam
2024-02-02 16:07   ` Tom Rini
2024-02-02 16:17     ` Fabio Estevam
2024-02-02 17:15       ` Tom Rini
2024-02-02 16:04 ` [PATCH v2 3/3] mx6sabresd: Remove board_phy_config() Fabio Estevam
2024-02-02 20:14   ` Igor Opaniuk
2024-02-02 16:06 ` [PATCH v2 1/3] mx6sabresd: Fix U-Boot corruption after saving the environment Tom Rini
2024-02-02 20:34 ` Igor Opaniuk
2024-02-02 21:16   ` Igor Opaniuk
2024-02-08 14:34 ` Fabio Estevam

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=20240202160405.4126192-1-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=festevam@denx.de \
    --cc=sbabic@denx.de \
    --cc=trini@konsulko.com \
    --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