Skip to contentSkip to conversation

tools/Makefile cleanup and win32 tool support

PATCH Superseded Peter Tyser 5 participants 40 messages Mar 12, 2009 – Mar 23, 2009 Kbuild

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover tools/Makefile cleanup and win32 tool support

This patch series attempts to do 2 things:
1. Add support for generating win32 versions of the tools in tools/
2. Cleanup tools/Makefile somewhat

In the process of #1 I couldn't help but work on #2 a bit:) Let me know if people would prefer the patches split up.

The win32 tools support is based on the patch found in the email thread "Add native win32 mkimage support". It is different from the original patch in that it:
1. Supports all tools in tools/ (original only supported mkimage)
2. Uses common swap routines instead of re-implementing
3. Got rid of MINGW_COMPILE variable and used HOST* variables instead
4. Updated top-level Makefile to remove all generated *.exe files

Changes since v1:
- Made changes recommended by Mike Frysinger
* Rewordings, generic os_support.[ch] files, style changes, define __KERNEL_STRICT_NAMES for tool builds
- Removed symlinking of header/source files into tools/
* The original code created build rules for files to be symlinked into the tools directory which had some shortcomings:
- 2 make rules for every file - 1 for linking, 1 for compilation
- Ugly clean target (rm specific files which were symlinks)
- dependencies weren't auto-generated
- Auto-generated dependencies for tools/ files
- Remove individual file build rules in favor of a few generic build rules
- Cleaned up HOSTARCH, HOSTOS, HOST_CFLAGS, and HOST_LDFLAGS
- Rebased on TOT

Peter Tyser (26):
Makefile: Make autoconf.mk a dependency of the depend target
Makefile: Add removal of *.exe files to clean target common/Makefile: Conditionally compile env_embedded.o elf.h: Use stdint.h to provide standard typedefs for WIN32
gen_eth_addr: Use POSIX rand() and srand() tools/Makefile: Remove HOSTARCH HOSTOS defines tools/Makefile: Remove inappropriate double-tabs tools/Makefile: Split variable declarations into multiple lines tools/Makefile: Build bmp_logo only when LCD or VIDEO logos are
enabled
tools/Makefile: Make img2srec dependent upon CONFIG_CMD_LOADS tools/Makefile: Make ubsha1 dependent upon CONFIG_SHA1_CHECK_UB_IMG tools/Makefile: Make inca-swap-bytes dependent on CONFIG_INCA_IP tools/Makefile: Make envcrc dependent upon CONFIG_ENV_IS_EMBEDDED tools/Makefile: Make gen_eth_addr dependent upon CONFIG_CMD_NET tools/Makefile: Compile ncb when CONFIG_NETCONSOLE tools/Makefile: Add tools/ to the include search path tools/Makefile: Give precedence to U-Boot's include directory tools/Makefile: Add libfdt/ to the include search path tools/Makefile: Remove symlinks for fdt targets tools/Makefile: Dynamically generate libfdt object dependencies tools/Makefile: Remove symlinks for remaining source files tools/Makefile: Use auto-generated object file dependencies tools/Makefile: Create generic build rules tools/Makefile: Simplify HOST_CFLAGS/HOST_LDFLAGS generation Add support for building native win32 tools
Delete now unused tools/Makefile.win32

 Makefile              |   22 ++--
 README                |   10 ++
 common/Makefile       |    2 +-
 doc/README.NetConsole |    6 +-
 include/elf.h         |    7 +-
 include/image.h       |    2 +
 include/libfdt_env.h  |   12 ++
 tools/Makefile        |  314 ++++++++++++++++++-------------------------------
 tools/Makefile.win32  |   37 ------
 tools/gen_eth_addr.c  |    6 +-
 tools/mingw_support.c |   79 ++++++++++++
 tools/mingw_support.h |   51 ++++++++
 tools/mkimage.h       |    7 +-
 tools/os_support.c    |   24 ++++
 tools/os_support.h    |   29 +++++
 tools/ubsha1.c        |    3 +
 16 files changed, 349 insertions(+), 262 deletions(-)
 delete mode 100644 tools/Makefile.win32
 create mode 100644 tools/mingw_support.c
 create mode 100644 tools/mingw_support.h
 create mode 100644 tools/os_support.c
 create mode 100644 tools/os_support.h
#1 lore raw

PATCH v2 1/26 Makefile: Make autoconf.mk a dependency of the depend target

The original code did not generate autoconf.mk until after some targets dependencies had already been calculated, for example the directories in the SUBDIRS variable

---
 Makefile |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
Makefile +8 -8
index e8b4c13..6f17ed1 100644
@@ -345,31 +345,31 @@ $(obj)u-boot:		depend $(SUBDIRS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT)
 			--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
 			-Map u-boot.map -o u-boot
 
