[U-Boot] [PATCH 1/1] add u-boot/types to simplify HOST support

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sat Aug 16 18:56:16 CEST 2008


add fix MacOS HOST support

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
 include/elf.h          |   15 +------------
 include/environment.h  |    6 +----
 include/image.h        |    1 +
 include/libfdt_env.h   |    3 +-
 include/u-boot/md5.h   |    2 +-
 include/u-boot/types.h |   53 ++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 58 insertions(+), 22 deletions(-)
 create mode 100644 include/u-boot/types.h

diff --git a/include/elf.h b/include/elf.h
index a9839df..88d76bd 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -33,20 +33,7 @@
 #ifndef _ELF_H
 #define _ELF_H
 
-#if defined(__BEOS__)	 || \
-    defined(__NetBSD__)  || \
-    defined(__FreeBSD__) || \
-    defined(__sun__)	 || \
-    defined(__APPLE__)
-#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
+#include <u-boot/types.h>
 
 /*
  *  This version doesn't work for 64-bit ABIs - Erik.
diff --git a/include/environment.h b/include/environment.h
index 481ea73..d9d75cb 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -84,11 +84,7 @@
 # endif
 #endif /* CFG_ENV_IS_IN_NAND */
 
-#ifdef USE_HOSTCC
-# include <stdint.h>
-#else
-# include <linux/types.h>
-#endif
+#include <u-boot/types.h>
 
 #ifdef CFG_REDUNDAND_ENVIRONMENT
 # define ENV_HEADER_SIZE	(sizeof(uint32_t) + 1)
diff --git a/include/image.h b/include/image.h
index 4b9c582..0f1a5f4 100644
--- a/include/image.h
+++ b/include/image.h
@@ -35,6 +35,7 @@
 
 #include <asm/byteorder.h>
 #include <command.h>
+#include <u-boot/types.h>
 
 #ifndef USE_HOSTCC
 #include <lmb.h>
diff --git a/include/libfdt_env.h b/include/libfdt_env.h
index a7fd2f8..d5b1c12 100644
--- a/include/libfdt_env.h
+++ b/include/libfdt_env.h
@@ -21,12 +21,11 @@
 #ifndef _LIBFDT_ENV_H
 #define _LIBFDT_ENV_H
 
+#include <u-boot/types.h>
 #ifdef USE_HOSTCC
-#include <stdint.h>
 #include <string.h>
 #else
 #include <linux/string.h>
-#include <linux/types.h>
 #endif /* USE_HOSTCC */
 
 #include <stddef.h>
diff --git a/include/u-boot/md5.h b/include/u-boot/md5.h
index 8b44a7f..0e3f3bc 100644
--- a/include/u-boot/md5.h
+++ b/include/u-boot/md5.h
@@ -6,7 +6,7 @@
 #ifndef _MD5_H
 #define _MD5_H
 
-#include <linux/types.h>
+#include <u-boot/types.h>
 
 struct MD5Context {
 	__u32 buf[4];
diff --git a/include/u-boot/types.h b/include/u-boot/types.h
new file mode 100644
index 0000000..e4afa98
--- /dev/null
+++ b/include/u-boot/types.h
@@ -0,0 +1,53 @@
+/*
+ * (C) Copyright 2008 Jean-Christophe PLAGNIOL-VILLARD
+ *  <plagnioj at jcrosft.com>
+ *
+ * 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
+ */
+
+#ifndef __U_BOOT_TYPES_H__
+#define __U_BOOT_TYPES_H__
+
+#ifndef USE_HOSTCC
+#include <linux/types.h>
+#else
+
+#if defined(__BEOS__)	 || \
+    defined(__NetBSD__)  || \
+    defined(__FreeBSD__) || \
+    defined(__sun__)	 || \
+    defined(__APPLE__)
+#include <inttypes.h>
+/* sysv */
+typedef unsigned char	unchar;
+typedef unsigned short	ushort;
+typedef unsigned int	uint;
+typedef unsigned long	ulong;
+
+#elif defined(__linux__)
+#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
+#endif /* USE_HOSTCC */
+
+#endif /* __U_BOOT_TYPES_H__ */
-- 
1.5.6.3




More information about the U-Boot mailing list