]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/cmd_doc.c
[new uImage] Update naming convention for bootm/uImage related code
[karo-tx-uboot.git] / common / cmd_doc.c
index 9814d754fb7adf5ab8d07cd1b071656e26a04c45..293b1aa6745eab3fc6c3cc5eb24cdc72a630f7cf 100644 (file)
@@ -11,9 +11,6 @@
 #include <command.h>
 #include <malloc.h>
 #include <asm/io.h>
-
-#if (CONFIG_COMMANDS & CFG_CMD_DOC)
-
 #include <linux/mtd/nftl.h>
 #include <linux/mtd/doc2000.h>
 
@@ -264,17 +261,29 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        }
        show_boot_progress (38);
 
-       hdr = (image_header_t *)addr;
+       switch (genimg_get_format ((void *)addr)) {
+       case IMAGE_FORMAT_LEGACY:
+               hdr = (image_header_t *)addr;
 
-       if (hdr->ih_magic == IH_MAGIC) {
+               if (image_check_magic (hdr)) {
 
-               print_image_hdr (hdr);
+                       image_print_contents (hdr);
 
-               cnt = (ntohl(hdr->ih_size) + sizeof(image_header_t));
-               cnt -= SECTORSIZE;
-       } else {
-               puts ("\n** Bad Magic Number **\n");
-               show_boot_progress (-39);
+                       cnt = image_get_image_size (hdr);
+                       cnt -= SECTORSIZE;
+               } else {
+                       puts ("\n** Bad Magic Number **\n");
+                       show_boot_progress (-39);
+                       return 1;
+               }
+               break;
+#if defined(CONFIG_FIT)
+       case IMAGE_FORMAT_FIT:
+               fit_unsupported ("docboot");
+               return 1;
+#endif
+       default:
+               puts ("** Unknown image type\n");
                return 1;
        }
        show_boot_progress (39);
@@ -1607,5 +1616,3 @@ void doc_probe(unsigned long physadr)
                puts ("No DiskOnChip found\n");
        }
 }
-
-#endif /* (CONFIG_COMMANDS & CFG_CMD_DOC) */