@@ -81,11 +81,22 @@ static int spl_ram_load_image(struct spl_image_info *spl_image,
if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
image_get_magic(header) == FDT_MAGIC) {
- struct spl_load_info load;
-
debug("Found FIT\n");
- spl_load_init(&load, spl_ram_load_read, NULL, 1);
- ret = spl_load_simple_fit(spl_image, &load, 0, header);
+ /* by default, assume failure and fall back to simple FIT */
+ int ret = -1;
+
+ if (CONFIG_IS_ENABLED(LOAD_FIT_FULL)) {
+ ret = spl_load_fit_image(spl_image, header);
+ if (ret)
+ debug("Loading FULL FIT failed, trying SIMPLE FIT\n");
+ }
+
+ if (ret) {
+ struct spl_load_info load;
+
+ spl_load_init(&load, spl_ram_load_read, NULL, 1);
+ ret = spl_load_simple_fit(spl_image, &load, 0, header);
+ }
} else {
ulong u_boot_pos = spl_get_image_pos();
The simple FIT loader lacks support for full image verification (CONFIG_SPL_FIT_FULL_CHECK). The full parser (spl_load_fit_image) provides this feature. Enable it when CONFIG_SPL_LOAD_FIT_FULL is selected. If the full load fails, fall back to the simple loader to preserve compatibility. Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me> --- common/spl/spl_ram.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)