]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - common/cmd_usb.c
[new uImage] Fix erroneous use of image_get_magic() in fdc/usb cmds
[people/ms/u-boot.git] / common / cmd_usb.c
index c6b17c2ab7ad2af8d74ac4ce4c55c63e07f60dac..3f1aa7d9fee10354c9fe4e9f54d081760fa104d2 100644 (file)
@@ -311,7 +311,7 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        char *boot_device = NULL;
        char *ep;
        int dev, part=1, rcode;
-       ulong addr, cnt, checksum;
+       ulong addr, cnt;
        disk_partition_t info;
        image_header_t *hdr;
        block_dev_desc_t *stor_dev;
@@ -388,23 +388,19 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
        hdr = (image_header_t *)addr;
 
-       if (ntohl(hdr->ih_magic) != IH_MAGIC) {
+       if (!image_check_magic (hdr)) {
                printf("\n** Bad Magic Number **\n");
                return 1;
        }
 
-       checksum = ntohl(hdr->ih_hcrc);
-       hdr->ih_hcrc = 0;
-
-       if (crc32 (0, (uchar *)hdr, sizeof(image_header_t)) != checksum) {
+       if (!image_check_hcrc (hdr)) {
                puts ("\n** Bad Header Checksum **\n");
                return 1;
        }
-       hdr->ih_hcrc = htonl(checksum); /* restore checksum for later use */
 
-       print_image_hdr (hdr);
+       image_print_contents (hdr);
 
-       cnt = (ntohl(hdr->ih_size) + sizeof(image_header_t));
+       cnt = image_get_image_size (hdr);
        cnt += info.blksz - 1;
        cnt /= info.blksz;
        cnt -= 1;