[U-Boot-Users] [PATCH] cygwin build fixes

Lars Munch lars at segv.dk
Sat Jul 24 21:40:56 CEST 2004


On Fri, Jul 23, 2004 at 09:34:33AM -0400, Povolotsky, Alexander wrote:
> apovolot at USPITLAD104868 ~/U-boot/u-boot-1.1.1
> $ make  MPC8260ADS_config
> Configuring for MPC8260ADS board...
> 
> apovolot at USPITLAD104868 ~/U-boot/u-boot-1.1.1
> $ make all
> ...............
> make[1]: Entering directory
> `/cygdrive/d/Profiles/apovolot/U-boot/u-boot-1.1.1/t
> ools'
> gcc -Wall -pedantic -D__WIN32__ -I../include -I.. -DTEXT_BASE=0xfff00000
> -DUSE_H
> OSTCC -O -c -o img2srec.o img2srec.c
> In file included from img2srec.c:60:
> ../include/elf.h:46: warning: redefinition of `uint8_t'
> /usr/include/stdint.h:24: warning: `uint8_t' previously declared here
> ../include/elf.h:47: warning: redefinition of `uint16_t'
> /usr/include/stdint.h:25: warning: `uint16_t' previously declared here
> ../include/elf.h:48: error: conflicting types for `uint32_t'
> /usr/include/stdint.h:28: error: previous declaration of `uint32_t'
> make[1]: *** [img2srec.o] Error 1
> make[1]: Leaving directory
> `/cygdrive/d/Profiles/apovolot/U-boot/u-boot-1.1.1/to
> ols'
> make: *** [tools] Error 2

The attached patch fixes cygwin builds. inttypes.h has been included in cygwin
for quite some time now, so we do not need all the __WIN32__ ifdef's.

-- Lars Munch
-------------- next part --------------
Index: include/elf.h
===================================================================
RCS file: /cvsroot/u-boot/u-boot/include/elf.h,v
retrieving revision 1.4
diff -p -u -r1.4 elf.h
--- include/elf.h	30 Oct 2003 21:49:38 -0000	1.4
+++ include/elf.h	24 Jul 2004 19:14:15 -0000
@@ -37,15 +37,11 @@
     defined(__NetBSD__)  || \
     defined(__FreeBSD__) || \
     defined(__sun__)	 || \
-    defined(__APPLE__)
+    defined(__APPLE__)	 || \
+    defined(__WIN32__)
 #include <inttypes.h>
 #elif defined(__linux__) && defined(USE_HOSTCC)
 #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
 
 /*
Index: tools/mkimage.c
===================================================================
RCS file: /cvsroot/u-boot/u-boot/tools/mkimage.c,v
retrieving revision 1.13
diff -p -u -r1.13 mkimage.c
--- tools/mkimage.c	10 Jul 2004 22:36:01 -0000	1.13
+++ tools/mkimage.c	24 Jul 2004 19:14:23 -0000
@@ -25,35 +25,16 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#ifndef __WIN32__
 #include <netinet/in.h>		/* for host / network byte order conversions	*/
-#endif
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <time.h>
 #include <unistd.h>
 
-#if defined(__BEOS__) || defined(__NetBSD__) || defined(__APPLE__)
+#if defined(__BEOS__) || defined(__NetBSD__) || defined(__APPLE__) || defined(__WIN32__)
 #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


More information about the U-Boot mailing list