ipq807x: add kmod-wireguard backport package

Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2022-06-07 07:19:53 +02:00
parent bfe7fadfc5
commit 99ea9da785
3 changed files with 85 additions and 1 deletions

View File

@@ -0,0 +1,55 @@
#
# Copyright (C) 2016-2019 Jason A. Donenfeld <Jason@zx2c4.com>
# Copyright (C) 2016 Baptiste Jonglez <openwrt@bitsofnetworks.org>
# Copyright (C) 2016-2017 Dan Luedtke <mail@danrl.com>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=wireguard-backport
PKG_VERSION:=1.0.20211208
PKG_RELEASE:=1
PKG_SOURCE:=wireguard-linux-compat-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://git.zx2c4.com/wireguard-linux-compat/snapshot/
PKG_HASH:=c0e607138a17daac656f508d8e63ea3737b5221fa5d9288191ddeb099f5a3b92
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/wireguard-linux-compat-$(PKG_VERSION)
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
# WireGuard's makefile needs this to know where to build the kernel module
export KERNELDIR:=$(LINUX_DIR)
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/kernel-defaults.mk
include $(INCLUDE_DIR)/package-defaults.mk
define Build/Compile
$(MAKE) $(KERNEL_MAKEOPTS) M="$(PKG_BUILD_DIR)/src" modules
endef
define KernelPackage/wireguard-backport
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Support
TITLE:=WireGuard kernel module
DEPENDS:=+IPV6:kmod-udptunnel6 +kmod-udptunnel4
FILES:= $(PKG_BUILD_DIR)/src/wireguard.$(LINUX_KMOD_SUFFIX)
AUTOLOAD:=$(call AutoProbe,wireguard)
endef
define KernelPackage/wireguard-backport/description
$(call Package/wireguard/Default/description)
This package provides the kernel module for WireGuard.
endef
$(eval $(call KernelPackage,wireguard-backport))

View File

@@ -0,0 +1,29 @@
Index: wireguard-linux-compat-1.0.20211208/src/compat/compat.h
===================================================================
--- wireguard-linux-compat-1.0.20211208.orig/src/compat/compat.h
+++ wireguard-linux-compat-1.0.20211208/src/compat/compat.h
@@ -11,6 +11,8 @@
#include <linux/types.h>
#include <generated/utsrelease.h>
+#define fallthrough
+
#ifdef RHEL_MAJOR
#if RHEL_MAJOR == 7
#define ISRHEL7
@@ -686,15 +688,6 @@ struct __compat_dummy_container { char d
#define genl_dump_check_consistent(a, b) genl_dump_check_consistent(a, b, &genl_family)
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && !defined(ISRHEL7)
-static inline void *skb_put_data(struct sk_buff *skb, const void *data, unsigned int len)
-{
- void *tmp = skb_put(skb, len);
- memcpy(tmp, data, len);
- return tmp;
-}
-#endif
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) && !defined(ISRHEL7)
#define napi_complete_done(n, work_done) napi_complete(n)
#endif

View File

@@ -26,7 +26,7 @@ define Package/unetd
SECTION:=utils
CATEGORY:=Base system
TITLE:=Wireguard network configuration service
DEPENDS:=+libubox +libubus +libblobmsg-json +libnl-tiny +kmod-wireguard
DEPENDS:=+libubox +libubus +libblobmsg-json +libnl-tiny +TARGET_ipq807x:kmod-wireguard-backport +!TARGET_ipq807x:kmod-wireguard
endef
TARGET_CFLAGS += \