[PATCH] configs: rockchip: rock5b: enable environment
Jonas Karlman
jonas at kwiboo.se
Tue Mar 5 15:32:13 CET 2024
On 2024-03-05 11:11, Quentin Schulz wrote:
> Hi all,
>
> On 3/5/24 10:36, Christopher Obbard wrote:
>> [You don't often get email from chris.obbard at collabora.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>>
>> Hi Jonas & Trevor,
>>
>> On Tue, 2024-03-05 at 10:31 +0100, Jonas Karlman wrote:
>>> Hi Trevor,
>>>
>>> On 2024-03-05 03:10, Trevor Woerner wrote:
>>>> Following the pattern of other Rockchip devices, enable the U-Boot
>>>> environment to be stored in MMC. This patch specifically assumes the
>>>> environment will be stored on the SDcard.
>>>
>>> This board has SPI flash, so storing env in SPI flash is probably a
>>> better default.
>>
>> I agree with that.
>>
>>> However, preferably the env should be stored/loaded from
>>> the same device that TPL/SPL was loaded from.
>>
>> Do you know if there is some mechanism in U-Boot to do this already ?
>>
>
> We do this for our Theobroma boards, though we use the same device that
> U-Boot proper was loaded from, and not the one that TPL+SPL was loaded
> from but the logic could be more or less the same.
Good catch, same as U-Boot proper may be more accurate and what I was
expecting, I typically expect TPL+SPL and FIT to be loaded from same
media so may see them as interchangeably.
My normal expectation will be that if FIT cannot be loaded from
same-as-spl we are in some kind of fallback and/or recovery mode.
Maybe a u-boot,env-load-order prop, similar to u-boot,spl-boot-order,
could be an option? with support for similar options, same-as-spl and
same-as-fit/proper/boot or node refs.
>
> https://source.denx.de/u-boot/u-boot/-/blob/master/board/theobroma-systems/common/common.c?ref_type=heads#L92-L152
>
> is what you need. The first function is to differentiate between SD card
> and eMMC, the second actually returns the **kind** of medium the
> environment is stored on (so MMC or SPI-flash for Theobroma boards).
>
> Instead of
> https://source.denx.de/u-boot/u-boot/-/blob/master/board/theobroma-systems/common/common.c?ref_type=heads#L94-L95
> you probably want to use board_spl_was_booted_from().
>
> Note that to you need the MMC and SPI controllers to be bound in U-Boot
> proper **before relocation** for this to work. c.f.
> https://lore.kernel.org/u-boot/20240221-jaguar-v3-15-1f256a82201b@theobroma-systems.com/
>
>> It could be useful to enable autodetection on many boards which can boot U-
>> Boot from either SPI flash / eMMC / SD card.
>>
>
> There's been an attempt recently:
>
> https://lore.kernel.org/u-boot/20240226011413.435713-2-benwolsieffer@gmail.com/
>
> though only for the MMC part of the equation.
I thought I noticed something related last few days/weeks, did not
manage to find anything when I went looking for it :-)
Regards,
Jonas
>
> Cheers,
> Quentin
More information about the U-Boot
mailing list