X-Git-Url: http://git.ozo.com/?a=blobdiff_plain;f=tools%2Fmkimage%2Fsrc%2Fmkimage.c;h=6ba400a47e8d5af6cdbca4a2e615afe897f03166;hb=9a9d15ed063b02c1c7d786e39e593f9723c96927;hp=136075c50a42667045f0c670cc143582ae7feb62;hpb=f52d66ff00b24111f87c274d3d7085ef2e1d27b1;p=openwrt-10.03%2F.git diff --git a/tools/mkimage/src/mkimage.c b/tools/mkimage/src/mkimage.c index 136075c50..6ba400a47 100644 --- a/tools/mkimage/src/mkimage.c +++ b/tools/mkimage/src/mkimage.c @@ -19,6 +19,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA */ +#ifdef __APPLE__ +#define __FreeBSD__ 10 +#endif #include #include @@ -93,6 +96,8 @@ table_entry_t arch_name[] = { { IH_CPU_SH, "sh", "SuperH", }, { IH_CPU_SPARC, "sparc", "SPARC", }, { IH_CPU_SPARC64, "sparc64", "SPARC 64 Bit", }, + { IH_CPU_BLACKFIN, "blackfin", "Blackfin", }, + { IH_CPU_AVR32, "avr32", "AVR32", }, { -1, "", "", }, }; @@ -129,6 +134,7 @@ table_entry_t type_name[] = { { IH_TYPE_RAMDISK, "ramdisk", "RAMDisk Image", }, { IH_TYPE_SCRIPT, "script", "Script", }, { IH_TYPE_STANDALONE, "standalone", "Standalone Program", }, + { IH_TYPE_FLATDT, "flat_dt", "Flat Device Tree", }, { -1, "", "", }, }; @@ -136,6 +142,7 @@ table_entry_t comp_name[] = { { IH_COMP_NONE, "none", "uncompressed", }, { IH_COMP_BZIP2, "bzip2", "bzip2 compressed", }, { IH_COMP_GZIP, "gzip", "gzip compressed", }, + { IH_COMP_LZMA, "lzma", "lzma compressed", }, { -1, "", "", }, }; @@ -276,7 +283,8 @@ NXTARG: ; */ if (xflag) { if (ep != addr + sizeof(image_header_t)) { - fprintf (stderr, "%s: For XIP, the entry point must be the load addr + %lu\n", + fprintf (stderr, + "%s: For XIP, the entry point must be the load addr + %lu\n", cmdname, (unsigned long)sizeof(image_header_t)); exit (EXIT_FAILURE); @@ -346,8 +354,9 @@ NXTARG: ; if (crc32 (0, data, len) != checksum) { fprintf (stderr, - "*** Warning: \"%s\" has bad header checksum!\n", - imagefile); + "%s: ERROR: \"%s\" has bad header checksum!\n", + cmdname, imagefile); + exit (EXIT_FAILURE); } data = (char *)(ptr + sizeof(image_header_t)); @@ -355,8 +364,9 @@ NXTARG: ; if (crc32 (0, data, len) != ntohl(hdr->ih_dcrc)) { fprintf (stderr, - "*** Warning: \"%s\" has corrupted data!\n", - imagefile); + "%s: ERROR: \"%s\" has corrupted data!\n", + cmdname, imagefile); + exit (EXIT_FAILURE); } /* for multi-file images we need the data part, too */ @@ -383,7 +393,7 @@ NXTARG: ; if (opt_type == IH_TYPE_MULTI || opt_type == IH_TYPE_SCRIPT) { char *file = datafile; - unsigned long size; + uint32_t size; for (;;) { char *sep = NULL; @@ -440,7 +450,7 @@ NXTARG: ; } /* We're a bit of paranoid */ -#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__) && !defined(__APPLE__) +#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__) (void) fdatasync (ifd); #else (void) fsync (ifd); @@ -490,7 +500,7 @@ NXTARG: ; (void) munmap((void *)ptr, sbuf.st_size); /* We're a bit of paranoid */ -#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__) && !defined(__APPLE__) +#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__) (void) fdatasync (ifd); #else (void) fsync (ifd); @@ -628,7 +638,7 @@ print_header (image_header_t *hdr) if (hdr->ih_type == IH_TYPE_MULTI || hdr->ih_type == IH_TYPE_SCRIPT) { int i, ptrs; uint32_t pos; - unsigned long *len_ptr = (unsigned long *) ( + uint32_t *len_ptr = (uint32_t *) ( (unsigned long)hdr + sizeof(image_header_t) );