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 <[email protected]>
---
 common/spl/spl_ram.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/common/spl/spl_ram.c b/common/spl/spl_ram.c
index 0c501cf02f2..641aff6efca 100644
--- a/common/spl/spl_ram.c
+++ b/common/spl/spl_ram.c
@@ -84,6 +84,13 @@ static int spl_ram_load_image(struct spl_image_info 
*spl_image,
                struct spl_load_info load;
 
                debug("Found FIT\n");
+               if (CONFIG_IS_ENABLED(LOAD_FIT_FULL)) {
+                       ret = spl_load_fit_image(spl_image, header);
+                       if (!ret)
+                               return 0;
+                       debug("Loading FULL FIT failed, trying SIMPLE FIT\n");
+               }
+
                spl_load_init(&load, spl_ram_load_read, NULL, 1);
                ret = spl_load_simple_fit(spl_image, &load, 0, header);
        } else {

-- 
2.55.0

Reply via email to