]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Delay FIT format check on sector based devices
authorMarian Balakowicz <m8@semihalf.com>
Fri, 6 Jun 2008 21:07:40 +0000 (23:07 +0200)
committerWolfgang Denk <wd@denx.de>
Mon, 30 Jun 2008 20:52:43 +0000 (22:52 +0200)
Global FIT image operations like format check cannot be performed on
a first sector data, defer them to the point when whole FIT image was
uploaded to a system RAM.

Signed-off-by: Marian Balakowicz <m8@semihalf.com>
Partial ('cmd_nand' case) Acked-by: Grant Erickson <gerickson@nuovations.com>
NAND and DOC bits Acked-by: Scott Wood <scottwood@freescale.com>

common/cmd_doc.c
common/cmd_fdc.c
common/cmd_ide.c
common/cmd_nand.c
common/cmd_scsi.c
common/cmd_usb.c

index 83aba3744e96dd40be2cf65507bfa25ace03605b..d7b2f535f3d5b11825082d50ee156c42977302b5 100644 (file)
@@ -206,7 +206,7 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        image_header_t *hdr;
        int rcode = 0;
 #if defined(CONFIG_FIT)
-       const void *fit_hdr;
+       const void *fit_hdr = NULL;
 #endif
 
        show_boot_progress (34);
@@ -275,12 +275,6 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 #if defined(CONFIG_FIT)
        case IMAGE_FORMAT_FIT:
                fit_hdr = (const void *)addr;
-               if (!fit_check_format (fit_hdr)) {
-                       show_boot_progress (-130);
-                       puts ("** Bad FIT image format\n");
-                       return 1;
-               }
-               show_boot_progress (131);
                puts ("Fit image detected...\n");
 
                cnt = fit_get_size (fit_hdr);
@@ -304,8 +298,15 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 #if defined(CONFIG_FIT)
        /* This cannot be done earlier, we need complete FIT image in RAM first */
-       if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT)
-               fit_print_contents ((const void *)addr);
+       if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
+               if (!fit_check_format (fit_hdr)) {
+                       show_boot_progress (-130);
+                       puts ("** Bad FIT image format\n");
+                       return 1;
+               }
+               show_boot_progress (131);
+               fit_print_contents (fit_hdr);
+       }
 #endif
 
        /* Loading ok, update default load address */
index 0293d186ab8813a9b41ed17e8476a42d2cee030b..e4fbf29a2213d3ce278e7df60436a76e175c393f 100644 (file)
@@ -787,7 +787,7 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        char *ep;
        int rcode = 0;
 #if defined(CONFIG_FIT)
-       const void *fit_hdr;
+       const void *fit_hdr = NULL;
 #endif
 
        switch (argc) {
@@ -847,10 +847,6 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 #if defined(CONFIG_FIT)
        case IMAGE_FORMAT_FIT:
                fit_hdr = (const void *)addr;
-               if (!fit_check_format (fit_hdr)) {
-                       puts ("** Bad FIT image format\n");
-                       return 1;
-               }
                puts ("Fit image detected...\n");
 
                imsize = fit_get_size (fit_hdr);
@@ -879,8 +875,13 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 #if defined(CONFIG_FIT)
        /* This cannot be done earlier, we need complete FIT image in RAM first */
-       if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT)
-               fit_print_contents ((const void *)addr);
+       if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
+               if (!fit_check_format (fit_hdr)) {
+                       puts ("** Bad FIT image format\n");
+                       return 1;
+               }
+               fit_print_contents (fit_hdr);
+       }
 #endif
 
        /* Loading ok, update default load address */
index 65607022eb47c9bb2e8f418dd8ea96323e1647a7..97a873d1c96a517f3e96db09038f44f1ea421083 100644 (file)
@@ -367,7 +367,7 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        image_header_t *hdr;
        int rcode = 0;
 #if defined(CONFIG_FIT)
-       const void *fit_hdr;
+       const void *fit_hdr = NULL;
 #endif
 
        show_boot_progress (41);
@@ -465,12 +465,6 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 #if defined(CONFIG_FIT)
        case IMAGE_FORMAT_FIT:
                fit_hdr = (const void *)addr;
-               if (!fit_check_format (fit_hdr)) {
-                       show_boot_progress (-140);
-                       puts ("** Bad FIT image format\n");
-                       return 1;
-               }
-               show_boot_progress (141);
                puts ("Fit image detected...\n");
 
                cnt = fit_get_size (fit_hdr);
@@ -496,8 +490,15 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 #if defined(CONFIG_FIT)
        /* This cannot be done earlier, we need complete FIT image in RAM first */
-       if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT)
-               fit_print_contents ((const void *)addr);
+       if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
+               if (!fit_check_format (fit_hdr)) {
+                       show_boot_progress (-140);
+                       puts ("** Bad FIT image format\n");
+                       return 1;
+               }
+               show_boot_progress (141);
+               fit_print_contents (fit_hdr);
+       }
 #endif
 
        /* Loading ok, update default load address */
index 37198d21e8c6e1638f112a63205884317fba5af4..e20c1af3531e635db1d49caf8a1f030f25f1d5c6 100644 (file)
@@ -484,7 +484,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
        image_header_t *hdr;
        int jffs2 = 0;
 #if defined(CONFIG_FIT)
