]> www.infradead.org Git - users/rw/ppcboot.git/commitdiff
Made "iminfo" work with default load address, too.
authorwdenk <wdenk>
Mon, 30 Oct 2000 13:02:28 +0000 (13:02 +0000)
committerwdenk <wdenk>
Mon, 30 Oct 2000 13:02:28 +0000 (13:02 +0000)
common/cmd_bootm.c

index 0e51418724e91b4ae72856e62b584cf8aaa45ac2..c127ee6e7bd0cbf9f0a99448c00a71e5b8a637c0 100644 (file)
@@ -37,6 +37,7 @@ void run_default_command (int len, cmd_tbl_t *cmdtp, bd_t *bd, int flag);
 static void *zalloc(void *, unsigned, unsigned);
 static void zfree(void *, void *, unsigned);
 
+static void image_info (unsigned long addr);
 static void print_type (image_header_t *hdr);
 
 image_header_t header;
@@ -333,51 +334,57 @@ void do_bootd (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 void do_iminfo (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 {
        int     arg;
-       ulong   addr, data, len, checksum;
-       image_header_t *hdr = &header;
+       ulong   addr;
 
        if (argc < 2) {
-               printf ("Usage:\n%s\n", cmdtp->usage);
+               image_info (load_addr);
                return;
-       }
+       } 
 
        for (arg=1; arg <argc; ++arg) {
                addr = simple_strtoul(argv[arg], NULL, 16);
+               image_info (addr);
+       }
+}
 
-               printf ("\n## Checking Image at %08lx ...\n", addr);
+static void image_info (ulong addr)
+{
+       ulong   data, len, checksum;
+       image_header_t *hdr = &header;
 
-               /* Copy header so we can blank CRC field for re-calculation */
-               memcpy (&header, (char *)addr, sizeof(image_header_t));
+       printf ("\n## Checking Image at %08lx ...\n", addr);
 
-               if (hdr->ih_magic  != IH_MAGIC) {
-                       printf ("   Bad Magic Number\n");
-                       continue;
-               }
+       /* Copy header so we can blank CRC field for re-calculation */
+       memcpy (&header, (char *)addr, sizeof(image_header_t));
 
-               data = (ulong)&header;
-               len  = sizeof(image_header_t);
+       if (hdr->ih_magic  != IH_MAGIC) {
+               printf ("   Bad Magic Number\n");
+               return;
+       }
 
-               checksum = hdr->ih_hcrc;
-               hdr->ih_hcrc = 0;
+       data = (ulong)&header;
+       len  = sizeof(image_header_t);
 
-               if (crc32 (0, (char *)data, len) != checksum) {
-                       printf ("   Bad Header Checksum\n");
-                       continue;
-               }
+       checksum = hdr->ih_hcrc;
+       hdr->ih_hcrc = 0;
 
-               /* for multi-file images we need the data part, too */
-               print_image_hdr ((image_header_t *)addr);
+       if (crc32 (0, (char *)data, len) != checksum) {
+               printf ("   Bad Header Checksum\n");
+               return;
+       }
 
-               data = addr + sizeof(image_header_t);
-               len  = hdr->ih_size;
+       /* for multi-file images we need the data part, too */
+       print_image_hdr ((image_header_t *)addr);
 
-               printf ("   Verifying Checksum ... ");
-               if (crc32 (0, (char *)data, len) != hdr->ih_dcrc) {
-                       printf ("   Bad Data CRC\n");
-                       continue;
-               }
-               printf ("OK\n");
+       data = addr + sizeof(image_header_t);
+       len  = hdr->ih_size;
+
+       printf ("   Verifying Checksum ... ");
+       if (crc32 (0, (char *)data, len) != hdr->ih_dcrc) {
+               printf ("   Bad Data CRC\n");
+               return;
        }
+       printf ("OK\n");
 }
 #endif /* CFG_CMD_IMI */