[PATCH resend 1/2] imx: spl_imx_romapi: avoid tricky use of spl_load_simple_fit() to get full FIT size

sbabic at denx.de sbabic at denx.de
Mon Oct 16 11:22:02 CEST 2023


> Currently, spl_imx_romapi uses a somewhat tricky workaround for the
> fact that a FIT image with external data doesn't directly allow one to
> know the full size of the file: It does a dummy spl_load_simple_fit(),
> having the ->read callback remember the largest offset requested, and
> then does a last call to rom_api_download_image() to fetch the
> remaining part of the full FIT image.
> We can avoid that by just keeping track of how much we have downloaded
> already, and if the ->read() requests something outside the current
> valid buffer, fetch up to the end of the current request.
> The current method also suffers from not working when CONFIG_IMX_HAB
> is enabled: While in that case u-boot.itb is not built with external
> data, so the fdt header does contain the full size of the dtb
> structure. However, it does not account for the extra CONFIG_CSF_SIZE
> added by board_spl_fit_size_align(). And also, the data it hands out
> during the first dummy spl_load_simple_fit() is of course garbage, and
> wouldn't pass the verification.
> So we really need to call spl_load_simple_fit() only once, let that
> figure out just how big the FIT image is (including whatever data, CSF
> or "ordinary" external data, has been tacked on beyond the fdt
> structure), and always provide valid data from the ->read callback.
> This only affects the CONFIG_SPL_LOAD_FIT case - I don't have any
> hardware or experience with the CONFIG_SPL_LOAD_IMX_CONTAINER case, so
> I leave that alone for now.
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> Reviewed-by: Fabio Estevam <festevam at denx.de>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================


More information about the U-Boot mailing list