-       const void *fit_hdr;
+       const void *fit_hdr = NULL;
 #endif
 
        s = strchr(cmd, '.');
@@ -526,12 +526,6 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 #if defined(CONFIG_FIT)
        case IMAGE_FORMAT_FIT:
                fit_hdr = (const void *)addr;
-               if (!fit_check_format (fit_hdr)) {
-                       show_boot_progress (-150);
-                       puts ("** Bad FIT image format\n");
-                       return 1;
-               }
-               show_boot_progress (151);
                puts ("Fit image detected...\n");
 
                cnt = fit_get_size (fit_hdr);
@@ -564,8 +558,15 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 
 #if defined(CONFIG_FIT)
        /* This cannot be done earlier, we need complete FIT image in RAM first */
-       if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT)
-               fit_print_contents ((const void *)addr);
+       if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
+               if (!fit_check_format (fit_hdr)) {
+                       show_boot_progress (-150);
+                       puts ("** Bad FIT image format\n");
+                       return 1;
+               }
+               show_boot_progress (151);
+               fit_print_contents (fit_hdr);
+       }
 #endif
 
        /* Loading ok, update default load address */
@@ -952,7 +953,7 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        image_header_t *hdr;
        int rcode = 0;
 #if defined(CONFIG_FIT)
-       const void *fit_hdr;
+       const void *fit_hdr = NULL;
 #endif
 
        show_boot_progress (52);
@@ -1021,12 +1022,6 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 #if defined(CONFIG_FIT)
        case IMAGE_FORMAT_FIT:
                fit_hdr = (const void *)addr;
-               if (!fit_check_format (fit_hdr)) {
-                       show_boot_progress (-150);
-                       puts ("** Bad FIT image format\n");
-                       return 1;
-               }
-               show_boot_progress (151);
                puts ("Fit image detected...\n");
 
                cnt = fit_get_size (fit_hdr);
@@ -1050,8 +1045,15 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 #if defined(CONFIG_FIT)
        /* This cannot be done earlier, we need complete FIT image in RAM first */
-       if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT)
-               fit_print_contents ((const void *)addr);
+       if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
+               if (!fit_check_format (fit_hdr)) {
+                       show_boot_progress (-150);
+                       puts ("** Bad FIT image format\n");
+                       return 1;
+               }
+               show_boot_progress (151);
+               fit_print_contents (fit_hdr);
+       }
 #endif
 
        /* Loading ok, update default load address */
index 69028f3b6bd800023078fbab2f62cc4446b5702b..e648f7d6014eb1bf31f8eb972b6d222e6a582bfa 100644 (file)
@@ -212,7 +212,7 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        image_header_t *hdr;
        int rcode = 0;
 #if defined(CONFIG_FIT)
-       const void *fit_hdr;
+       const void *fit_hdr = NULL;
 #endif
 
        switch (argc) {
@@ -291,10 +291,6 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 #if defined(CONFIG_FIT)
        case IMAGE_FORMAT_FIT:
                fit_hdr = (const void *)addr;
-               if (!fit_check_format (fit_hdr)) {
-                       puts ("** Bad FIT image format\n");
-                       return 1;
-               }
                puts ("Fit image detected...\n");
 
                cnt = fit_get_size (fit_hdr);
@@ -317,8 +313,13 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 #if defined(CONFIG_FIT)
        /* This cannot be done earlier, we need complete FIT image in RAM first */
-       if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT)
-               fit_print_contents ((const void *)addr);
+       if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
+               if (!fit_check_format (fit_hdr)) {
+                       puts ("** Bad FIT image format\n");
+                       return 1;
+               }
+               fit_print_contents (fit_hdr);
+       }
 #endif
 
        /* Loading ok, update default load address */
index 9be86b874d5679798a0fb8c91308371f9516ce54..f2795d3f4034a38c445e561803dfdd1eef513a29 100644 (file)
@@ -316,7 +316,7 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        image_header_t *hdr;
        block_dev_desc_t *stor_dev;
 #if defined(CONFIG_FIT)
-       const void *fit_hdr;
+       const void *fit_hdr = NULL;
 #endif
 
        switch (argc) {
@@ -404,10 +404,6 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 #if defined(CONFIG_FIT)
        case IMAGE_FORMAT_FIT:
                fit_hdr = (const void *)addr;
-               if (!fit_check_format (fit_hdr)) {
-                       puts ("** Bad FIT image format\n");
-                       return 1;
-               }
                puts ("Fit image detected...\n");
 
                cnt = fit_get_size (fit_hdr);
@@ -430,8 +426,13 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 #if defined(CONFIG_FIT)
        /* This cannot be done earlier, we need complete FIT image in RAM first */
-       if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT)
-               fit_print_contents ((const void *)addr);
+       if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
+               if (!fit_check_format (fit_hdr)) {
+                       puts ("** Bad FIT image format\n");
+                       return 1;
+               }
+               fit_print_contents (fit_hdr);
+       }
 #endif
 
        /* Loading ok, update default load address */