[PATCH 6/6] rockchip: ringneck-px30: fix modified boot_targets detection
Quentin Schulz
quentin.schulz at theobroma-systems.com
Fri Nov 10 11:53:39 CET 2023
Hi Tom,
On 11/9/23 22:28, Tom Rini wrote:
> On Wed, Nov 08, 2023 at 03:20:35PM +0100, Quentin Schulz wrote:
>
>> From: Quentin Schulz <quentin.schulz at theobroma-systems.com>
>>
>> U-Boot proper automatically modifies boot_targets to swap the order in
>> which MMC storage media are used for standard boot based on which MMC
>> storage medium was used to load U-Boot proper. This is however only done
>> if the user has not changed it manually, therefore a check between the
>> default and current value is done.
>>
>> This used to work fine until the migration to standard boot where
>> boot_targets value size in the default environment went above the 32
>> characters that env_get_default function can return, thus resulting in a
>> truncated variable.
>>
>> Therefore the check between default and current value would always fail.
>>
>> By using the newly added env_get_default_into function, a buffer of
>> the appropriate size can be allocated on the stack to get the whole
>> value of boot_targets in the default environment and thus fixing the
>> check.
>>
>> Cc: Quentin Schulz <foss+uboot at 0leil.net>
>> Signed-off-by: Quentin Schulz <quentin.schulz at theobroma-systems.com>
>> ---
>> board/theobroma-systems/ringneck_px30/ringneck-px30.c | 9 +++++++--
>> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> This looks like what the puma-rk3399 is doing in 5/6. Can we have this
> in a more common location? Or would there be a downside to that?
>
I can think of a few things, yes. Now wondering how far I want to push it :)
I could simply pass the DT paths to a function for eMMC/SD controller.
Or I could derive those from spl_boot_devices array in spl-boot-order.c
and do everything automagically somehow.
Will try a v2 next week.
Cheers,
Quentin
More information about the U-Boot
mailing list