/*
- * (C) Copyright 2000-2002
+ * (C) Copyright 2000-2003
* DENX Software Engineering
* Wolfgang Denk, wd@denx.de
* All rights reserved.
#define htonl(a) SWAP_LONG(a)
#endif /* __WIN32__ */
+#ifndef O_BINARY /* should be define'd on __WIN32__ */
+#define O_BINARY 0
+#endif
+
#include <image.h>
extern int errno;
{ IH_CPU_SH, "sh", "SuperH", },
{ IH_CPU_SPARC, "sparc", "SPARC", },
{ IH_CPU_SPARC64, "sparc64", "SPARC 64 Bit", },
+ { IH_CPU_M68K, "m68k", "MC68000", },
{ -1, "", "", },
};
{ IH_OS_PSOS, "psos", "pSOS", },
{ IH_OS_QNX, "qnx", "QNX", },
{ IH_OS_U_BOOT, "u-boot", "U-Boot", },
+ { IH_OS_RTEMS, "rtems", "RTEMS", },
+ { IH_OS_ARTOS, "artos", "ARTOS", },
{ -1, "", "", },
};
{ IH_TYPE_MULTI, "multi", "Multi-File Image", },
{ IH_TYPE_FIRMWARE, "firmware", "Firmware", },
{ IH_TYPE_SCRIPT, "script", "Script", },
+ { IH_TYPE_FILESYSTEM, "filesystem", "Filesystem Image", },
{ -1, "", "", },
};
*/
if (xflag) {
if (ep != addr + sizeof(image_header_t)) {
- fprintf (stderr, "%s: For XIP, the entry point must be the load addr + %d\n",
- cmdname, sizeof(image_header_t));
+ 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);
}
}
imagefile = *argv;
if (lflag) {
- ifd = open(imagefile, O_RDONLY);
+ ifd = open(imagefile, O_RDONLY|O_BINARY);
} else {
-#ifdef __WIN32__
ifd = open(imagefile, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0666);
-#else
- ifd = open(imagefile, O_RDWR|O_CREAT|O_TRUNC, 0666);
-#endif
}
if (ifd < 0) {
}
/* We're a bit of paranoid */
-#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__)
+#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__)
(void) fdatasync (ifd);
#else
(void) fsync (ifd);
(void) munmap((void *)ptr, sbuf.st_size);
/* We're a bit of paranoid */
-#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__)
+#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__)
(void) fdatasync (ifd);
#else
(void) fsync (ifd);
fprintf (stderr, "Adding Image %s\n", datafile);
}
- if ((dfd = open(datafile, O_RDONLY)) < 0) {
+ if ((dfd = open(datafile, O_RDONLY|O_BINARY)) < 0) {
fprintf (stderr, "%s: Can't open %s: %s\n",
cmdname, datafile, strerror(errno));
exit (EXIT_FAILURE);
printf ("Image Type: "); print_type(hdr);
printf ("Data Size: %d Bytes = %.2f kB = %.2f MB\n",
size, (double)size / 1.024e3, (double)size / 1.048576e6 );
- printf ("Load Address: 0x%08x\n", ntohl(hdr->ih_load));
- printf ("Entry Point: 0x%08x\n", ntohl(hdr->ih_ep));
+ printf ("Load Address: 0x%08X\n", ntohl(hdr->ih_load));
+ printf ("Entry Point: 0x%08X\n", ntohl(hdr->ih_ep));
if (hdr->ih_type == IH_TYPE_MULTI || hdr->ih_type == IH_TYPE_SCRIPT) {
int i, ptrs;
* if planning to do something with
* multiple files
*/
- printf (" Offset = %08x\n", pos);
+ printf (" Offset = %08X\n", pos);
}
/* copy_file() will pad the first files to even word align */
size += 3;