-$(OBJS):	depend $(obj)include/autoconf.mk
+$(OBJS):	depend
 		$(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
 
-$(LIBS):	depend $(obj)include/autoconf.mk $(SUBDIRS)
+$(LIBS):	depend $(SUBDIRS)
 		$(MAKE) -C $(dir $(subst $(obj),,$@))
 
-$(LIBBOARD):	depend $(LIBS) $(obj)include/autoconf.mk
+$(LIBBOARD):	depend $(LIBS)
 		$(MAKE) -C $(dir $(subst $(obj),,$@))
 
-$(SUBDIRS):	depend $(obj)include/autoconf.mk
+$(SUBDIRS):	depend
 		$(MAKE) -C $@ all
 
-$(LDSCRIPT):	depend $(obj)include/autoconf.mk
+$(LDSCRIPT):	depend
 		$(MAKE) -C $(dir $@) $(notdir $@)
 
 $(NAND_SPL):	$(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
 		$(MAKE) -C nand_spl/board/$(BOARDDIR) all
 
-$(U_BOOT_NAND):	$(NAND_SPL) $(obj)u-boot.bin $(obj)include/autoconf.mk
+$(U_BOOT_NAND):	$(NAND_SPL) $(obj)u-boot.bin
 		cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
 
 $(ONENAND_IPL):	$(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
 		$(MAKE) -C onenand_ipl/board/$(BOARDDIR) all
 
-$(U_BOOT_ONENAND):	$(ONENAND_IPL) $(obj)u-boot.bin $(obj)include/autoconf.mk
+$(U_BOOT_ONENAND):	$(ONENAND_IPL) $(obj)u-boot.bin
 		cat $(obj)onenand_ipl/onenand-ipl-2k.bin $(obj)u-boot.bin > $(obj)u-boot-onenand.bin
 		cat $(obj)onenand_ipl/onenand-ipl-4k.bin $(obj)u-boot.bin > $(obj)u-boot-flexonenand.bin
 
@@ -391,7 +391,7 @@ updater:
 env:
 		$(MAKE) -C tools/env all MTD_VERSION=${MTD_VERSION} || exit 1
 
-depend dep:	$(TIMESTAMP_FILE) $(VERSION_FILE)
+depend dep:	$(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
 		for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir _depend ; done
 
 TAG_SUBDIRS += include
Signature · 1 line
1.6.0.2.GIT
#2 lore raw

PATCH v2 2/26 Makefile: Add removal of *.exe files to clean target

---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
index 6f17ed1..b68de1c 100644
@@ -3470,7 +3470,7 @@ clean:
 	@rm -f $(obj)api_examples/demo $(TIMESTAMP_FILE) $(VERSION_FILE)
 	@find $(OBJTREE) -type f \
 		\( -name 'core' -o -name '*.bak' -o -name '*~' \
-		-o -name '*.o'	-o -name '*.a'	\) -print \
+		-o -name '*.o'	-o -name '*.a' -o -name '*.exe'	\) -print \
 		| xargs rm -f
 
 clobber:	clean
Signature · 1 line
1.6.0.2.GIT
#3 lore raw

PATCH v2 3/26 common/Makefile: Conditionally compile env_embedded.o

---
 common/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/Makefile +1 -1
index f13cd11..f81f3d8 100644
@@ -51,7 +51,7 @@ COBJS-y += cmd_nvedit.o
 COBJS-y += env_common.o
 COBJS-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o
 COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o
-COBJS-y += env_embedded.o
+COBJS-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o
 COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
 COBJS-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
 COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o
Signature · 1 line
1.6.0.2.GIT
#4 lore raw

PATCH v2 4/26 elf.h: Use stdint.h to provide standard typedefs for WIN32

The original code provided an incomplete set of typedefs for WIN32 compiles and replicated the standard typedefs that are already provided by stdint.h

---
 include/elf.h |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
include/elf.h +1 -6
index a9839df..f640388 100644
@@ -39,13 +39,8 @@
     defined(__sun__)	 || \
     defined(__APPLE__)
 #include <inttypes.h>
-#elif defined(__linux__) && defined(USE_HOSTCC)
+#elif (defined(__linux__) && defined(USE_HOSTCC)) || defined(__WIN32__)
 #include <stdint.h>
-#elif defined(__WIN32__)
-#include <unistd.h>
-typedef	 unsigned char	 uint8_t;
-typedef	 unsigned short  uint16_t;
-typedef	 unsigned int	 uint32_t;
 #endif
 
 /*
Signature · 1 line
1.6.0.2.GIT
#5 lore raw

PATCH v2 5/26 gen_eth_addr: Use POSIX rand() and srand()

Replace random()/srandom() use with rand()/srand() to support compilation with the mingw toolchain. The rand()/srand() functions are generally more common and are functionally equivalent to the original random()/srandom() calls.

---
 tools/gen_eth_addr.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
tools/gen_eth_addr.c +3 -3
index 75be385..429b20d 100644
@@ -31,15 +31,15 @@ main(int argc, char *argv[])
 {
     unsigned long ethaddr_low, ethaddr_high;
 
-    srandom(time(0) | getpid());
+    srand(time(0) | getpid());
 
     /*
      * setting the 2nd LSB in the most significant byte of
      * the address makes it a locally administered ethernet
      * address
      */
-    ethaddr_high = (random() & 0xfeff) | 0x0200;
-    ethaddr_low = random();
+    ethaddr_high = (rand() & 0xfeff) | 0x0200;
+    ethaddr_low = rand();
 
     printf("%02lx:%02lx:%02lx:%02lx:%02lx:%02lx\n",
 	ethaddr_high >> 8, ethaddr_high & 0xff,
Signature · 1 line
1.6.0.2.GIT
#6 lore raw

PATCH v2 6/26 tools/Makefile: Remove HOSTARCH HOSTOS defines

The values of HOSTARCH and HOSTOS which are exported from the top-level Makefile should be used

---
 tools/Makefile |   12 ------------
 1 files changed, 0 insertions(+), 12 deletions(-)
tools/Makefile +0 -12
index 9e9ee15..e87daaf 100644
@@ -51,18 +51,6 @@ endif
 
 #-------------------------------------------------------------------------
 
-HOSTARCH := $(shell uname -m | \
-	sed -e s/i.86/i386/ \
-	    -e s/sun4u/sparc64/ \
-	    -e s/arm.*/arm/ \
-	    -e s/sa110/arm/ \
-	    -e s/powerpc/ppc/ \
-	    -e s/Power\ Macintosh/ppc/ \
-	    -e s/macppc/ppc/)
-
-HOSTOS := $(shell uname -s | tr A-Z a-z | \
-	sed -e 's/\(cygwin\).*/cygwin/')
-
 TOOLSUBDIRS =
 
 #
Signature · 1 line
1.6.0.2.GIT
#7 lore raw

PATCH v2 7/26 tools/Makefile: Remove inappropriate double-tabs

---
 tools/Makefile |  153 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 77 insertions(+), 76 deletions(-)
tools/Makefile +77 -76
index e87daaf..4219aef 100644
@@ -126,164 +126,165 @@ MAKEDEPEND = makedepend
 all:	$(obj).depend $(BINS) $(LOGO_H) subdirs
 
 $(obj)envcrc$(SFX):	$(obj)envcrc.o $(obj)crc32.o $(obj)env_embedded.o $(obj)sha1.o
-		$(CC) $(CFLAGS) -o $@ $^
+	$(CC) $(CFLAGS) -o $@ $^
 
 $(obj)ubsha1$(SFX):	$(obj)ubsha1.o $(obj)sha1.o
-		$(CC) $(CFLAGS) -o $@ $^
+	$(CC) $(CFLAGS) -o $@ $^
 
 $(obj)img2srec$(SFX):	$(obj)img2srec.o
-		$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
-		$(STRIP) $@
+	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
+	$(STRIP) $@
 
-$(obj)mkimage$(SFX):	$(obj)mkimage.o $(obj)crc32.o $(obj)image.o $(obj)md5.o $(obj)sha1.o $(LIBFDT_OBJ_FILES)
-		$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
-		$(STRIP) $@
+$(obj)mkimage$(SFX):	$(obj)mkimage.o $(obj)crc32.o $(obj)image.o $(obj)md5.o \
+			$(obj)sha1.o $(LIBFDT_OBJ_FILES)
+	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
+	$(STRIP) $@
 
 $(obj)ncb$(SFX):	$(obj)ncb.o
-		$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
-		$(STRIP) $@
+	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
+	$(STRIP) $@
 
 $(obj)gen_eth_addr$(SFX):	$(obj)gen_eth_addr.o
-		$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
-		$(STRIP) $@
+	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
+	$(STRIP) $@
 
 $(obj)bmp_logo$(SFX):	$(obj)bmp_logo.o
-		$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
-		$(STRIP) $@
+	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
+	$(STRIP) $@
 
 $(obj)inca-swap-bytes$(SFX):	$(obj)inca-swap-bytes.o
-		$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
-		$(STRIP) $@
+	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
+	$(STRIP) $@
 
 $(obj)mpc86x_clk$(SFX):	$(obj)mpc86x_clk.o
-		$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
-		$(STRIP) $@
+	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
+	$(STRIP) $@
 
 $(obj)bin2header$(SFX): $(obj)bin2header.o
-		$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
-		$(STRIP) $@
+	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
+	$(STRIP) $@
 
 $(obj)envcrc.o:	$(src)envcrc.c
-		$(CC) -g $(CFLAGS) -c -o $@ $<
+	$(CC) -g $(CFLAGS) -c -o $@ $<
 
 $(obj)ubsha1.o:	$(src)ubsha1.c
-		$(CC) -g $(CFLAGS) -c -o $@ $<
+	$(CC) -g $(CFLAGS) -c -o $@ $<
 
 $(obj)crc32.o:	$(obj)crc32.c
-		$(CC) -g $(CFLAGS) -c -o $@ $<
+	$(CC) -g $(CFLAGS) -c -o $@ $<
 
 $(obj)md5.o:	$(obj)md5.c
-		$(CC) -g $(CFLAGS) -c -o $@ $<
+	$(CC) -g $(CFLAGS) -c -o $@ $<
 
 $(obj)sha1.o:	$(obj)sha1.c
-		$(CC) -g $(CFLAGS) -c -o $@ $<
+	$(CC) -g $(CFLAGS) -c -o $@ $<
 
 $(obj)image.o:	$(obj)image.c
-		$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
 $(obj)mkimage.o:	$(src)mkimage.c
-		$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
 $(obj)ncb.o:		$(src)ncb.c
-		$(CC) -g $(CFLAGS) -c -o $@ $<
+	$(CC) -g $(CFLAGS) -c -o $@ $<
 
 $(obj)gen_eth_addr.o:	$(src)gen_eth_addr.c
-		$(CC) -g $(CFLAGS) -c -o $@ $<
+	$(CC) -g $(CFLAGS) -c -o $@ $<
 
 $(obj)inca-swap-bytes.o:	$(src)inca-swap-bytes.c
-		$(CC) -g $(CFLAGS) -c -o $@ $<
+	$(CC) -g $(CFLAGS) -c -o $@ $<
 
 $(obj)mpc86x_clk.o:	$(src)mpc86x_clk.c
-		$(CC) -g $(CFLAGS) -c -o $@ $<
+	$(CC) -g $(CFLAGS) -c -o $@ $<
 
 $(obj)fdt.o:	$(obj)fdt.c
-		$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
 $(obj)fdt_ro.o:	$(obj)fdt_ro.c
-		$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
 $(obj)fdt_rw.o:	$(obj)fdt_rw.c
-		$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
 $(obj)fdt_strerror.o:	$(obj)fdt_strerror.c
-		$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
 $(obj)fdt_wip.o:	$(obj)fdt_wip.c
-		$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
 subdirs:
 ifeq ($(TOOLSUBDIRS),)
-		@:
+	@:
 else
-		@for dir in $(TOOLSUBDIRS) ; do \
-		    $(MAKE) \
-			HOSTOS=$(HOSTOS) \
-			HOSTARCH=$(HOSTARCH) \
-			HOST_CFLAGS="$(HOST_CFLAGS)" \
-			HOST_LDFLAGS="$(HOST_LDFLAGS)" \
-			-C $$dir || exit 1 ; \
-		done
+	@for dir in $(TOOLSUBDIRS) ; do \
+	    $(MAKE) \
+		HOSTOS=$(HOSTOS) \
+		HOSTARCH=$(HOSTARCH) \
+		HOST_CFLAGS="$(HOST_CFLAGS)" \
+		HOST_LDFLAGS="$(HOST_LDFLAGS)" \
+		-C $$dir || exit 1 ; \
+	done
 endif
 
 $(obj)env_embedded.c:
-		@rm -f $(obj)env_embedded.c
-		ln -s $(src)../common/env_embedded.c $(obj)env_embedded.c
+	@rm -f $(obj)env_embedded.c
+	ln -s $(src)../common/env_embedded.c $(obj)env_embedded.c
 
 $(obj)env_embedded.o:	$(obj)env_embedded.c
-		$(CC) -g $(HOST_ENVIRO_CFLAGS) $(CPPFLAGS) -c -o $@ $<
+	$(CC) -g $(HOST_ENVIRO_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 $(obj)zlib.h:
-		@rm -f $@
-		ln -s $(src)../include/zlib.h $@
+	@rm -f $@
+	ln -s $(src)../include/zlib.h $@
 
 $(obj)crc32.c: $(obj)zlib.h
-		@rm -f $(obj)crc32.c
-		ln -s $(src)../lib_generic/crc32.c $(obj)crc32.c
+	@rm -f $(obj)crc32.c
+	ln -s $(src)../lib_generic/crc32.c $(obj)crc32.c
 
 $(obj)md5.c:
-		@rm -f $(obj)md5.c
-		ln -s $(src)../lib_generic/md5.c $(obj)md5.c
+	@rm -f $(obj)md5.c
+	ln -s $(src)../lib_generic/md5.c $(obj)md5.c
 
 $(obj)sha1.c:
-		@rm -f $(obj)sha1.c
-		ln -s $(src)../lib_generic/sha1.c $(obj)sha1.c
+	@rm -f $(obj)sha1.c
+	ln -s $(src)../lib_generic/sha1.c $(obj)sha1.c
 
 $(obj)image.c:
-		@rm -f $(obj)image.c
-		ln -s $(src)../common/image.c $(obj)image.c
-		if [ ! -f $(obj)mkimage.h ] ; then \
-			ln -s $(src)../tools/mkimage.h $(obj)mkimage.h; \
-		fi
-		if [ ! -f $(obj)fdt_host.h ] ; then \
-			ln -s $(src)../tools/fdt_host.h $(obj)fdt_host.h; \
-		fi
+	@rm -f $(obj)image.c
+	ln -s $(src)../common/image.c $(obj)image.c
+	if [ ! -f $(obj)mkimage.h ] ; then \
+		ln -s $(src)../tools/mkimage.h $(obj)mkimage.h; \
+	fi
+	if [ ! -f $(obj)fdt_host.h ] ; then \
+		ln -s $(src)../tools/fdt_host.h $(obj)fdt_host.h; \
+	fi
 
 $(obj)fdt.c:	$(obj)libfdt_internal.h
-		@rm -f $(obj)fdt.c
-		ln -s $(src)../libfdt/fdt.c $(obj)fdt.c
+	@rm -f $(obj)fdt.c
+	ln -s $(src)../libfdt/fdt.c $(obj)fdt.c
 
 $(obj)fdt_ro.c:	$(obj)libfdt_internal.h
-		@rm -f $(obj)fdt_ro.c
-		ln -s $(src)../libfdt/fdt_ro.c $(obj)fdt_ro.c
+	@rm -f $(obj)fdt_ro.c
+	ln -s $(src)../libfdt/fdt_ro.c $(obj)fdt_ro.c
 
 $(obj)fdt_rw.c:	$(obj)libfdt_internal.h
-		@rm -f $(obj)fdt_rw.c
-		ln -s $(src)../libfdt/fdt_rw.c $(obj)fdt_rw.c
+	@rm -f $(obj)fdt_rw.c
+	ln -s $(src)../libfdt/fdt_rw.c $(obj)fdt_rw.c
 
 $(obj)fdt_strerror.c:	$(obj)libfdt_internal.h
-		@rm -f $(obj)fdt_strerror.c
-		ln -s $(src)../libfdt/fdt_strerror.c $(obj)fdt_strerror.c
+	@rm -f $(obj)fdt_strerror.c
+	ln -s $(src)../libfdt/fdt_strerror.c $(obj)fdt_strerror.c
 
 $(obj)fdt_wip.c:	$(obj)libfdt_internal.h
-		@rm -f $(obj)fdt_wip.c
-		ln -s $(src)../libfdt/fdt_wip.c $(obj)fdt_wip.c
+	@rm -f $(obj)fdt_wip.c
+	ln -s $(src)../libfdt/fdt_wip.c $(obj)fdt_wip.c
 
 $(obj)libfdt_internal.h:
-		@rm -f $(obj)libfdt_internal.h
-		ln -s $(src)../libfdt/libfdt_internal.h $(obj)libfdt_internal.h
+	@rm -f $(obj)libfdt_internal.h
+	ln -s $(src)../libfdt/libfdt_internal.h $(obj)libfdt_internal.h
 
 $(LOGO_H):	$(obj)bmp_logo $(LOGO_BMP)
-		$(obj)./bmp_logo $(LOGO_BMP) >$@
+	$(obj)./bmp_logo $(LOGO_BMP) >$@
 
 #########################################################################
 
Signature · 1 line
1.6.0.2.GIT
#8 lore raw

PATCH v2 8/26 tools/Makefile: Split variable declarations into multiple lines

Split variable declarations into multiple lines and use the standard VAR-y convention. Also move object and binary variable declarations to after config.mk has been included to allow for these lists to utilize the CONFIG_XXX variables.

These changes lay the groundwork for conditional compilation of files in the tools directory.

---
 tools/Makefile |   86 ++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 53 insertions(+), 33 deletions(-)
tools/Makefile +53 -33
index 4219aef..14da78d 100644
@@ -21,36 +21,6 @@
 # MA 02111-1307 USA
 #
 
-BIN_FILES	= img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) ubsha1$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX)
-
-OBJ_LINKS	= env_embedded.o crc32.o md5.o sha1.o image.o
-OBJ_FILES	= img2srec.o mkimage.o envcrc.o ubsha1.o gen_eth_addr.o bmp_logo.o
-
-ifeq ($(ARCH),mips)
-BIN_FILES	+= inca-swap-bytes$(SFX)
-OBJ_FILES	+= inca-swap-bytes.o
-endif
-
-# Don't build by default
-#ifeq ($(ARCH),ppc)
-#BIN_FILES		+= mpc86x_clk$(SFX)
-#OBJ_FILES	+= mpc86x_clk.o
-#endif
-
-LIBFDT_OBJ_FILES	= $(obj)fdt.o $(obj)fdt_ro.o $(obj)fdt_rw.o $(obj)fdt_strerror.o $(obj)fdt_wip.o
-
-LOGO_H	= $(OBJTREE)/include/bmp_logo.h
-
-ifeq ($(LOGO_BMP),)
-LOGO_BMP= logos/denx.bmp
-endif
-ifeq ($(VENDOR),atmel)
-LOGO_BMP= logos/atmel.bmp
-endif
-
-
-#-------------------------------------------------------------------------
-
 TOOLSUBDIRS =
 
 #
@@ -102,9 +72,59 @@ endif
 #
 include $(TOPDIR)/config.mk
 
+# Generated executable files
+BIN_FILES-y += img2srec$(SFX)
+BIN_FILES-y += mkimage$(SFX)
+BIN_FILES-y += envcrc$(SFX)
+BIN_FILES-y += ubsha1$(SFX)
+BIN_FILES-y += gen_eth_addr$(SFX)
+BIN_FILES-y += bmp_logo$(SFX)
+
+# Source files which are symlinked from elsewhere in U-Boot
+OBJ_LINKS-y += env_embedded.o
+OBJ_LINKS-y += crc32.o md5.o
+OBJ_LINKS-y += sha1.o
+OBJ_LINKS-y += image.o
+
+# Source files located in the tools directory
+OBJ_FILES-y += img2srec.o
+OBJ_FILES-y += mkimage.o
+OBJ_FILES-y += envcrc.o
+OBJ_FILES-y += ubsha1.o
+OBJ_FILES-y += gen_eth_addr.o
+OBJ_FILES-y += bmp_logo.o
+
+ifeq ($(ARCH),mips)
+BIN_FILES-y += inca-swap-bytes$(SFX)
+OBJ_FILES-y += inca-swap-bytes.o
+endif
+
+# Don't build by default
+#ifeq ($(ARCH),ppc)
+#BIN_FILES-y += mpc86x_clk$(SFX)
+#OBJ_FILES-y += mpc86x_clk.o
+#endif
+
+# Flattened device tree objects
+LIBFDT_OBJ_FILES-y += fdt.o
+LIBFDT_OBJ_FILES-y += fdt_ro.o
+LIBFDT_OBJ_FILES-y += fdt_rw.o
+LIBFDT_OBJ_FILES-y += fdt_strerror.o
+LIBFDT_OBJ_FILES-y += fdt_wip.o
+
+LOGO_H = $(OBJTREE)/include/bmp_logo.h
+
+ifeq ($(LOGO_BMP),)
+LOGO_BMP= logos/denx.bmp
+endif
+ifeq ($(VENDOR),atmel)
+LOGO_BMP= logos/atmel.bmp
+endif
+
 # now $(obj) is defined
-SRCS	:= $(addprefix $(obj),$(OBJ_LINKS:.o=.c)) $(OBJ_FILES:.o=.c)
-BINS	:= $(addprefix $(obj),$(BIN_FILES))
+SRCS	:= $(addprefix $(obj),$(OBJ_LINKS-y:.o=.c)) $(OBJ_FILES-y:.o=.c)
+BINS	:= $(addprefix $(obj),$(BIN_FILES-y))
+LIBFDT_OBJS	:= $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y))
 
 #
 # Use native tools and options
@@ -136,7 +156,7 @@ $(obj)img2srec$(SFX):	$(obj)img2srec.o
 	$(STRIP) $@
 
 $(obj)mkimage$(SFX):	$(obj)mkimage.o $(obj)crc32.o $(obj)image.o $(obj)md5.o \
-			$(obj)sha1.o $(LIBFDT_OBJ_FILES)
+			$(obj)sha1.o $(LIBFDT_OBJS)
 	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
 	$(STRIP) $@
 
Signature · 1 line
1.6.0.2.GIT
#9 lore raw

PATCH v2 9/26 tools/Makefile: Build bmp_logo only when LCD or VIDEO logos are enabled

---
 tools/Makefile |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
tools/Makefile +8 -3
index 14da78d..3c59bba 100644
@@ -78,7 +78,8 @@ BIN_FILES-y += mkimage$(SFX)
 BIN_FILES-y += envcrc$(SFX)
 BIN_FILES-y += ubsha1$(SFX)
 BIN_FILES-y += gen_eth_addr$(SFX)
-BIN_FILES-y += bmp_logo$(SFX)
+BIN_FILES-$(CONFIG_LCD_LOGO) += bmp_logo$(SFX)
+BIN_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo$(SFX)
 
 # Source files which are symlinked from elsewhere in U-Boot
 OBJ_LINKS-y += env_embedded.o
@@ -92,7 +93,8 @@ OBJ_FILES-y += mkimage.o
 OBJ_FILES-y += envcrc.o
 OBJ_FILES-y += ubsha1.o
 OBJ_FILES-y += gen_eth_addr.o
-OBJ_FILES-y += bmp_logo.o
+OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o
+OBJ_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo.o
 
 ifeq ($(ARCH),mips)
 BIN_FILES-y += inca-swap-bytes$(SFX)
@@ -112,7 +114,10 @@ LIBFDT_OBJ_FILES-y += fdt_rw.o
 LIBFDT_OBJ_FILES-y += fdt_strerror.o
 LIBFDT_OBJ_FILES-y += fdt_wip.o
 
+# Generated LCD/video logo
 LOGO_H = $(OBJTREE)/include/bmp_logo.h
+LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_H)
+LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_H)
 
 ifeq ($(LOGO_BMP),)
 LOGO_BMP= logos/denx.bmp
