Fix test failure caused by bad handling of ramdisk
authorSimon Glass <sjg@chromium.org>
Fri, 22 Aug 2014 20:26:43 +0000 (14:26 -0600)
committerTom Rini <trini@ti.com>
Thu, 28 Aug 2014 21:18:48 +0000 (17:18 -0400)
Commit e3a5bbce broke the FIT image tests by not loading a ramdisk even if
a load address is provided in the FIT. The rationale was that a load address
of 0 should be considered to mean 'do not load'.

Add a new load operation which supports this feature, so that the ramdisk
will be loaded if a non-zero load address is provided.

Signed-off-by: Simon Glass <sjg@chromium.org>
common/image-fit.c
common/image.c
include/image.h

index c61be651334a0240cf81607f6624b0d770ef6fb7..255c4cac9cafa328d33cd382e524207c1728c7cc 100644 (file)
@@ -1656,7 +1656,7 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
                        bootstage_error(bootstage_id + BOOTSTAGE_SUB_LOAD);
                        return -EBADF;
                }
-       } else {
+       } else if (load_op != FIT_LOAD_OPTIONAL_NON_ZERO || load) {
                ulong image_start, image_end;
                ulong load_end;
                void *dst;
index d4ccff00956d1bc045e684e3e1cbc3c8a75975e2..38b56e3deb5807ba850bf038b73409d06eba2f26 100644 (file)
@@ -966,7 +966,8 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
                                        &fit_uname_config, arch,
                                        IH_TYPE_RAMDISK,
                                        BOOTSTAGE_ID_FIT_RD_START,
-                                       FIT_LOAD_IGNORED, &rd_data, &rd_len);
+                                       FIT_LOAD_OPTIONAL_NON_ZERO,
+                                       &rd_data, &rd_len);
                        if (rd_noffset < 0)
                                return 1;
 
index 69f86ad49e118ce32a663432a177ee0e891d0cda..340105658c02554597e84951e8d8f9bde571f54b 100644 (file)
@@ -412,6 +412,7 @@ void genimg_print_time(time_t timestamp);
 enum fit_load_op {
        FIT_LOAD_IGNORED,       /* Ignore load address */
        FIT_LOAD_OPTIONAL,      /* Can be provided, but optional */
+       FIT_LOAD_OPTIONAL_NON_ZERO,     /* Optional, a value of 0 is ignored */
        FIT_LOAD_REQUIRED,      /* Must be provided */
 };