[PATCH] mx6qsabrelite: increase offset for environment on SPI

Denis Pynkin denis.pynkin at collabora.com
Mon Sep 14 15:20:20 CEST 2020


14.09.2020 15:33, Tom Rini wroteт:
> On Mon, Sep 14, 2020 at 08:03:33AM -0300, Fabio Estevam wrote:

>>> The size of the binary created with the default U-boot config is much
>>> greater than the default offset for environment `0x60000`. If the new
>>> version is flashed onto SPI it overlaps with the stored environment.
>>> This leads to U-Boot corruption in case of saving environment onto
>>> SPI and non-bootable SabreLite board.
>>>
>>> Signed-off-by: Denis Pynkin <denis.pynkin at collabora.com>
>>
>> Reviewed-by: Fabio Estevam <festevam at gmail.com>
>>
>> In case you want to detect errors like this again in the future, you could add
>> CONFIG_BOARD_SIZE_LIMIT that detects such overlaps in build-time.
>>
>> Please check commit 033f6ea5fa5f ("mx53loco: Fix U-Boot corruption
>> after saving the environment")
>>
>> The addition of CONFIG_BOARD_SIZE_LIMIT can be a separate patch though.
> 
> Hold on.  Can we shrink the board back down so that we don't need to
> move the environment?  Moving the environment is bad as it will also
> break existing users.  Thanks!

I don't think so to be honest.
Current sizes even for `u-boot-nodtb.imx` in my builds are:
- 595308 (0x9156C) -- cross-compilation
- 470780 (0x72EFC) -- native build
which is much larger than current offset 393216 (0x60000)

The offset for environment `CONFIG_ENV_OFFSET=0x60000` were added in
commit a09fea1 just a year ago.
Not sure if it was tested with SabreLite board tbh -- this is a bulk
commit aimed for ARMv8 and sizes of binaries produced with pre-a09fea1
commit are also larger than the current offset.

-- 
wbr, Denis


More information about the U-Boot mailing list