@@ -143,7 +148,7 @@ CC	   = $(HOSTCC)
 STRIP	   = $(HOSTSTRIP)
 MAKEDEPEND = makedepend
 
-all:	$(obj).depend $(BINS) $(LOGO_H) subdirs
+all:	$(obj).depend $(BINS) $(LOGO-y) subdirs
 
 $(obj)envcrc$(SFX):	$(obj)envcrc.o $(obj)crc32.o $(obj)env_embedded.o $(obj)sha1.o
 	$(CC) $(CFLAGS) -o $@ $^
Signature · 1 line
1.6.0.2.GIT
#10 lore raw

PATCH v2 10/26 tools/Makefile: Make img2srec dependent upon CONFIG_CMD_LOADS

---
 tools/Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/Makefile +2 -2
index 3c59bba..b4bd417 100644
@@ -73,7 +73,7 @@ endif
 include $(TOPDIR)/config.mk
 
 # Generated executable files
-BIN_FILES-y += img2srec$(SFX)
+BIN_FILES-$(CONFIG_CMD_LOADS) += img2srec$(SFX)
 BIN_FILES-y += mkimage$(SFX)
 BIN_FILES-y += envcrc$(SFX)
 BIN_FILES-y += ubsha1$(SFX)
@@ -88,7 +88,7 @@ OBJ_LINKS-y += sha1.o
 OBJ_LINKS-y += image.o
 
 # Source files located in the tools directory
