In cases where the 'load' property is not defined in a FIT image node, fallback to using the data address returned by `fit_image_get_data()`. This enables FIT images to omit the 'load' property during FIT creation.
Signed-off-by: Beleswar Padhi <[email protected]> --- Cc: Simon Glass <[email protected]> v3: Changelog: 1. None Link to v2: https://lore.kernel.org/all/[email protected]/ v2: Changelog: 1. New patch. Add support to load images without 'load' property. common/spl/spl_fit.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index a588d13eb40..c18c98b2959 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -803,6 +803,8 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, { struct spl_image_info image_info; struct spl_fit_info ctx; + const void *fit_image_loadaddr; + size_t fit_image_size; int node = -1; int ret; int index = 0; @@ -893,7 +895,19 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, if (firmware_node == node) continue; - image_info.load_addr = 0; + /* + * If the 'load' property is not present in the image node, + * use the FIT image's data address as the fallback load + * address. This allows flexibility in omitting the load address + * during FIT creation time. + */ + ret = fit_image_get_data(ctx.fit, node, + &fit_image_loadaddr, &fit_image_size); + if (ret < 0) + panic("Error accessing node = %d in FIT (%d)\n", node, + ret); + + image_info.load_addr = (ulong)fit_image_loadaddr; ret = load_simple_fit(info, offset, &ctx, node, &image_info); if (ret < 0 && ret != -EBADSLT) { printf("%s: can't load image loadables index %d (ret = %d)\n", -- 2.34.1

