summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/easy-kernel/APKBUILD8
-rw-r--r--system/easy-kernel/kernel.h17
-rw-r--r--system/easy-kernel/uapi-ether.patch60
3 files changed, 84 insertions, 1 deletions
diff --git a/system/easy-kernel/APKBUILD b/system/easy-kernel/APKBUILD
index 49a532ca8..d98dc529f 100644
--- a/system/easy-kernel/APKBUILD
+++ b/system/easy-kernel/APKBUILD
@@ -24,6 +24,8 @@ source="https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.14.tar.xz
config-pmmx
config-aarch64
futex-cmpxchg.patch
+ kernel.h
+ uapi-ether.patch
"
builddir="$srcdir/linux-4.14"
@@ -94,6 +96,8 @@ headers() {
# needed for spl, VMware on x86, etc
install -D -m644 "$builddir"/include/generated/utsrelease.h \
"$subpkgdir"/usr/include/linux/utsrelease.h
+
+ cp "$srcdir"/kernel.h "$subpkgdir"/usr/include/linux/
}
src() {
@@ -110,4 +114,6 @@ e41d9111219342ad13367902242444ecdd847a93575c3f9709d6c6a075bc650f4a15be9db1a87984
438a66561200d570b3bf6ab0481d9725a9f482b1fcf852a90f99c6db5aa4ee02d2b67b57235bb7afc01515a79289407cbe111536340824d7a391ce1a658c9a76 config-x86_64
e8f7749877c5b2574e7e853b757477b8f99d757b43225d4f83d611c20215b8b2690cc85369608c2dc8f7d6a619136a2d7dde4648031e37d2ae4dcc5ba85652c8 config-pmmx
0174e758ea318171c8036426ed0ad22aaafbdbac755732a46397686ec8dd24e977447f6fc275d59eed43ea047fc8a36061b7ad0d5862d522222455a60c943027 config-aarch64
-64486a4f53046a69f727cecd8c39400b50c2d2b15e3b5ca8c18b8249d25990f3a872ec064800ba3d190f9d25b4518899b9ea3675920f487108102856d6beb51e futex-cmpxchg.patch"
+64486a4f53046a69f727cecd8c39400b50c2d2b15e3b5ca8c18b8249d25990f3a872ec064800ba3d190f9d25b4518899b9ea3675920f487108102856d6beb51e futex-cmpxchg.patch
+fdd94b9de7b374f1812dec0f9971c05f5e52177ca4a16c8071daa620c18265b38f656f528e7045a24f30af01f05e53e54546fb0a9e93773cf191866e87de505d kernel.h
+af093e91e8c8371629948e2e574f8764078564bc027ba5b2f87886f8827d9a63ba7a43717552fe7e3cc9212b2fd55b8633b12900c3d8cdc6c035d52b389c39e5 uapi-ether.patch"
diff --git a/system/easy-kernel/kernel.h b/system/easy-kernel/kernel.h
new file mode 100644
index 000000000..b2d59deef
--- /dev/null
+++ b/system/easy-kernel/kernel.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _UAPI_LINUX_KERNEL_H
+#define _UAPI_LINUX_KERNEL_H
+
+#ifdef __GLIBC__
+#include <linux/sysinfo.h>
+#endif
+
+/*
+ * 'kernel.h' contains some often-used function prototypes etc
+ */
+#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
+#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
+
+#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+
+#endif /* _UAPI_LINUX_KERNEL_H */
diff --git a/system/easy-kernel/uapi-ether.patch b/system/easy-kernel/uapi-ether.patch
new file mode 100644
index 000000000..480b78e57
--- /dev/null
+++ b/system/easy-kernel/uapi-ether.patch
@@ -0,0 +1,60 @@
+From 6926e041a8920c8ec27e4e155efa760aa01551fd Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Wed, 3 Jan 2018 23:14:21 +0100
+Subject: [PATCH] uapi/if_ether.h: prevent redefinition of struct ethhdr
+
+Musl provides its own ethhdr struct definition. Add a guard to prevent
+its definition of the appropriate musl header has already been included.
+
+glibc does not implement this header, but when glibc will implement this
+they can just define __UAPI_DEF_ETHHDR 0 to make it work with the
+kernel.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ include/uapi/linux/if_ether.h | 3 +++
+ include/uapi/linux/libc-compat.h | 6 ++++++
+ 2 files changed, 9 insertions(+)
+
+diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
+index 3ee3bf7c85262..144de4d2f385e 100644
+--- a/include/uapi/linux/if_ether.h
++++ b/include/uapi/linux/if_ether.h
+@@ -23,6 +23,7 @@
+ #define _UAPI_LINUX_IF_ETHER_H
+
+ #include <linux/types.h>
++#include <linux/libc-compat.h>
+
+ /*
+ * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
+@@ -149,11 +150,13 @@
+ * This is an Ethernet frame header.
+ */
+
++#if __UAPI_DEF_ETHHDR
+ struct ethhdr {
+ unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
+ unsigned char h_source[ETH_ALEN]; /* source ether addr */
+ __be16 h_proto; /* packet type ID field */
+ } __attribute__((packed));
++#endif
+
+
+ #endif /* _UAPI_LINUX_IF_ETHER_H */
+diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
+index 8254c937c9f45..fc29efaa918cb 100644
+--- a/include/uapi/linux/libc-compat.h
++++ b/include/uapi/linux/libc-compat.h
+@@ -264,4 +264,10 @@
+
+ #endif /* __GLIBC__ */
+
++/* Definitions for if_ether.h */
++/* allow libcs like musl to deactivate this, glibc does not implement this. */
++#ifndef __UAPI_DEF_ETHHDR
++#define __UAPI_DEF_ETHHDR 1
++#endif
++
+ #endif /* _UAPI_LIBC_COMPAT_H */