-OBJ_FILES-y += img2srec.o
+OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
 OBJ_FILES-y += mkimage.o
 OBJ_FILES-y += envcrc.o
 OBJ_FILES-y += ubsha1.o
Signature · 1 line
1.6.0.2.GIT
#11 lore raw

PATCH v2 11/26 tools/Makefile: Make ubsha1 dependent upon CONFIG_SHA1_CHECK_UB_IMG

---
 tools/Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/Makefile +2 -2
index b4bd417..e314091 100644
@@ -76,7 +76,7 @@ include $(TOPDIR)/config.mk
 BIN_FILES-$(CONFIG_CMD_LOADS) += img2srec$(SFX)
 BIN_FILES-y += mkimage$(SFX)
 BIN_FILES-y += envcrc$(SFX)
-BIN_FILES-y += ubsha1$(SFX)
+BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX)
 BIN_FILES-y += gen_eth_addr$(SFX)
 BIN_FILES-$(CONFIG_LCD_LOGO) += bmp_logo$(SFX)
 BIN_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo$(SFX)
@@ -91,7 +91,7 @@ OBJ_LINKS-y += image.o
 OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
 OBJ_FILES-y += mkimage.o
 OBJ_FILES-y += envcrc.o
-OBJ_FILES-y += ubsha1.o
+OBJ_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1.o
 OBJ_FILES-y += gen_eth_addr.o
 OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o
 OBJ_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo.o
Signature · 1 line
1.6.0.2.GIT
#12 lore raw

PATCH v2 12/26 tools/Makefile: Make inca-swap-bytes dependent on CONFIG_INCA_IP

---
 tools/Makefile |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
tools/Makefile +2 -5
index e314091..942fae2 100644
@@ -80,6 +80,7 @@ BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX)
 BIN_FILES-y += gen_eth_addr$(SFX)
 BIN_FILES-$(CONFIG_LCD_LOGO) += bmp_logo$(SFX)
 BIN_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo$(SFX)
+BIN_FILES-$(CONFIG_INCA_IP) += inca-swap-bytes$(SFX)
 
 # Source files which are symlinked from elsewhere in U-Boot
 OBJ_LINKS-y += env_embedded.o
@@ -95,11 +96,7 @@ OBJ_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1.o
 OBJ_FILES-y += gen_eth_addr.o
 OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o
 OBJ_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo.o
-
-ifeq ($(ARCH),mips)
-BIN_FILES-y += inca-swap-bytes$(SFX)
-OBJ_FILES-y += inca-swap-bytes.o
-endif
+OBJ_FILES-$(CONFIG_INCA_IP) += inca-swap-bytes.o
 
 # Don't build by default
 #ifeq ($(ARCH),ppc)
Signature · 1 line
1.6.0.2.GIT
#13 lore raw

PATCH v2 13/26 tools/Makefile: Make envcrc dependent upon CONFIG_ENV_IS_EMBEDDED

---
 tools/Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/Makefile +2 -2
index 942fae2..ec35f18 100644
@@ -75,7 +75,7 @@ include $(TOPDIR)/config.mk
 # Generated executable files
 BIN_FILES-$(CONFIG_CMD_LOADS) += img2srec$(SFX)
 BIN_FILES-y += mkimage$(SFX)
-BIN_FILES-y += envcrc$(SFX)
+BIN_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc$(SFX)
 BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX)
 BIN_FILES-y += gen_eth_addr$(SFX)
 BIN_FILES-$(CONFIG_LCD_LOGO) += bmp_logo$(SFX)
@@ -91,7 +91,7 @@ OBJ_LINKS-y += image.o
 # Source files located in the tools directory
 OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
 OBJ_FILES-y += mkimage.o
-OBJ_FILES-y += envcrc.o
+OBJ_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc.o
 OBJ_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1.o
 OBJ_FILES-y += gen_eth_addr.o
 OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o
Signature · 1 line
1.6.0.2.GIT
#14 lore raw

PATCH v2 14/26 tools/Makefile: Make gen_eth_addr dependent upon CONFIG_CMD_NET

---
 tools/Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/Makefile +2 -2
index ec35f18..f648d34 100644
@@ -77,7 +77,7 @@ BIN_FILES-$(CONFIG_CMD_LOADS) += img2srec$(SFX)
 BIN_FILES-y += mkimage$(SFX)
 BIN_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc$(SFX)
 BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX)
-BIN_FILES-y += gen_eth_addr$(SFX)
+BIN_FILES-$(CONFIG_CMD_NET) += gen_eth_addr$(SFX)
 BIN_FILES-$(CONFIG_LCD_LOGO) += bmp_logo$(SFX)
 BIN_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo$(SFX)
 BIN_FILES-$(CONFIG_INCA_IP) += inca-swap-bytes$(SFX)
@@ -93,7 +93,7 @@ OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
 OBJ_FILES-y += mkimage.o
 OBJ_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc.o
 OBJ_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1.o
-OBJ_FILES-y += gen_eth_addr.o
+OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o
 OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o
 OBJ_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo.o
 OBJ_FILES-$(CONFIG_INCA_IP) += inca-swap-bytes.o
Signature · 1 line
1.6.0.2.GIT
#15 lore raw

PATCH v2 15/26 tools/Makefile: Compile ncb when CONFIG_NETCONSOLE

Also conditionally add ncb.o to OBJ_FILES list

---
 doc/README.NetConsole |    6 ++----
 tools/Makefile        |    2 ++
 2 files changed, 4 insertions(+), 4 deletions(-)
doc/README.NetConsole +2 -4
index 94c8816..639cc12 100644
@@ -55,10 +55,8 @@ Again, this script takes exactly one argument, which is interpreted
 as the target IP address (or host name, assuming DNS is working). The
 script can be interrupted by pressing ^T (CTRL-T).
 
-The 'ncb' tool can be found in the tools directory; it will not be
-built by default so you will ither have to adjust the Makefile or
-build it manually.
-
+The 'ncb' tool can be found in the tools directory; it will be built
+when compiling for a board which has CONFIG_NETCONSOLE defined.
 
 For Linux, the network-based console needs special configuration.
 Minimally, the host IP address needs to be specified. This can be
tools/Makefile +2 -0
index f648d34..35e694d 100644
@@ -81,6 +81,7 @@ BIN_FILES-$(CONFIG_CMD_NET) += gen_eth_addr$(SFX)
 BIN_FILES-$(CONFIG_LCD_LOGO) += bmp_logo$(SFX)
 BIN_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo$(SFX)
 BIN_FILES-$(CONFIG_INCA_IP) += inca-swap-bytes$(SFX)
+BIN_FILES-$(CONFIG_NETCONSOLE) += ncb$(SFX)
 
 # Source files which are symlinked from elsewhere in U-Boot
 OBJ_LINKS-y += env_embedded.o
@@ -97,6 +98,7 @@ OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o
 OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o
 OBJ_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo.o
 OBJ_FILES-$(CONFIG_INCA_IP) += inca-swap-bytes.o
+OBJ_FILES-$(CONFIG_NETCONSOLE) += ncb.o
 
 # Don't build by default
 #ifeq ($(ARCH),ppc)
Signature · 1 line
1.6.0.2.GIT
#16 lore raw

PATCH v2 16/26 tools/Makefile: Add tools/ to the include search path

This change makes the process of symlinking mkimage.h and fdt_host.h unnecessary

---
 tools/Makefile |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
tools/Makefile +1 -6
index 35e694d..e1f262b 100644
@@ -136,6 +136,7 @@ LIBFDT_OBJS	:= $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y))
 CPPFLAGS   = -idirafter $(SRCTREE)/include \
 		-idirafter $(OBJTREE)/include2 \
 		-idirafter $(OBJTREE)/include \
+		-I $(SRCTREE)/tools \
 		-DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC
 CFLAGS     = $(HOST_CFLAGS) $(CPPFLAGS) -O
 
@@ -276,12 +277,6 @@ $(obj)sha1.c:
 $(obj)image.c:
 	@rm -f $(obj)image.c
 	ln -s $(src)../common/image.c $(obj)image.c
-	if [ ! -f $(obj)mkimage.h ] ; then \
-		ln -s $(src)../tools/mkimage.h $(obj)mkimage.h; \
-	fi
-	if [ ! -f $(obj)fdt_host.h ] ; then \
-		ln -s $(src)../tools/fdt_host.h $(obj)fdt_host.h; \
-	fi
 
 $(obj)fdt.c:	$(obj)libfdt_internal.h
 	@rm -f $(obj)fdt.c
Signature · 1 line
1.6.0.2.GIT
#17 lore raw

PATCH v2 17/26 tools/Makefile: Give precedence to U-Boot's include directory

Update include search path so that the includes in U-Boot's include/ directory have precedence over system includes. This allows crc32.c to use U-Boot's zlib.h header which removes the previously required symlinked zlib.h.

The 'pedantic' gcc flag was also removed to prevent new warnings of "long long" variables which occurred as a result of this change. Strict ISO C is not required for the tools thus the pedantic flag is not strictly necessary.

The __32 typedef for WIN32 targets in mkimage.h is also no longer necessary because U-Boot's asm-xxx/types.h provides it.

---
 Makefile        |    2 +-
 tools/Makefile  |   15 +++++----------
 tools/mkimage.h |    2 --
 3 files changed, 6 insertions(+), 13 deletions(-)
Makefile +1 -1
index b68de1c..ecb8430 100644
@@ -3482,7 +3482,7 @@ clobber:	clean
 		$(obj)cscope.* $(obj)*.*~
 	@rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
 	@rm -f $(obj)tools/{crc32.c,env_embedded.c,env/crc32.c,md5.c,sha1.c,inca-swap-bytes}
-	@rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,zlib.h}
+	@rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,}
 	@rm -f $(obj)tools/{fdt_wip.c,libfdt_internal.h}
 	@rm -f $(obj)cpu/mpc824x/bedbug_603e.c
 	@rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
