[PATCH v3] image: apply FDTOs on FDT image node without a load property
Marek Vasut
marex at denx.de
Wed Jan 22 16:45:32 CET 2025
On 1/22/25 4:43 PM, Quentin Schulz wrote:
> Hi Marek,
>
> On 1/22/25 3:32 PM, Marek Vasut wrote:
>> On 1/22/25 3:21 PM, Quentin Schulz wrote:
>>
>> [...]
>>
>>>> @@ -2395,17 +2395,18 @@ int boot_get_fdt_fit(struct bootm_headers
>>>> *images, ulong addr,
>>>> /* we need to apply overlays */
>>>> #ifdef CONFIG_OF_LIBFDT_OVERLAY
>>>> - image_start = addr;
>>>> - image_end = addr + fit_get_size(fit);
>>>> - /* verify that relocation took place by load address not being
>>>> in fit */
>>>> - if (load >= image_start && load < image_end) {
>>>> - /* check is simplified; fit load checks for overlaps */
>>>> - printf("Overlayed FDT requires relocation\n");
>>>> + /* Relocate FDT so resizing does not overwrite other data in
>>>> FIT. */
>>>> + of_flat_tree = map_sysmem(load, len);
>>>> + len = ALIGN(fdt_totalsize(load), SZ_4K);
>>>> + err = boot_relocate_fdt(&of_flat_tree, &len);
>>>
>>> My bad, I mistakenly "compile-tested" this with a defconfig that
>>> doesn't enable CONFIG_OF_LIBFDT_OVERLAY so this was never built.
>>>
>>> The compiler is actually not happy about that, it wants it cast to
>>> (char **).
>>>
>>> @Marek, what do you prefer? We go back to having of_flat_tree a char*
>>> or do the cast in boot_relocate_fdt?
>> What about -- go back and add a code comment ?
>>
>
> Not entirely sure to understand the kind of comment you'd like to see
> there?
>
> Would something like:
>
> // of_flat_tree is storing the void * returned by map_sysmem, then
> // its address is passed to boot_relocate_fdt which expects a char **
> // and it is then cast into a ulong. Setting its type to void * would
> // require to cast its address to char ** when passing it to
> // boot_relocate_fdt. Instead, let's be lazy and use void *.
>
> work for you?
Something like that , yes .
More information about the U-Boot
mailing list