summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2015-12-17 07:06:42 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-24 09:40:32 +0000
commita9dfcedd21a5fe212d237633f40e2efcdfb34690 (patch)
tree5f4e861edc8930ca6d11da03e5abd7856be0638e /meta/recipes-kernel
parent3cffa6da39b88d845208cd0d7f5186b247067d6c (diff)
downloadpoky-a9dfcedd21a5fe212d237633f40e2efcdfb34690.tar.gz
linux-libc-headers: Port patches for linux-headers for musl
These patches have revealed issues with linux kernel headers which has been proposed upstream but hasnt been applied yet (From OE-Core rev: 8d760bd9df101a03f148205e7d79b555b4dfd8c7) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel')
-rw-r--r--meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch89
-rw-r--r--meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch59
-rw-r--r--meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch32
-rw-r--r--meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4.bb5
4 files changed, 185 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch
new file mode 100644
index 0000000000..6ad479863e
--- /dev/null
+++ b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch
@@ -0,0 +1,89 @@
1From 2872f5d8bcef84e62b15b37ba4ffeccfb6402dad Mon Sep 17 00:00:00 2001
2From: rofl0r <retnyg@gmx.net>
3Date: Wed, 22 Jan 2014 00:48:28 +0100
4Subject: [PATCH 1/3] libc-compat.h: fix some issues arising from in6.h
5
6namely redefinition of some structs provided by netinet/in.h.
7---
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9Upstream-Status: Submitted
10
11 include/uapi/linux/libc-compat.h | 25 ++++++++-----------------
12 1 file changed, 8 insertions(+), 17 deletions(-)
13
14Index: linux-4.4/include/uapi/linux/libc-compat.h
15===================================================================
16--- linux-4.4.orig/include/uapi/linux/libc-compat.h
17+++ linux-4.4/include/uapi/linux/libc-compat.h
18@@ -48,13 +48,12 @@
19 #ifndef _UAPI_LIBC_COMPAT_H
20 #define _UAPI_LIBC_COMPAT_H
21
22-/* We have included glibc headers... */
23-#if defined(__GLIBC__)
24+#ifndef __KERNEL__ /* we're used from userspace */
25
26-/* Coordinate with glibc netinet/in.h header. */
27+/* Coordinate with libc netinet/in.h header. */
28 #if defined(_NETINET_IN_H)
29
30-/* GLIBC headers included first so don't define anything
31+/* LIBC headers included first so don't define anything
32 * that would already be defined. */
33 #define __UAPI_DEF_IN_ADDR 0
34 #define __UAPI_DEF_IN_IPPROTO 0
35@@ -64,15 +63,7 @@
36 #define __UAPI_DEF_IN_CLASS 0
37
38 #define __UAPI_DEF_IN6_ADDR 0
39-/* The exception is the in6_addr macros which must be defined
40- * if the glibc code didn't define them. This guard matches
41- * the guard in glibc/inet/netinet/in.h which defines the
42- * additional in6_addr macros e.g. s6_addr16, and s6_addr32. */
43-#if defined(__USE_MISC) || defined (__USE_GNU)
44 #define __UAPI_DEF_IN6_ADDR_ALT 0
45-#else
46-#define __UAPI_DEF_IN6_ADDR_ALT 1
47-#endif
48 #define __UAPI_DEF_SOCKADDR_IN6 0
49 #define __UAPI_DEF_IPV6_MREQ 0
50 #define __UAPI_DEF_IPPROTO_V6 0
51@@ -80,10 +71,10 @@
52 #define __UAPI_DEF_IN6_PKTINFO 0
53 #define __UAPI_DEF_IP6_MTUINFO 0
54
55-#else
56+#else /* defined(_NETINET_IN_H) */
57
58 /* Linux headers included first, and we must define everything
59- * we need. The expectation is that glibc will check the
60+ * we need. The expectation is that libc will check the
61 * __UAPI_DEF_* defines and adjust appropriately. */
62 #define __UAPI_DEF_IN_ADDR 1
63 #define __UAPI_DEF_IN_IPPROTO 1
64@@ -93,7 +84,7 @@
65 #define __UAPI_DEF_IN_CLASS 1
66
67 #define __UAPI_DEF_IN6_ADDR 1
68-/* We unconditionally define the in6_addr macros and glibc must
69+/* We unconditionally define the in6_addr macros and libc must
70 * coordinate. */
71 #define __UAPI_DEF_IN6_ADDR_ALT 1
72 #define __UAPI_DEF_SOCKADDR_IN6 1
73@@ -115,7 +106,7 @@
74 /* If we did not see any headers from any supported C libraries,
75 * or we are being included in the kernel, then define everything
76 * that we need. */
77-#else /* !defined(__GLIBC__) */
78+#else /* __KERNEL__ */
79
80 /* Definitions for in.h */
81 #define __UAPI_DEF_IN_ADDR 1
82@@ -138,6 +129,6 @@
83 /* Definitions for xattr.h */
84 #define __UAPI_DEF_XATTR 1
85
86-#endif /* __GLIBC__ */
87+#endif /* __KERNEL__ */
88
89 #endif /* _UAPI_LIBC_COMPAT_H */
diff --git a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch
new file mode 100644
index 0000000000..c617093749
--- /dev/null
+++ b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch
@@ -0,0 +1,59 @@
1From 75ba4a547282f91d653872a4bba5f5eae234ea6c Mon Sep 17 00:00:00 2001
2From: rofl0r <retnyg@gmx.net>
3Date: Wed, 22 Jan 2014 00:57:48 +0100
4Subject: [PATCH 2/3] libc-compat.h: prevent redefinition of struct ethhdr
5
6---
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8Upstream-Status: Submitted
9
10 include/uapi/linux/if_ether.h | 4 +++-
11 include/uapi/linux/libc-compat.h | 6 ++++++
12 2 files changed, 9 insertions(+), 1 deletion(-)
13
14diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
15index aa63ed0..e94da57 100644
16--- a/include/uapi/linux/if_ether.h
17+++ b/include/uapi/linux/if_ether.h
18@@ -22,6 +22,7 @@
19 #define _UAPI_LINUX_IF_ETHER_H
20
21 #include <linux/types.h>
22+#include <linux/libc-compat.h>
23
24 /*
25 * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
26@@ -134,11 +135,12 @@
27 * This is an Ethernet frame header.
28 */
29
30+#if __UAPI_DEF_ETHHDR
31 struct ethhdr {
32 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
33 unsigned char h_source[ETH_ALEN]; /* source ether addr */
34 __be16 h_proto; /* packet type ID field */
35 } __attribute__((packed));
36-
37+#endif
38
39 #endif /* _UAPI_LINUX_IF_ETHER_H */
40diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
41index afe15c2..7d0c78a 100644
42--- a/include/uapi/linux/libc-compat.h
43+++ b/include/uapi/linux/libc-compat.h
44@@ -50,6 +50,12 @@
45
46 #ifndef __KERNEL__ /* we're used from userspace */
47
48+#ifdef _NETINET_IF_ETHER_H /* musl */
49+#define __UAPI_DEF_ETHHDR 0
50+#else /* glibc uses __NETINET_IF_ETHER_H, and includes the kernel header. */
51+#define __UAPI_DEF_ETHHDR 1
52+#endif
53+
54 /* Coordinate with libc netinet/in.h header. */
55 #if defined(_NETINET_IN_H)
56
57--
582.6.4
59
diff --git a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch
new file mode 100644
index 0000000000..6d9e8d864e
--- /dev/null
+++ b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch
@@ -0,0 +1,32 @@
1From 8e69b663d6ddef132041a1186f081fdd74d4a31d Mon Sep 17 00:00:00 2001
2From: rofl0r <retnyg@gmx.net>
3Date: Mon, 20 Jan 2014 21:31:34 +0100
4Subject: [PATCH 3/3] remove inclusion of sysinfo.h in kernel.h
5
6the declaration of struct sysinfo clashes with userspace.
7it's not quite clear why that header was included from kernel.h,
8as none of its functionality is needed.
9---
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11Upstream-Status: Submitted
12
13 include/uapi/linux/kernel.h | 2 ++
14 1 file changed, 2 insertions(+)
15
16diff --git a/include/uapi/linux/kernel.h b/include/uapi/linux/kernel.h
17index 321e399..e8ff821 100644
18--- a/include/uapi/linux/kernel.h
19+++ b/include/uapi/linux/kernel.h
20@@ -1,7 +1,9 @@
21 #ifndef _UAPI_LINUX_KERNEL_H
22 #define _UAPI_LINUX_KERNEL_H
23
24+#ifdef __GLIBC__
25 #include <linux/sysinfo.h>
26+#endif
27
28 /*
29 * 'kernel.h' contains some often-used function prototypes etc
30--
312.6.4
32
diff --git a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4.bb b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4.bb
index 4433db7515..3763dc0d3a 100644
--- a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4.bb
+++ b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4.bb
@@ -1,4 +1,9 @@
1require linux-libc-headers.inc 1require linux-libc-headers.inc
2 2
3SRC_URI_append_libc-musl = "\
4 file://0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch \
5 file://0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch \
6 file://0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch \
7 "
3SRC_URI[md5sum] = "9a78fa2eb6c68ca5a40ed5af08142599" 8SRC_URI[md5sum] = "9a78fa2eb6c68ca5a40ed5af08142599"
4SRC_URI[sha256sum] = "401d7c8fef594999a460d10c72c5a94e9c2e1022f16795ec51746b0d165418b2" 9SRC_URI[sha256sum] = "401d7c8fef594999a460d10c72c5a94e9c2e1022f16795ec51746b0d165418b2"