tools/Makefile +5 -10
index e1f262b..db4ecc8 100644
@@ -42,7 +42,7 @@ HOST_ENVIRO_CFLAGS =
 
 else
 ifeq ($(HOSTOS)-$(HOSTARCH),netbsd-ppc)
-HOST_CFLAGS = -Wall -pedantic
+HOST_CFLAGS = -Wall
 HOST_LDFLAGS =
 HOST_ENVIRO_CFLAGS =
 
@@ -50,7 +50,7 @@ HOST_ENVIRO_CFLAGS =
 # Everyone else
 #
 else
-HOST_CFLAGS = -Wall -pedantic
+HOST_CFLAGS = -Wall
 HOST_LDFLAGS =
 HOST_ENVIRO_CFLAGS =
 endif
@@ -133,10 +133,9 @@ LIBFDT_OBJS	:= $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y))
 #
 # Use native tools and options
 #
-CPPFLAGS   = -idirafter $(SRCTREE)/include \
-		-idirafter $(OBJTREE)/include2 \
-		-idirafter $(OBJTREE)/include \
+CPPFLAGS   = -I $(SRCTREE)/include \
 		-I $(SRCTREE)/tools \
+		-idirafter $(OBJTREE)/include2 \
 		-DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC
 CFLAGS     = $(HOST_CFLAGS) $(CPPFLAGS) -O
 
