On 1/14/25 12:04 PM, Quentin Schulz wrote:
[...]
This has to be updated to handle the mkimage -E case too. Basically,
if the FDT is outside of the fitImage tree area, but still in the
trailing blob area at the end of fitImage generated with mkimage -E,
then any modification to the DT which would result in resize may
either fail or corrupt the surrounding blobs.
The safe but heavy handed option would be to relocate unconditionally .
Will do.
Thank you
- /* check is simplified; fit load checks for overlaps */
- printf("Overlayed FDT requires relocation\n");
- fdt_noffset = -EBADF;
- goto out;
- }
+ /* Cannot overlay an FDT stored inside the fitImage, so
let's relocate */
+ char *of_flat_tree = map_sysmem(load, len);
- base = map_sysmem(load, len);
+ len = ALIGN(fdt_totalsize(load), SZ_4K);
+ if (boot_relocate_fdt(&of_flat_tree, &len)) {
Please print the error value in case of failure here, it is useful for
debugging.
The function returns 0 on success, 1 on any error, not sure it's that
useful as it'll always be 1. Do we want to anticipate this function
being updated to have other error codes in the future?
The other functions in boot/image-fdt.c already return proper error
codes, so it is possible this one will be updated to return them too,
eventually.