1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-24 18:50:49 +02:00

upgrade mkimage the current git version

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7306 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
kaloz 2007-05-23 09:42:45 +00:00
parent 84fdb577b9
commit 963c71a042
3 changed files with 21 additions and 11 deletions

View File

@ -7,7 +7,7 @@
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
#define USE_HOSTCC
#ifndef USE_HOSTCC /* Shut down "ANSI does not permit..." warnings */ #ifndef USE_HOSTCC /* Shut down "ANSI does not permit..." warnings */
#include <common.h> /* to get command definitions like CFG_CMD_JFFS2 */ #include <common.h> /* to get command definitions like CFG_CMD_JFFS2 */
#endif #endif
@ -171,7 +171,8 @@ uLong ZEXPORT crc32(crc, buf, len)
return crc ^ 0xffffffffL; return crc ^ 0xffffffffL;
} }
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) #if (CONFIG_COMMANDS & CFG_CMD_JFFS2) || \
((CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY))
/* No ones complement version. JFFS2 (and other things ?) /* No ones complement version. JFFS2 (and other things ?)
* don't use ones compliment in their CRC calculations. * don't use ones compliment in their CRC calculations.

View File

@ -75,6 +75,8 @@
#define IH_CPU_NIOS 13 /* Nios-32 */ #define IH_CPU_NIOS 13 /* Nios-32 */
#define IH_CPU_MICROBLAZE 14 /* MicroBlaze */ #define IH_CPU_MICROBLAZE 14 /* MicroBlaze */
#define IH_CPU_NIOS2 15 /* Nios-II */ #define IH_CPU_NIOS2 15 /* Nios-II */
#define IH_CPU_BLACKFIN 16 /* Blackfin */
#define IH_CPU_AVR32 17 /* AVR32 */
/* /*
* Image Types * Image Types
@ -123,6 +125,7 @@
#define IH_TYPE_FIRMWARE 5 /* Firmware Image */ #define IH_TYPE_FIRMWARE 5 /* Firmware Image */
#define IH_TYPE_SCRIPT 6 /* Script file */ #define IH_TYPE_SCRIPT 6 /* Script file */
#define IH_TYPE_FILESYSTEM 7 /* Filesystem Image (any type) */ #define IH_TYPE_FILESYSTEM 7 /* Filesystem Image (any type) */
#define IH_TYPE_FLATDT 8 /* Binary Flat Device Tree Blob */
/* /*
* Compression Types * Compression Types

View File

@ -93,6 +93,8 @@ table_entry_t arch_name[] = {
{ IH_CPU_SH, "sh", "SuperH", }, { IH_CPU_SH, "sh", "SuperH", },
{ IH_CPU_SPARC, "sparc", "SPARC", }, { IH_CPU_SPARC, "sparc", "SPARC", },
{ IH_CPU_SPARC64, "sparc64", "SPARC 64 Bit", }, { IH_CPU_SPARC64, "sparc64", "SPARC 64 Bit", },
{ IH_CPU_BLACKFIN, "blackfin", "Blackfin", },
{ IH_CPU_AVR32, "avr32", "AVR32", },
{ -1, "", "", }, { -1, "", "", },
}; };
@ -129,6 +131,7 @@ table_entry_t type_name[] = {
{ IH_TYPE_RAMDISK, "ramdisk", "RAMDisk Image", }, { IH_TYPE_RAMDISK, "ramdisk", "RAMDisk Image", },
{ IH_TYPE_SCRIPT, "script", "Script", }, { IH_TYPE_SCRIPT, "script", "Script", },
{ IH_TYPE_STANDALONE, "standalone", "Standalone Program", }, { IH_TYPE_STANDALONE, "standalone", "Standalone Program", },
{ IH_TYPE_FLATDT, "flat_dt", "Flat Device Tree", },
{ -1, "", "", }, { -1, "", "", },
}; };
@ -276,7 +279,8 @@ NXTARG: ;
*/ */
if (xflag) { if (xflag) {
if (ep != addr + sizeof(image_header_t)) { 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, cmdname,
(unsigned long)sizeof(image_header_t)); (unsigned long)sizeof(image_header_t));
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
@ -346,8 +350,9 @@ NXTARG: ;
if (crc32 (0, data, len) != checksum) { if (crc32 (0, data, len) != checksum) {
fprintf (stderr, fprintf (stderr,
"*** Warning: \"%s\" has bad header checksum!\n", "%s: ERROR: \"%s\" has bad header checksum!\n",
imagefile); cmdname, imagefile);
exit (EXIT_FAILURE);
} }
data = (char *)(ptr + sizeof(image_header_t)); data = (char *)(ptr + sizeof(image_header_t));
@ -355,8 +360,9 @@ NXTARG: ;
if (crc32 (0, data, len) != ntohl(hdr->ih_dcrc)) { if (crc32 (0, data, len) != ntohl(hdr->ih_dcrc)) {
fprintf (stderr, fprintf (stderr,
"*** Warning: \"%s\" has corrupted data!\n", "%s: ERROR: \"%s\" has corrupted data!\n",
imagefile); cmdname, imagefile);
exit (EXIT_FAILURE);
} }
/* for multi-file images we need the data part, too */ /* for multi-file images we need the data part, too */
@ -383,7 +389,7 @@ NXTARG: ;
if (opt_type == IH_TYPE_MULTI || opt_type == IH_TYPE_SCRIPT) { if (opt_type == IH_TYPE_MULTI || opt_type == IH_TYPE_SCRIPT) {
char *file = datafile; char *file = datafile;
unsigned long size; uint32_t size;
for (;;) { for (;;) {
char *sep = NULL; char *sep = NULL;
@ -440,7 +446,7 @@ NXTARG: ;
} }
/* We're a bit of paranoid */ /* 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); (void) fdatasync (ifd);
#else #else
(void) fsync (ifd); (void) fsync (ifd);
@ -490,7 +496,7 @@ NXTARG: ;
(void) munmap((void *)ptr, sbuf.st_size); (void) munmap((void *)ptr, sbuf.st_size);
/* We're a bit of paranoid */ /* 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); (void) fdatasync (ifd);
#else #else
(void) fsync (ifd); (void) fsync (ifd);
@ -628,7 +634,7 @@ print_header (image_header_t *hdr)
if (hdr->ih_type == IH_TYPE_MULTI || hdr->ih_type == IH_TYPE_SCRIPT) { if (hdr->ih_type == IH_TYPE_MULTI || hdr->ih_type == IH_TYPE_SCRIPT) {
int i, ptrs; int i, ptrs;
uint32_t pos; uint32_t pos;
unsigned long *len_ptr = (unsigned long *) ( uint32_t *len_ptr = (uint32_t *) (
(unsigned long)hdr + sizeof(image_header_t) (unsigned long)hdr + sizeof(image_header_t)
); );