@@ -258,11 +257,7 @@ $(obj)env_embedded.c:
 $(obj)env_embedded.o:	$(obj)env_embedded.c
 	$(CC) -g $(HOST_ENVIRO_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
-$(obj)zlib.h:
-	@rm -f $@
-	ln -s $(src)../include/zlib.h $@
-
-$(obj)crc32.c: $(obj)zlib.h
+$(obj)crc32.c:
 	@rm -f $(obj)crc32.c
 	ln -s $(src)../lib_generic/crc32.c $(obj)crc32.c
 
tools/mkimage.h +0 -2
index a2d5248..9b4c0ce 100644
@@ -54,8 +54,6 @@
 #endif
 
 #ifdef __WIN32__
-typedef unsigned int __u32;
-
 #define SWAP_LONG(x) \
 	((__u32)( \
 		(((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
Signature · 1 line
1.6.0.2.GIT
#18 lore raw

PATCH v2 18/26 tools/Makefile: Add libfdt/ to the include search path

This change makes the process of symlinking libfdt_internal.h unnecessary

---
 Makefile       |    2 +-
 tools/Makefile |   15 ++++++---------
 2 files changed, 7 insertions(+), 10 deletions(-)
Makefile +1 -1
index ecb8430..4bee5ca 100644
@@ -3483,7 +3483,7 @@ clobber:	clean
 	@rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
 	@rm -f $(obj)tools/{crc32.c,env_embedded.c,env/crc32.c,md5.c,sha1.c,inca-swap-bytes}
 	@rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,}
-	@rm -f $(obj)tools/{fdt_wip.c,libfdt_internal.h}
+	@rm -f $(obj)tools/{fdt_wip.c}
 	@rm -f $(obj)cpu/mpc824x/bedbug_603e.c
 	@rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
 	@[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
tools/Makefile +6 -9
index db4ecc8..337d695 100644
@@ -135,6 +135,7 @@ LIBFDT_OBJS	:= $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y))
 #
 CPPFLAGS   = -I $(SRCTREE)/include \
 		-I $(SRCTREE)/tools \
+	        -I $(SRCTREE)/libfdt \
 		-idirafter $(OBJTREE)/include2 \
 		-DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC
 CFLAGS     = $(HOST_CFLAGS) $(CPPFLAGS) -O
@@ -273,30 +274,26 @@ $(obj)image.c:
 	@rm -f $(obj)image.c
 	ln -s $(src)../common/image.c $(obj)image.c
 
-$(obj)fdt.c:	$(obj)libfdt_internal.h
+$(obj)fdt.c: $(SRCTREE)/libfdt/libfdt_internal.h
 	@rm -f $(obj)fdt.c
 	ln -s $(src)../libfdt/fdt.c $(obj)fdt.c
 
-$(obj)fdt_ro.c:	$(obj)libfdt_internal.h
+$(obj)fdt_ro.c: $(SRCTREE)/libfdt/libfdt_internal.h
 	@rm -f $(obj)fdt_ro.c
 	ln -s $(src)../libfdt/fdt_ro.c $(obj)fdt_ro.c
 
-$(obj)fdt_rw.c:	$(obj)libfdt_internal.h
+$(obj)fdt_rw.c: $(SRCTREE)/libfdt/libfdt_internal.h
 	@rm -f $(obj)fdt_rw.c
 	ln -s $(src)../libfdt/fdt_rw.c $(obj)fdt_rw.c
 
-$(obj)fdt_strerror.c:	$(obj)libfdt_internal.h
+$(obj)fdt_strerror.c: $(SRCTREE)/libfdt/libfdt_internal.h
 	@rm -f $(obj)fdt_strerror.c
 	ln -s $(src)../libfdt/fdt_strerror.c $(obj)fdt_strerror.c
 
-$(obj)fdt_wip.c:	$(obj)libfdt_internal.h
+$(obj)fdt_wip.c: $(SRCTREE)/libfdt/libfdt_internal.h
 	@rm -f $(obj)fdt_wip.c
 	ln -s $(src)../libfdt/fdt_wip.c $(obj)fdt_wip.c
 
-$(obj)libfdt_internal.h:
-	@rm -f $(obj)libfdt_internal.h
-	ln -s $(src)../libfdt/libfdt_internal.h $(obj)libfdt_internal.h
-
 $(LOGO_H):	$(obj)bmp_logo $(LOGO_BMP)
 	$(obj)./bmp_logo $(LOGO_BMP) >$@
 
Signature · 1 line
1.6.0.2.GIT
#19 lore raw

PATCH v2 19/26 tools/Makefile: Remove symlinks for fdt targets

---
 Makefile       |    3 +--
 tools/Makefile |   32 +++++++-------------------------
 2 files changed, 8 insertions(+), 27 deletions(-)
Makefile +1 -2
index 4bee5ca..ef95339 100644
@@ -3482,8 +3482,7 @@ clobber:	clean
 		$(obj)cscope.* $(obj)*.*~
 	@rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
 	@rm -f $(obj)tools/{crc32.c,env_embedded.c,env/crc32.c,md5.c,sha1.c,inca-swap-bytes}
-	@rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,}
-	@rm -f $(obj)tools/{fdt_wip.c}
+	@rm -f $(obj)tools/{image.c}
 	@rm -f $(obj)cpu/mpc824x/bedbug_603e.c
 	@rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
 	@[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
tools/Makefile +7 -25
index 337d695..99423b2 100644
@@ -22,6 +22,7 @@
 #
 
 TOOLSUBDIRS =
+LIBFDT_DIR = $(SRCTREE)/libfdt/
 
 #
 # Mac OS X / Darwin's C preprocessor is Apple specific.  It
@@ -222,19 +223,20 @@ $(obj)inca-swap-bytes.o:	$(src)inca-swap-bytes.c
 $(obj)mpc86x_clk.o:	$(src)mpc86x_clk.c
 	$(CC) -g $(CFLAGS) -c -o $@ $<
 
-$(obj)fdt.o:	$(obj)fdt.c
+$(obj)fdt.o:	$(LIBFDT_DIR)fdt.c $(SRCTREE)/libfdt/libfdt_internal.h
 	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
-$(obj)fdt_ro.o:	$(obj)fdt_ro.c
+$(obj)fdt_ro.o:	$(LIBFDT_DIR)fdt_ro.c $(SRCTREE)/libfdt/libfdt_internal.h
 	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
-$(obj)fdt_rw.o:	$(obj)fdt_rw.c
+$(obj)fdt_rw.o:	$(LIBFDT_DIR)fdt_rw.c $(SRCTREE)/libfdt/libfdt_internal.h
 	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
-$(obj)fdt_strerror.o:	$(obj)fdt_strerror.c
+$(obj)fdt_strerror.o: $(LIBFDT_DIR)fdt_strerror.c \
+			$(SRCTREE)/libfdt/libfdt_internal.h
 	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
-$(obj)fdt_wip.o:	$(obj)fdt_wip.c
+$(obj)fdt_wip.o: $(LIBFDT_DIR)fdt_wip.c $(SRCTREE)/libfdt/libfdt_internal.h
 	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
 subdirs:
@@ -274,26 +276,6 @@ $(obj)image.c:
 	@rm -f $(obj)image.c
 	ln -s $(src)../common/image.c $(obj)image.c
 
-$(obj)fdt.c: $(SRCTREE)/libfdt/libfdt_internal.h
-	@rm -f $(obj)fdt.c
-	ln -s $(src)../libfdt/fdt.c $(obj)fdt.c
-
-$(obj)fdt_ro.c: $(SRCTREE)/libfdt/libfdt_internal.h
-	@rm -f $(obj)fdt_ro.c
-	ln -s $(src)../libfdt/fdt_ro.c $(obj)fdt_ro.c
-
-$(obj)fdt_rw.c: $(SRCTREE)/libfdt/libfdt_internal.h
-	@rm -f $(obj)fdt_rw.c
-	ln -s $(src)../libfdt/fdt_rw.c $(obj)fdt_rw.c
-
-$(obj)fdt_strerror.c: $(SRCTREE)/libfdt/libfdt_internal.h
-	@rm -f $(obj)fdt_strerror.c
-	ln -s $(src)../libfdt/fdt_strerror.c $(obj)fdt_strerror.c
-
-$(obj)fdt_wip.c: $(SRCTREE)/libfdt/libfdt_internal.h
-	@rm -f $(obj)fdt_wip.c
-	ln -s $(src)../libfdt/fdt_wip.c $(obj)fdt_wip.c
-
 $(LOGO_H):	$(obj)bmp_logo $(LOGO_BMP)
 	$(obj)./bmp_logo $(LOGO_BMP) >$@
 
Signature · 1 line
1.6.0.2.GIT
#20 lore raw

PATCH v2 20/26 tools/Makefile: Dynamically generate libfdt object dependencies

Add the libfdt files to the SRCS variable so that they have their dependencies automatically generated

---
 tools/Makefile |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
tools/Makefile +6 -7
index 99423b2..e3abf56 100644
@@ -22,7 +22,6 @@
 #
 
 TOOLSUBDIRS =
-LIBFDT_DIR = $(SRCTREE)/libfdt/
 
 #
 # Mac OS X / Darwin's C preprocessor is Apple specific.  It
@@ -128,6 +127,7 @@ endif
 
 # now $(obj) is defined
 SRCS	:= $(addprefix $(obj),$(OBJ_LINKS-y:.o=.c)) $(OBJ_FILES-y:.o=.c)
+SRCS	+= $(addprefix $(SRCTREE)/libfdt/,$(LIBFDT_OBJ_FILES-y:.o=.c))
 BINS	:= $(addprefix $(obj),$(BIN_FILES-y))
 LIBFDT_OBJS	:= $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y))
 
@@ -223,20 +223,19 @@ $(obj)inca-swap-bytes.o:	$(src)inca-swap-bytes.c
 $(obj)mpc86x_clk.o:	$(src)mpc86x_clk.c
 	$(CC) -g $(CFLAGS) -c -o $@ $<
 
-$(obj)fdt.o:	$(LIBFDT_DIR)fdt.c $(SRCTREE)/libfdt/libfdt_internal.h
+$(obj)fdt.o:
 	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
-$(obj)fdt_ro.o:	$(LIBFDT_DIR)fdt_ro.c $(SRCTREE)/libfdt/libfdt_internal.h
+$(obj)fdt_ro.o:
 	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
-$(obj)fdt_rw.o:	$(LIBFDT_DIR)fdt_rw.c $(SRCTREE)/libfdt/libfdt_internal.h
+$(obj)fdt_rw.o:
 	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
-$(obj)fdt_strerror.o: $(LIBFDT_DIR)fdt_strerror.c \
-			$(SRCTREE)/libfdt/libfdt_internal.h
+$(obj)fdt_strerror.o:
 	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
-$(obj)fdt_wip.o: $(LIBFDT_DIR)fdt_wip.c $(SRCTREE)/libfdt/libfdt_internal.h
+$(obj)fdt_wip.o:
 	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
 subdirs:
Signature · 1 line
1.6.0.2.GIT
#21 lore raw

PATCH v2 21/26 tools/Makefile: Remove symlinks for remaining source files

---
 Makefile       |    3 +--
 tools/Makefile |   43 +++++++++++++------------------------------
 2 files changed, 14 insertions(+), 32 deletions(-)
Makefile +1 -2
index ef95339..dfcb71b 100644
@@ -3481,8 +3481,7 @@ clobber:	clean
 	@rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \
 		$(obj)cscope.* $(obj)*.*~
 	@rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
-	@rm -f $(obj)tools/{crc32.c,env_embedded.c,env/crc32.c,md5.c,sha1.c,inca-swap-bytes}
-	@rm -f $(obj)tools/{image.c}
+	@rm -f $(obj)tools/{env/crc32.c,inca-swap-bytes}
 	@rm -f $(obj)cpu/mpc824x/bedbug_603e.c
 	@rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
 	@[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
tools/Makefile +13 -30

75 lines not on this page · raw message

Signature · 1 line
1.6.0.2.GIT
#22 lore raw

PATCH v2 22/26 tools/Makefile: Use auto-generated object file dependencies

Files in the SRCS variable have their dependencies automatically generated so remove duplicate explicit dependencies

---
 tools/Makefile |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)
tools/Makefile +12 -12
index e996bb9..c4d6e1b 100644
@@ -192,37 +192,37 @@ $(obj)bin2header$(SFX): $(obj)bin2header.o
 	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
 	$(STRIP) $@
 
-$(obj)envcrc.o:	$(src)envcrc.c
+$(obj)envcrc.o:
 	$(CC) -g $(CFLAGS) -c -o $@ $<
 
-$(obj)ubsha1.o:	$(src)ubsha1.c
+$(obj)ubsha1.o:
 	$(CC) -g $(CFLAGS) -c -o $@ $<
 
-$(obj)crc32.o: $(SRCTREE)/lib_generic/crc32.c
+$(obj)crc32.o:
 	$(CC) -g $(CFLAGS) -c -o $@ $<
 
-$(obj)md5.o: $(SRCTREE)/lib_generic/md5.c
+$(obj)md5.o:
 	$(CC) -g $(CFLAGS) -c -o $@ $<
 
-$(obj)sha1.o: $(SRCTREE)/lib_gneric/sha1.c
+$(obj)sha1.o:
 	$(CC) -g $(CFLAGS) -c -o $@ $<
 
-$(obj)image.o: $(SRCTREE)/common/image.c
+$(obj)image.o:
 	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
-$(obj)mkimage.o:	$(src)mkimage.c
+$(obj)mkimage.o:
 	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
-$(obj)ncb.o:		$(src)ncb.c
+$(obj)ncb.o:
 	$(CC) -g $(CFLAGS) -c -o $@ $<
 
-$(obj)gen_eth_addr.o:	$(src)gen_eth_addr.c
+$(obj)gen_eth_addr.o:
 	$(CC) -g $(CFLAGS) -c -o $@ $<
 
-$(obj)inca-swap-bytes.o:	$(src)inca-swap-bytes.c
+$(obj)inca-swap-bytes.o:
 	$(CC) -g $(CFLAGS) -c -o $@ $<
 
-$(obj)mpc86x_clk.o:	$(src)mpc86x_clk.c
+$(obj)mpc86x_clk.o:
 	$(CC) -g $(CFLAGS) -c -o $@ $<
 
 $(obj)fdt.o:
@@ -254,7 +254,7 @@ else
 	done
 endif
 
-$(obj)env_embedded.o: $(SRCTREE)/common/env_embedded.c
+$(obj)env_embedded.o:
 	$(CC) -g $(HOST_ENVIRO_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 
Signature · 1 line
1.6.0.2.GIT
#23 lore raw

PATCH v2 23/26 tools/Makefile: Create generic build rules

Create a few generic build rules to replace the current method which has 1 build target for each file

---
 tools/Makefile |   55 +++++++------------------------------------------------
 1 files changed, 7 insertions(+), 48 deletions(-)
tools/Makefile +7 -48
index c4d6e1b..25f8150 100644
@@ -38,13 +38,11 @@ TOOLSUBDIRS =
 ifeq ($(HOSTOS)-$(HOSTARCH),darwin-ppc)
 HOST_CFLAGS = -traditional-cpp -Wall
 HOST_LDFLAGS =-multiply_defined suppress
-HOST_ENVIRO_CFLAGS =
 
 else
 ifeq ($(HOSTOS)-$(HOSTARCH),netbsd-ppc)
 HOST_CFLAGS = -Wall
 HOST_LDFLAGS =
-HOST_ENVIRO_CFLAGS =
 
 #
 # Everyone else
@@ -52,7 +50,6 @@ HOST_ENVIRO_CFLAGS =
 else
 HOST_CFLAGS = -Wall
 HOST_LDFLAGS =
-HOST_ENVIRO_CFLAGS =
 endif
 endif
 
@@ -128,7 +125,7 @@ endif
 
 # now $(obj) is defined
 SRCS	+= $(addprefix $(SRCTREE)/,$(EXT_OBJ_FILES-y:.o=.c))
-SRCS	+= $(OBJ_FILES-y:.o=.c)
+SRCS	+= $(addprefix $(SRCTREE)/tools/,$(OBJ_FILES-y:.o=.c))
 SRCS	+= $(addprefix $(SRCTREE)/libfdt/,$(LIBFDT_OBJ_FILES-y:.o=.c))
 BINS	:= $(addprefix $(obj),$(BIN_FILES-y))
 LIBFDT_OBJS	:= $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y))
@@ -192,52 +189,18 @@ $(obj)bin2header$(SFX): $(obj)bin2header.o
 	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
 	$(STRIP) $@
 
-$(obj)envcrc.o:
-	$(CC) -g $(CFLAGS) -c -o $@ $<
-
-$(obj)ubsha1.o:
-	$(CC) -g $(CFLAGS) -c -o $@ $<
-
-$(obj)crc32.o:
-	$(CC) -g $(CFLAGS) -c -o $@ $<
-
-$(obj)md5.o:
-	$(CC) -g $(CFLAGS) -c -o $@ $<
-
-$(obj)sha1.o:
-	$(CC) -g $(CFLAGS) -c -o $@ $<
-
-$(obj)image.o:
+# mkimage.c requires FIT_CFLAGS instead of standard CFLAGS
+$(obj)mkimage.o: $(SRCTREE)/tools/mkimage.c
 	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
-$(obj)mkimage.o:
+# Some of the tool objects need to be accessed from outside the tools directory
+$(obj)%.o: $(SRCTREE)/common/%.c
 	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
-$(obj)ncb.o:
-	$(CC) -g $(CFLAGS) -c -o $@ $<
-
-$(obj)gen_eth_addr.o:
-	$(CC) -g $(CFLAGS) -c -o $@ $<
-
-$(obj)inca-swap-bytes.o:
-	$(CC) -g $(CFLAGS) -c -o $@ $<
-
-$(obj)mpc86x_clk.o:
+$(obj)%.o: $(SRCTREE)/lib_generic/%.c
 	$(CC) -g $(CFLAGS) -c -o $@ $<
 
-$(obj)fdt.o:
-	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
-
-$(obj)fdt_ro.o:
-	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
-
-$(obj)fdt_rw.o:
-	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
-
-$(obj)fdt_strerror.o:
-	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
-
-$(obj)fdt_wip.o:
+$(LIBFDT_OBJS):
 	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
 subdirs:
@@ -254,10 +217,6 @@ else
 	done
 endif
 
-$(obj)env_embedded.o:
-	$(CC) -g $(HOST_ENVIRO_CFLAGS) $(CPPFLAGS) -c -o $@ $<
-
-
 $(LOGO_H):	$(obj)bmp_logo $(LOGO_BMP)
 	$(obj)./bmp_logo $(LOGO_BMP) >$@
 
Signature · 1 line
1.6.0.2.GIT
#24 lore raw

PATCH v2 24/26 tools/Makefile: Simplify HOST_CFLAGS/HOST_LDFLAGS generation

---
 tools/Makefile |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)
