tools/mkimage: fix musl build
[librecmc/librecmc.git] / tools / mkimage / patches / 110-fix_musl_build.patch
1 From: Jörg Krause <joerg.krause@embedded.rocks>
2 Date: Wed, 22 Apr 2015 19:36:22 +0000 (+0200)
3 Subject: Fix musl build
4 X-Git-Tag: v2015.07-rc2~281
5 X-Git-Url: http://git.denx.de/?p=u-boot.git;a=commitdiff_plain;h=26e355d131a6b56ea78a156c1cee4f6ba0500b37;hp=1cdd9412002000aafcfb6f10cd02069adc66ba49
6
7 Fix musl build
8
9 This patch fixes cross-compiling U-Boot tools with the musl C library:
10   * including <sys/types.h> is needed for ulong
11   * defining _GNU_SOURCE is needed for loff_t
12
13 Tested for target at91sam9261ek_dataflash_cs3.
14
15 Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
16 Cc: Tom Rini <trini@konsulko.com>
17 ---
18
19 diff --git a/include/image.h b/include/image.h
20 index 3844be6..60b924a 100644
21 --- a/include/image.h
22 +++ b/include/image.h
23 @@ -23,6 +23,7 @@
24  struct lmb;
25  
26  #ifdef USE_HOSTCC
27 +#include <sys/types.h>
28  
29  /* new uImage format support enabled on host */
30  #define CONFIG_FIT             1
31 diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
32 index 1173eea..daa02a7 100644
33 --- a/tools/env/fw_env.c
34 +++ b/tools/env/fw_env.c
35 @@ -8,6 +8,8 @@
36   * SPDX-License-Identifier:    GPL-2.0+
37   */
38  
39 +#define _GNU_SOURCE
40 +
41  #include <errno.h>
42  #include <env_flags.h>
43  #include <fcntl.h>
44 diff --git a/tools/imagetool.h b/tools/imagetool.h
45 index 3e15b4e..b7874f4 100644
46 --- a/tools/imagetool.h
47 +++ b/tools/imagetool.h
48 @@ -16,6 +16,7 @@
49  #include <stdlib.h>
50  #include <string.h>
51  #include <sys/stat.h>
52 +#include <sys/types.h>
53  #include <time.h>
54  #include <unistd.h>
55  #include <u-boot/sha1.h>
56 diff --git a/tools/proftool.c b/tools/proftool.c
57 index 3482951..9ce7a77 100644
58 --- a/tools/proftool.c
59 +++ b/tools/proftool.c
60 @@ -16,6 +16,7 @@
61  #include <string.h>
62  #include <unistd.h>
63  #include <sys/param.h>
64 +#include <sys/types.h>
65  
66  #include <compiler.h>
67  #include <trace.h>