]> git.sur5r.net Git - u-boot/commitdiff
spl: add check for FIT-header when loading image
authortomas.melin@vaisala.com <tomas.melin@vaisala.com>
Wed, 16 Nov 2016 10:54:39 +0000 (12:54 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 28 Nov 2016 20:10:31 +0000 (15:10 -0500)
Add check for FDT_MAGIC, otherwise also legacy images will be loaded as
a FIT. With this check in place, the loader works correct both
with legacy and FIT images.

Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
Acked-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
common/spl/spl_spi.c

index a3caafbd46d612b9f06783265c410ecdc5dd461c..78b8cd16bb8361f50ff7a160c8bb2a95febbede1 100644 (file)
@@ -99,7 +99,8 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
                if (err)
                        return err;
 
-               if (IS_ENABLED(CONFIG_SPL_LOAD_FIT)) {
+               if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
+                       image_get_magic(header) == FDT_MAGIC) {
                        struct spl_load_info load;
 
                        debug("Found FIT\n");