tools/Makefile +3 -12
index 25f8150..6a40d88 100644
@@ -35,22 +35,13 @@ TOOLSUBDIRS =
 # multiple symbol definitions are treated as errors, hence the
 # -multiply_defined suppress option to turn off this error.
 #
-ifeq ($(HOSTOS)-$(HOSTARCH),darwin-ppc)
-HOST_CFLAGS = -traditional-cpp -Wall
-HOST_LDFLAGS =-multiply_defined suppress
 
-else
-ifeq ($(HOSTOS)-$(HOSTARCH),netbsd-ppc)
 HOST_CFLAGS = -Wall
 HOST_LDFLAGS =
 
-#
-# Everyone else
-#
-else
-HOST_CFLAGS = -Wall
-HOST_LDFLAGS =
-endif
+ifeq ($(HOSTOS)-$(HOSTARCH),darwin-ppc)
+HOST_CFLAGS += -traditional-cpp
+HOST_LDFLAGS += -multiply_defined suppress
 endif
 
 #
Signature · 1 line
1.6.0.2.GIT
#25 lore raw

PATCH v2 25/26 Add support for building native win32 tools

Add support for compiling the host tools in the tools directory using the MinGW toolchain. This produces executables which can be used on standard Windows computers without requiring cygwin.

One must specify the MinGW compiler and strip utilities as if they were the host toolchain in order to build win32 executables, eg:

make HOSTCC=i586-mingw32msvc-gcc HOSTSTRIP=i586-mingw32msvc-strip tools

---
 README                |   10 ++++++
 include/image.h       |    2 +
 include/libfdt_env.h  |   12 +++++++
 tools/Makefile        |   18 +++++++----
 tools/mingw_support.c |   79 +++++++++++++++++++++++++++++++++++++++++++++++++
 tools/mingw_support.h |   51 +++++++++++++++++++++++++++++++
 tools/mkimage.h       |    5 +++
 tools/os_support.c    |   24 +++++++++++++++
 tools/os_support.h    |   29 ++++++++++++++++++
 tools/ubsha1.c        |    3 ++
 10 files changed, 227 insertions(+), 6 deletions(-)
 create mode 100644 tools/mingw_support.c
 create mode 100644 tools/mingw_support.h
 create mode 100644 tools/os_support.c
 create mode 100644 tools/os_support.h
README +10 -0
index 43fb1c0..3fb2814 100644
@@ -2710,6 +2710,16 @@ necessary. For example using the ELDK on a 4xx CPU, please enter:
 	$ CROSS_COMPILE=ppc_4xx-
 	$ export CROSS_COMPILE
 
+Note: If you wish to generate Windows versions of the utilities in
+      the tools directory you can use the MinGW toolchain
+      (http://www.mingw.org).  Set your HOST tools to the MinGW
+      toolchain and execute 'make tools'.  For example:
+
+       $ make HOSTCC=i586-mingw32msvc-gcc HOSTSTRIP=i586-mingw32msvc-strip tools
+
+      Binaries such as tools/mkimage.exe will be created which can
+      be executed on computers running Windows.
+
 U-Boot is intended to be simple to build. After installing the
 sources you must configure U-Boot for one specific board type. This
 is done by typing:
include/image.h +2 -0
index 74a1240..f183757 100644
@@ -34,7 +34,9 @@
 #define __IMAGE_H__
 
 #if USE_HOSTCC
+#ifndef __MINGW32__
 #include <endian.h>
+#endif
 
 /* new uImage format support enabled on host */
 #define CONFIG_FIT		1
include/libfdt_env.h +12 -0
index ea474a5..1c67015 100644
@@ -24,8 +24,13 @@
 #ifdef USE_HOSTCC
 #include <stdint.h>
 #include <string.h>
+#ifdef __MINGW32__
+#include <linux/types.h>
+#include <linux/byteorder/swab.h>
+#else
 #include <endian.h>
 #include <byteswap.h>
+#endif /* __MINGW32__ */
 #else
 #include <linux/string.h>
 #include <linux/types.h>
@@ -36,10 +41,17 @@
 extern struct fdt_header *working_fdt;  /* Pointer to the working fdt */
 
 #if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifdef __MINGW32__
+#define fdt32_to_cpu(x)		___swab32(x)
+#define cpu_to_fdt32(x)		___swab32(x)
+#define fdt64_to_cpu(x)		___swab64(x)
+#define cpu_to_fdt64(x)		___swab64(x)
+#else
 #define fdt32_to_cpu(x)		bswap_32(x)
 #define cpu_to_fdt32(x)		bswap_32(x)
 #define fdt64_to_cpu(x)		bswap_64(x)
 #define cpu_to_fdt64(x)		bswap_64(x)
+#endif
 #else
 #define fdt32_to_cpu(x)		(x)
 #define cpu_to_fdt32(x)		(x)
tools/Makefile +12 -6
index 6a40d88..c8d673f 100644
@@ -44,12 +44,15 @@ HOST_CFLAGS += -traditional-cpp
 HOST_LDFLAGS += -multiply_defined suppress
 endif
 
+ifeq ($(HOSTOS),cygwin)
+HOST_CFLAGS += -ansi
+endif
+
 #
-# Cygwin needs .exe files :-(
+# toolchains targeting win32 generate .exe files
 #
-ifeq ($(HOSTOS),cygwin)
+ifneq (,$(findstring WIN32 ,$(shell $(HOSTCC) -E -dM -xc /dev/null)))
 SFX = .exe
-HOST_CFLAGS += -ansi
 else
 SFX =
 endif
@@ -88,6 +91,7 @@ OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o
 OBJ_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo.o
 OBJ_FILES-$(CONFIG_INCA_IP) += inca-swap-bytes.o
 OBJ_FILES-$(CONFIG_NETCONSOLE) += ncb.o
+OBJ_FILES-y += os_support.o
 
 # Don't build by default
 #ifeq ($(ARCH),ppc)
@@ -123,12 +127,14 @@ LIBFDT_OBJS	:= $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y))
 
 #
 # Use native tools and options
+# Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
 #
 CPPFLAGS   = -I $(SRCTREE)/include \
 		-I $(SRCTREE)/tools \
 	        -I $(SRCTREE)/libfdt \
 		-idirafter $(OBJTREE)/include2 \
-		-DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC
+		-DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC \
+		-D__KERNEL_STRICT_NAMES
 CFLAGS     = $(HOST_CFLAGS) $(CPPFLAGS) -O
 
 # No -pedantic switch to avoid libfdt compilation warnings
@@ -144,7 +150,7 @@ all:	$(obj).depend $(BINS) $(LOGO-y) subdirs
 $(obj)envcrc$(SFX):	$(obj)envcrc.o $(obj)crc32.o $(obj)env_embedded.o $(obj)sha1.o
 	$(CC) $(CFLAGS) -o $@ $^
 
-$(obj)ubsha1$(SFX):	$(obj)ubsha1.o $(obj)sha1.o
+$(obj)ubsha1$(SFX):	$(obj)ubsha1.o $(obj)sha1.o $(obj)os_support.o
 	$(CC) $(CFLAGS) -o $@ $^
 
 $(obj)img2srec$(SFX):	$(obj)img2srec.o
@@ -152,7 +158,7 @@ $(obj)img2srec$(SFX):	$(obj)img2srec.o
 	$(STRIP) $@
 
 $(obj)mkimage$(SFX):	$(obj)mkimage.o $(obj)crc32.o $(obj)image.o $(obj)md5.o \
-			$(obj)sha1.o $(LIBFDT_OBJS)
+			$(obj)sha1.o $(LIBFDT_OBJS) $(obj)os_support.o
 	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
 	$(STRIP) $@
 
tools/mingw_support.c new file +79 -0

79 lines not on this page · raw message

tools/mingw_support.h new file +51 -0

51 lines not on this page · raw message

tools/mkimage.h +5 -0
index 9b4c0ce..23b5076 100644
@@ -20,6 +20,7 @@
  * MA 02111-1307 USA
  */
 
+#include "os_support.h"
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
@@ -28,7 +29,11 @@
 #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>
tools/os_support.c new file +24 -0
new file mode 100644
index 0000000..001fe64
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2009 Extreme Engineering Solutions, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this software; if not, write to the
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * Include additional files required for supporting different operating systems
+ */
+#ifdef __MINGW32__
+#include "mingw_support.c"
+#endif
tools/os_support.h new file +29 -0
new file mode 100644
index 0000000..f6f86b0
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2009 Extreme Engineering Solutions, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this software; if not, write to the
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __OS_SUPPORT_H_
+#define __OS_SUPPORT_H_
+
+/*
+ * Include additional files required for supporting different operating systems
+ */
+#ifdef __MINGW32__
+#include "mingw_support.h"
+#endif
+
+#endif /* __OS_SUPPORT_H_ */
tools/ubsha1.c +3 -0
index b37b2b7..c4203ed 100644
@@ -21,13 +21,16 @@
  * MA 02111-1307 USA
  */
 
+#include "os_support.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <string.h>
+#ifndef __MINGW32__
 #include <sys/mman.h>
+#endif
 #include <sys/stat.h>
 #include "sha1.h"
 
Signature · 1 line
1.6.0.2.GIT
#26 lore raw

PATCH v2 26/26 Delete now unused tools/Makefile.win32

---
 tools/Makefile.win32 |   37 -------------------------------------
 1 files changed, 0 insertions(+), 37 deletions(-)
 delete mode 100644 tools/Makefile.win32
tools/Makefile.win32 deleted +0 -37
deleted file mode 100644
index 69dc44c..0000000
@@ -1,37 +0,0 @@
-#
-# (C) Copyright 2001
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-CPPFLAGS   = -Wall -pedantic -I../include -I.. -D__WIN32__
-CFLAGS     = $(CPPFLAGS) -O
-
-all: mkimage.exe
-
-mkimage.exe:	mkimage.o crc32.o
-		$(CC) -g $(CFLAGS) -o $@ $^
-
-crc32.o:	crc32.c
-		$(CC) -g $(CFLAGS) -c $<
-
-mkimage.o:	mkimage.c
-		$(CC) -g $(CFLAGS) -c $<
-
Signature · 1 line
1.6.0.2.GIT
#27 lore raw

