diff options
author | Marian Balakowicz <m8@semihalf.com> | 2008-01-08 18:14:09 +0100 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2008-02-07 01:12:53 +0100 |
commit | b97a2a0a21f279d66de8a9bdbfe21920968bcb1c (patch) | |
tree | 7746eae37d3a468f3471cd303156920637445350 /common/cmd_usb.c | |
parent | ed29bc4e8142b46b626f67524207b36e43d9aad6 (diff) | |
download | u-boot-imx-b97a2a0a21f279d66de8a9bdbfe21920968bcb1c.zip u-boot-imx-b97a2a0a21f279d66de8a9bdbfe21920968bcb1c.tar.gz u-boot-imx-b97a2a0a21f279d66de8a9bdbfe21920968bcb1c.tar.bz2 |
[new uImage] Define a API for image handling operations
- Add inline helper macros for basic header processing
- Move common non inline code common/image.c
- Replace direct header access with the API routines
- Rename IH_CPU_* to IH_ARCH_*
Signed-off-by: Marian Balakowicz <m8@semihalf.com>
Diffstat (limited to 'common/cmd_usb.c')
-rw-r--r-- | common/cmd_usb.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/common/cmd_usb.c b/common/cmd_usb.c index c6b17c2..db2e754 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -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_get_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); - cnt = (ntohl(hdr->ih_size) + sizeof(image_header_t)); + cnt = image_get_image_size (hdr); cnt += info.blksz - 1; cnt /= info.blksz; cnt -= 1; |