diff mbox series

[v2] mx6qsabrelite: increase the environment offset

Message ID 20200915113714.1174226-1-denis.pynkin@collabora.com
State Accepted
Commit 1189bd513ca376a0f1b357bb0ffec7ae22ace717
Delegated to: Stefano Babic
Headers show
Series [v2] mx6qsabrelite: increase the environment offset | expand

Commit Message

Denis Pynkin Sept. 15, 2020, 11:37 a.m. UTC
The size of the binary created with the default U-boot config is much
greater than the default offset for environment `0x60000`.
In case if that binary is used for booting via MMC it is overlapped with
the environment stored on MMC.
This leads to U-Boot corruption while saving environment with `saveenv`
command and non-bootable SabreLite board.

The offset for environment `CONFIG_ENV_OFFSET=0x60000` was added in
commit a09fea1 but did not count in the change to `0xC0000` if option
`CONFIG_ENV_IS_IN_MMC` is used.

The offset is also used for variant with environment saving onto SPI NOR
flash (with enabled option `CONFIG_ENV_IS_IN_SPI_FLASH`). In that case the
U-Boot binary flashed on SPI NOR is also corrupted after environment
saving with the original 0x60000 offset.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
---
 configs/mx6qsabrelite_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tom Rini Sept. 15, 2020, 12:49 p.m. UTC | #1
On Tue, Sep 15, 2020 at 02:37:14PM +0300, Denis Pynkin wrote:

> The size of the binary created with the default U-boot config is much
> greater than the default offset for environment `0x60000`.
> In case if that binary is used for booting via MMC it is overlapped with
> the environment stored on MMC.
> This leads to U-Boot corruption while saving environment with `saveenv`
> command and non-bootable SabreLite board.
> 
> The offset for environment `CONFIG_ENV_OFFSET=0x60000` was added in
> commit a09fea1 but did not count in the change to `0xC0000` if option
> `CONFIG_ENV_IS_IN_MMC` is used.
> 
> The offset is also used for variant with environment saving onto SPI NOR
> flash (with enabled option `CONFIG_ENV_IS_IN_SPI_FLASH`). In that case the
> U-Boot binary flashed on SPI NOR is also corrupted after environment
> saving with the original 0x60000 offset.
> 
> Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>

Thanks for rewording.

Reviewed-by: Tom Rini <trini@konsulko.com>
Stefano Babic Sept. 18, 2020, 2:06 p.m. UTC | #2
> The size of the binary created with the default U-boot config is much
> greater than the default offset for environment `0x60000`.
> In case if that binary is used for booting via MMC it is overlapped with
> the environment stored on MMC.
> This leads to U-Boot corruption while saving environment with `saveenv`
> command and non-bootable SabreLite board.
> The offset for environment `CONFIG_ENV_OFFSET=0x60000` was added in
> commit a09fea1 but did not count in the change to `0xC0000` if option
> `CONFIG_ENV_IS_IN_MMC` is used.
> The offset is also used for variant with environment saving onto SPI NOR
> flash (with enabled option `CONFIG_ENV_IS_IN_SPI_FLASH`). In that case the
> U-Boot binary flashed on SPI NOR is also corrupted after environment
> saving with the original 0x60000 offset.
> Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/configs/mx6qsabrelite_defconfig b/configs/mx6qsabrelite_defconfig
index 008fcfe04c..6e7193e411 100644
--- a/configs/mx6qsabrelite_defconfig
+++ b/configs/mx6qsabrelite_defconfig
@@ -4,7 +4,7 @@  CONFIG_SYS_TEXT_BASE=0x17800000
 CONFIG_SYS_MALLOC_F_LEN=0x4000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x2000
-CONFIG_ENV_OFFSET=0x60000
+CONFIG_ENV_OFFSET=0xC0000
 CONFIG_MX6Q=y
 CONFIG_TARGET_NITROGEN6X=y
 CONFIG_DM_GPIO=y