PATCH v2 17/26 tools/Makefile: Give precedence to U-Boot's include directory

In reply to Peter Tyser
Quoted 4 lines · On Thursday 12 March 2009 15:49:06 Peter Tyser wrote:

Update include search path so that the includes in U-Boot's include/ directory have precedence over system includes. This allows crc32.c to use U-Boot's zlib.h header which removes the previously required symlinked zlib.h.

this seems pretty risky. the headers in include/ are pretty much for u-boot. making those with the host headers seems like it's doomed to failure. -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090312/a2ac8660/attachment.pgp

#28 lore raw

PATCH v2 17/26 tools/Makefile: Give precedence to U-Boot's include directory

Dear Mike Frysinger,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 4 lines · On Thursday 12 March 2009 15:49:06 Peter Tyser wrote:

Update include search path so that the includes in U-Boot's include/ directory have precedence over system includes. This allows crc32.c to use U-Boot's zlib.h header which removes the previously required symlinked zlib.h.

this seems pretty risky. the headers in include/ are pretty much for u-boot. making those with the host headers seems like it's doomed to failure.

Indeed.

Full NAK from me, too.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
What was sliced bread the greatest thing since?
#29 lore raw

PATCH v2 17/26 tools/Makefile: Give precedence to U-Boot's include directory

Quoted 10 lines · Wolfgang Denk

Dear Mike Frysinger,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 4 lines · On Thursday 12 March 2009 15:49:06 Peter Tyser wrote:

Update include search path so that the includes in U-Boot's include/ directory have precedence over system includes. This allows crc32.c to use U-Boot's zlib.h header which removes the previously required symlinked zlib.h.

Quoted 6 lines
Quoted 2 lines

this seems pretty risky. the headers in include/ are pretty much for u-boot. making those with the host headers seems like it's doomed to failure.

Indeed.

Full NAK from me, too.

So what's a good fix? U-Boot's crc32() prototype uses uint32_t while the standard zlib uses ulongs (It looks like Mike tried to keep U-Boot's zlib.h header in line with the standard zlib.h, but then resorted to using uint32_t's a year ago:
http://www.mail-archive.com/u-boot-users at lists.sourceforge.net/msg03726.html ).

The first workarounds that popped to mind are:
1. link with zlib to provide crc32() instead of compiling u-boot's version

2. keep doing the symlink song and dance to give u-boot's zlib.h priority

3. put u-boot's crc32() prototype back in line with zlib's and implement Mike's original solution

4. put u-boot's crc32() prototype back in line with zlib's and do some preprocessor magic (look at __SIZE_TYPE__, __LONG_MAX__, etc) - not sure if this is possible/portable

5. some other idea?

Thanks,
Peter

#30 lore raw

PATCH v2 17/26 tools/Makefile: Give precedence to U-Boot's include directory

Quoted 16 lines · Peter Tyser
Quoted 15 lines · Wolfgang Denk

Dear Mike Frysinger,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 4 lines · On Thursday 12 March 2009 15:49:06 Peter Tyser wrote:

Update include search path so that the includes in U-Boot's include/ directory have precedence over system includes. ?This allows crc32.c to use U-Boot's zlib.h header which removes the previously required symlinked zlib.h.

this seems pretty risky. ?the headers in include/ are pretty much for u-boot. making those with the host headers seems like it's doomed to failure.

Indeed.

Quoted 7 lines
Quoted 1 line

Full NAK from me, too.

So what's a good fix? ?U-Boot's crc32() prototype uses uint32_t while the standard zlib uses ulongs (It looks like Mike tried to keep U-Boot's zlib.h header in line with the standard zlib.h, but then resorted to using uint32_t's a year ago:
http://www.mail-archive.com/u-boot-users at lists.sourceforge.net/msg03726.html ).

Take a look at 20a14a42a25f72e379f38460b8a8484667536795

Basically, modify the tools to explicitly go after the u-boot version of the header when that is the desired behavior.

Andy

#31 lore raw

PATCH v2 17/26 tools/Makefile: Give precedence to U-Boot's include directory

Quoted 17 lines · Andy Fleming
Quoted 16 lines · Peter Tyser
Quoted 15 lines · Wolfgang Denk

Dear Mike Frysinger,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 4 lines · On Thursday 12 March 2009 15:49:06 Peter Tyser wrote:

Update include search path so that the includes in U-Boot's include/ directory have precedence over system includes. This allows crc32.c to use U-Boot's zlib.h header which removes the previously required symlinked zlib.h.

this seems pretty risky. the headers in include/ are pretty much for u-boot. making those with the host headers seems like it's doomed to failure.

Indeed.

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Full NAK from me, too.

So what's a good fix? U-Boot's crc32() prototype uses uint32_t while the standard zlib uses ulongs (It looks like Mike tried to keep U-Boot's zlib.h header in line with the standard zlib.h, but then resorted to using uint32_t's a year ago:
http://www.mail-archive.com/u-boot-users at lists.sourceforge.net/msg03726.html ).

Thanks Andy, that looks a lot cleaner and simpler. I'll resubmit the series shortly.

Peter

#32 lore raw

PATCH v2 17/26 tools/Makefile: Give precedence to U-Boot's include directory

In reply to Peter Tyser

Makefile clobber: clean · line 3485

Quoted 2 lines · Peter Tyser
Makefile +1 -1
-	@rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,zlib.h}
+	@rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,}

That comma at the end looks like it would delete the tools directory, except for the lack of -r.

-Scott

#33 lore raw

PATCH v2 17/26 tools/Makefile: Give precedence to U-Boot's include directory

Quoted 6 lines · Scott Wood

Makefile clobber: clean · line 3485

Quoted 2 lines · Peter Tyser
Makefile +1 -1
-	@rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,zlib.h}
+	@rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,}

That comma at the end looks like it would delete the tools directory, except for the lack of -r.

Thanks for the catch. Do maintainers generally prefer that just the 1 patch be resubmitted, or the whole patch series?

#34 lore raw

PATCH v2 17/26 tools/Makefile: Give precedence to U-Boot's include directory

Dear Peter Tyser,

Quoted 10 lines · In message <[email protected]> you wrote:
Quoted 6 lines · Scott Wood

Makefile clobber: clean · line 3485

Quoted 2 lines · Peter Tyser
Makefile +1 -1
-	@rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,zlib.h}
+	@rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,}

That comma at the end looks like it would delete the tools directory, except for the lack of -r.

Thanks for the catch. Do maintainers generally prefer that just the 1 patch be resubmitted, or the whole patch series?

As long as you have to repost only one (or two) of the patches, just post these. When many patches of the series need to be updated, you probably want to regenerate the whole seris anyway to make sure it still applies.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Worlds may change, galaxies disintegrate, but a woman always  remains
a woman.
	-- Kirk, "The Conscience of the King", stardate 2818.9
#35 lore raw

PATCH v2 17/26 tools/Makefile: Give precedence to U-Boot's include directory

In reply to Scott Wood
Quoted 6 lines · Scott Wood

Makefile clobber: clean · line 3485

Quoted 2 lines · Peter Tyser
Makefile +1 -1
-	@rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,zlib.h}
+	@rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,}

That comma at the end looks like it would delete the tools directory, except for the lack of -r.

Hi Wolfgang,
The issue Scott brought up is not present in the most recent version (v3) of the patchset, so I won't be sending a fix as I implied in a previous email. Feel free to merge the changeset if/when you feel comfortable with it.

Best,
Peter

#36 lore raw

PATCH v2 17/26 tools/Makefile: Give precedence to U-Boot's include directory

Quoted 9 lines · On Monday 23 March 2009 10:43:55 Peter Tyser wrote:
Quoted 7 lines · Scott Wood

Makefile clobber: clean · line 3485

Quoted 3 lines · Peter Tyser
(quoted diff) +0 -1
-	@rm -f

$(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,zlib.h}

Makefile +1 -0
+	@rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,}

That comma at the end looks like it would delete the tools directory, except for the lack of -r.

Quoted 5 lines

Hi Wolfgang,
The issue Scott brought up is not present in the most recent version (v3) of the patchset, so I won't be sending a fix as I implied in a previous email. Feel free to merge the changeset if/when you feel comfortable with it.

you can post individual updates to a thread (since git send-email allows you to set the reply-to id). so if you post a patchset (v2) and only one or two patches needs a tweak, post those updates as sub-replies.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090323/0fae4195/attachment.pgp

#37 lore raw

PATCH v2 1/26 Makefile: Make autoconf.mk a dependency of the depend target

In reply to Peter Tyser

Dear Peter Tyser,

Quoted 5 lines · In message <[email protected]> you wrote:

The original code did not generate autoconf.mk until after some targets dependencies had already been calculated, for example the directories in the SUBDIRS variable

Just a question on this patch series - is it based on the "next" branch?

Best regards,

Wolfgang Denk

Signature · 3 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
#38 lore raw

PATCH v2 1/26 Makefile: Make autoconf.mk a dependency of the depend target

Quoted 11 lines · Wolfgang Denk

Dear Peter Tyser,

Quoted 5 lines · In message <[email protected]> you wrote:

The original code did not generate autoconf.mk until after some targets dependencies had already been calculated, for example the directories in the SUBDIRS variable

Just a question on this patch series - is it based on the "next" branch?

Testing/development was done on the "master" branch, but I did verify the series applies cleanly to the "next" branch. The binaries generated when using the "next" branch code "appeared" to work at a quick glance. Let me know if you'd prefer to apply it to the "next" branch and I can do a bit more testing quickly.

Best,
Peter

#39 lore raw

PATCH v2 1/26 Makefile: Make autoconf.mk a dependency of the depend target

Dear Peter Tyser,

Quoted 6 lines · In message <[email protected]> you wrote:

Testing/development was done on the "master" branch, but I did verify the series applies cleanly to the "next" branch. The binaries generated when using the "next" branch code "appeared" to work at a quick glance. Let me know if you'd prefer to apply it to the "next" branch and I can do a bit more testing quickly.

It is not a strict bug fix and this will not go in befopre the next merge window opens. And I posted a request that allpatches for the next release should be based on the "next" branch.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I didn't know it was impossible when I did it."