diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile | 16 | ||||
-rw-r--r-- | tools/bmp_logo.c | 13 | ||||
-rw-r--r-- | tools/gdb/Makefile | 2 | ||||
-rw-r--r-- | tools/img2srec.c | 3 | ||||
-rw-r--r-- | tools/imls/Makefile | 4 | ||||
-rw-r--r-- | tools/mingw_support.h | 3 | ||||
-rw-r--r-- | tools/mkimage.c | 14 | ||||
-rw-r--r-- | tools/mkimage.h | 33 | ||||
-rw-r--r-- | tools/os_support.c | 1 | ||||
-rw-r--r-- | tools/os_support.h | 2 | ||||
-rw-r--r-- | tools/ubsha1.c | 13 |
11 files changed, 22 insertions, 82 deletions
diff --git a/tools/Makefile b/tools/Makefile index 43c284c..b5a1e39 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -36,18 +36,18 @@ TOOLSUBDIRS = # -multiply_defined suppress option to turn off this error. # -HOST_CFLAGS = -Wall +HOSTCFLAGS = -Wall HOST_LDFLAGS = ifeq ($(HOSTOS)-$(HOSTARCH),darwin-ppc) -HOST_CFLAGS += -traditional-cpp +HOSTCFLAGS += -traditional-cpp HOST_LDFLAGS += -multiply_defined suppress else -HOST_CFLAGS += -pedantic +HOSTCFLAGS += -pedantic endif ifeq ($(HOSTOS),cygwin) -HOST_CFLAGS += -ansi +HOSTCFLAGS += -ansi endif # @@ -69,9 +69,13 @@ include $(TOPDIR)/config.mk BIN_FILES-$(CONFIG_CMD_LOADS) += img2srec$(SFX) BIN_FILES-y += mkimage$(SFX) BIN_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc$(SFX) +BIN_FILES-$(CONFIG_ENV_IS_IN_DATAFLASH) += envcrc$(SFX) BIN_FILES-$(CONFIG_ENV_IS_IN_EEPROM) += envcrc$(SFX) BIN_FILES-$(CONFIG_ENV_IS_IN_FLASH) += envcrc$(SFX) +BIN_FILES-$(CONFIG_ENV_IS_IN_ONENAND) += envcrc$(SFX) +BIN_FILES-$(CONFIG_ENV_IS_IN_NAND) += envcrc$(SFX) BIN_FILES-$(CONFIG_ENV_IS_IN_NVRAM) += envcrc$(SFX) +BIN_FILES-$(CONFIG_ENV_IS_IN_SPI_FLASH) += envcrc$(SFX) BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX) BIN_FILES-$(CONFIG_CMD_NET) += gen_eth_addr$(SFX) BIN_FILES-$(CONFIG_LCD_LOGO) += bmp_logo$(SFX) @@ -144,7 +148,7 @@ CPPFLAGS = -idirafter $(SRCTREE)/include \ -I $(SRCTREE)/tools \ -DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC \ -D__KERNEL_STRICT_NAMES -CFLAGS = $(HOST_CFLAGS) $(CPPFLAGS) -O +CFLAGS = $(HOSTCFLAGS) $(CPPFLAGS) -O # No -pedantic switch to avoid libfdt compilation warnings FIT_CFLAGS = -Wall $(CPPFLAGS) -O @@ -223,7 +227,7 @@ else $(MAKE) \ HOSTOS=$(HOSTOS) \ HOSTARCH=$(HOSTARCH) \ - HOST_CFLAGS="$(HOST_CFLAGS)" \ + HOSTCFLAGS="$(HOSTCFLAGS)" \ HOST_LDFLAGS="$(HOST_LDFLAGS)" \ -C $$dir || exit 1 ; \ done diff --git a/tools/bmp_logo.c b/tools/bmp_logo.c index e8dd8c8..47228d2 100644 --- a/tools/bmp_logo.c +++ b/tools/bmp_logo.c @@ -1,15 +1,4 @@ -#include <stdio.h> -#include <stdlib.h> - -#if defined(__linux__) -#include <stdint.h> -#else -#ifdef __CYGWIN__ -#include "elf.h" -#else -#include <inttypes.h> -#endif -#endif +#include "compiler.h" typedef struct bitmap_s { /* bitmap description */ uint16_t width; diff --git a/tools/gdb/Makefile b/tools/gdb/Makefile index c44cc8a..0a5687d 100644 --- a/tools/gdb/Makefile +++ b/tools/gdb/Makefile @@ -38,7 +38,7 @@ BINS := $(addprefix $(obj),$(BINS)) # Use native tools and options # CPPFLAGS = -I$(BFD_ROOT_DIR)/include -CFLAGS = $(HOST_CFLAGS) -O $(CPPFLAGS) +CFLAGS = $(HOSTCFLAGS) -O $(CPPFLAGS) CC = $(HOSTCC) MAKEDEPEND = makedepend diff --git a/tools/img2srec.c b/tools/img2srec.c index b04abbd..f10379f 100644 --- a/tools/img2srec.c +++ b/tools/img2srec.c @@ -52,6 +52,7 @@ | INCLUDES |*************************************************************************/ +#include "os_support.h" #include <stddef.h> #include <stdio.h> #include <stdlib.h> @@ -61,8 +62,6 @@ #include <unistd.h> #include <errno.h> -extern int errno; - /************************************************************************* | DEFINES |*************************************************************************/ diff --git a/tools/imls/Makefile b/tools/imls/Makefile index 04ab31a..59b928c 100644 --- a/tools/imls/Makefile +++ b/tools/imls/Makefile @@ -19,7 +19,7 @@ include $(TOPDIR)/config.mk -HOST_CFLAGS = -Wall -pedantic +HOSTCFLAGS = -Wall -pedantic # Generated executable files BIN_FILES-y += imls @@ -57,7 +57,7 @@ CPPFLAGS = -idirafter $(SRCTREE)/include \ -I $(SRCTREE)/libfdt \ -I $(SRCTREE)/tools \ -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES -CFLAGS = $(HOST_CFLAGS) $(CPPFLAGS) -O +CFLAGS = $(HOSTCFLAGS) $(CPPFLAGS) -O # No -pedantic switch to avoid libfdt compilation warnings FIT_CFLAGS = -Wall $(CPPFLAGS) -O diff --git a/tools/mingw_support.h b/tools/mingw_support.h index 1fb6c93..9e45e64 100644 --- a/tools/mingw_support.h +++ b/tools/mingw_support.h @@ -34,9 +34,6 @@ #define MAP_SHARED 0x01 /* Share changes */ #define MAP_PRIVATE 0x02 /* Changes are private */ -/* Return value of `mmap' in case of an error */ -#define MAP_FAILED ((void *) -1) - /* Windows 64-bit access macros */ #define LODWORD(x) ((DWORD)((DWORDLONG)(x))) #define HIDWORD(x) ((DWORD)(((DWORDLONG)(x) >> 32) & 0xffffffff)) diff --git a/tools/mkimage.c b/tools/mkimage.c index 967fe9a..02cdb95 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -25,12 +25,6 @@ #include "mkimage.h" #include <image.h> -extern int errno; - -#ifndef MAP_FAILED -#define MAP_FAILED (void *)(-1) -#endif - extern unsigned long crc32 (unsigned long crc, const char *buf, unsigned int len); static void copy_file (int, const char *, int); static void usage (void); @@ -502,7 +496,7 @@ image_verify_header (char *ptr, int image_size) */ memcpy (hdr, ptr, sizeof(image_header_t)); - if (ntohl(hdr->ih_magic) != IH_MAGIC) { + if (be32_to_cpu(hdr->ih_magic) != IH_MAGIC) { fprintf (stderr, "%s: Bad Magic Number: \"%s\" is no valid image\n", cmdname, imagefile); @@ -512,8 +506,8 @@ image_verify_header (char *ptr, int image_size) data = (char *)hdr; len = sizeof(image_header_t); - checksum = ntohl(hdr->ih_hcrc); - hdr->ih_hcrc = htonl(0); /* clear for re-calculation */ + checksum = be32_to_cpu(hdr->ih_hcrc); + hdr->ih_hcrc = cpu_to_be32(0); /* clear for re-calculation */ if (crc32 (0, data, len) != checksum) { fprintf (stderr, @@ -525,7 +519,7 @@ image_verify_header (char *ptr, int image_size) data = ptr + sizeof(image_header_t); len = image_size - sizeof(image_header_t) ; - if (crc32 (0, data, len) != ntohl(hdr->ih_dcrc)) { + if (crc32 (0, data, len) != be32_to_cpu(hdr->ih_dcrc)) { fprintf (stderr, "%s: ERROR: \"%s\" has corrupted data!\n", cmdname, imagefile); diff --git a/tools/mkimage.h b/tools/mkimage.h index c8df6e1..70c53ad 100644 --- a/tools/mkimage.h +++ b/tools/mkimage.h @@ -26,14 +26,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#ifndef __WIN32__ -#include <netinet/in.h> /* for host / network byte order conversions */ -#endif -#ifdef __MINGW32__ -#include <stdint.h> -#else -#include <sys/mman.h> -#endif #include <sys/stat.h> #include <time.h> #include <unistd.h> @@ -53,28 +45,3 @@ #define MKIMAGE_DEFAULT_DTC_OPTIONS "-I dts -O dtb -p 500" #define MKIMAGE_MAX_DTC_CMDLINE_LEN 512 #define MKIMAGE_DTC "dtc" /* assume dtc is in $PATH */ - -#if defined(__BEOS__) || defined(__NetBSD__) || defined(__APPLE__) -#include <inttypes.h> -#endif - -#ifdef __WIN32__ -typedef unsigned int __u32; - -#define SWAP_LONG(x) \ - ((__u32)( \ - (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \ - (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \ - (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \ - (((__u32)(x) & (__u32)0xff000000UL) >> 24) )) -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; - -#define ntohl(a) SWAP_LONG(a) -#define htonl(a) SWAP_LONG(a) -#endif /* __WIN32__ */ - -#ifndef O_BINARY /* should be define'd on __WIN32__ */ -#define O_BINARY 0 -#endif diff --git a/tools/os_support.c b/tools/os_support.c index 001fe64..5b919aa 100644 --- a/tools/os_support.c +++ b/tools/os_support.c @@ -19,6 +19,7 @@ /* * Include additional files required for supporting different operating systems */ +#include "compiler.h" #ifdef __MINGW32__ #include "mingw_support.c" #endif diff --git a/tools/os_support.h b/tools/os_support.h index f6f86b0..7bf930e 100644 --- a/tools/os_support.h +++ b/tools/os_support.h @@ -19,6 +19,8 @@ #ifndef __OS_SUPPORT_H_ #define __OS_SUPPORT_H_ +#include "compiler.h" + /* * Include additional files required for supporting different operating systems */ diff --git a/tools/ubsha1.c b/tools/ubsha1.c index c4203ed..9774eea 100644 --- a/tools/ubsha1.c +++ b/tools/ubsha1.c @@ -28,9 +28,6 @@ #include <fcntl.h> #include <errno.h> #include <string.h> -#ifndef __MINGW32__ -#include <sys/mman.h> -#endif #include <sys/stat.h> #include "sha1.h" @@ -40,16 +37,6 @@ #include <config.h> #undef __ASSEMBLY__ -#ifndef O_BINARY /* should be define'd on __WIN32__ */ -#define O_BINARY 0 -#endif - -#ifndef MAP_FAILED -#define MAP_FAILED (-1) -#endif - -extern int errno; - extern void sha1_csum (unsigned char *input, int ilen, unsigned char output[20]); int main (int argc, char **argv) |