b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | From 590b23a46b7ae0f5ec5e8f57a85c0e7578c71141 Mon Sep 17 00:00:00 2001 |
| 2 | From: Hauke Mehrtens <hauke@hauke-m.de> |
| 3 | Date: Sun, 26 Apr 2020 17:15:17 +0200 |
| 4 | Subject: [PATCH 1/2] Add compatibility with non Linux hosts |
| 5 | |
| 6 | This adds some changes to the u-boot tools to make it possible to build |
| 7 | them on non Linux hosts like MacOS or FreeBSD. |
| 8 | |
| 9 | asm/byteorder.h, asm/posix_types.h, asm/types.h and linux/kernel.h are |
| 10 | not available on such systems. Remove the include and add the necessary |
| 11 | parts for these header files manually or remove the usage too. |
| 12 | |
| 13 | __u64 is not available on FreeBSD, remove its usage. |
| 14 | |
| 15 | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> |
| 16 | --- |
| 17 | include/image.h | 2 ++ |
| 18 | include/linux/posix_types.h | 2 ++ |
| 19 | include/linux/types.h | 4 +++- |
| 20 | 3 files changed, 7 insertions(+), 1 deletion(-) |
| 21 | |
| 22 | --- a/include/image.h |
| 23 | +++ b/include/image.h |
| 24 | @@ -16,7 +16,9 @@ |
| 25 | #define __IMAGE_H__ |
| 26 | |
| 27 | #include "compiler.h" |
| 28 | +#ifdef linux |
| 29 | #include <asm/byteorder.h> |
| 30 | +#endif |
| 31 | #include <stdbool.h> |
| 32 | |
| 33 | /* Define this to avoid #ifdefs later on */ |
| 34 | --- a/include/linux/posix_types.h |
| 35 | +++ b/include/linux/posix_types.h |
| 36 | @@ -43,6 +43,8 @@ typedef void (*__kernel_sighandler_t)(in |
| 37 | /* Type of a SYSV IPC key. */ |
| 38 | typedef int __kernel_key_t; |
| 39 | |
| 40 | +#ifdef linux |
| 41 | #include <asm/posix_types.h> |
| 42 | +#endif |
| 43 | |
| 44 | #endif /* _LINUX_POSIX_TYPES_H */ |
| 45 | --- a/include/linux/types.h |
| 46 | +++ b/include/linux/types.h |
| 47 | @@ -2,7 +2,9 @@ |
| 48 | #define _LINUX_TYPES_H |
| 49 | |
| 50 | #include <linux/posix_types.h> |
| 51 | +#ifdef linux |
| 52 | #include <asm/types.h> |
| 53 | +#endif |
| 54 | #include <stdbool.h> |
| 55 | |
| 56 | #ifndef __KERNEL_STRICT_NAMES |
| 57 | @@ -142,7 +144,7 @@ typedef __u16 __bitwise __le16; |
| 58 | typedef __u16 __bitwise __be16; |
| 59 | typedef __u32 __bitwise __le32; |
| 60 | typedef __u32 __bitwise __be32; |
| 61 | -#if defined(__GNUC__) |
| 62 | +#if defined(__GNUC__) && defined(linux) |
| 63 | typedef __u64 __bitwise __le64; |
| 64 | typedef __u64 __bitwise __be64; |
| 65 | #endif |