From 5fc52203e4e308f35c7c3b443e42f73f30ac7ba1 Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Wed, 18 Aug 2021 12:26:08 +0800 Subject: [PATCH] rtl8812au-ct: re-added package Fixes: 1a8c421 ("Merge Mainline") --- package/kernel/rtl8812au-ct/Makefile | 54 ++++++ .../patches/001-use-kernel-byteorder.patch | 15 ++ .../patches/002-vendor_command_policy.patch | 156 ++++++++++++++++++ .../patches/003-wireless-5.8.patch | 30 ++++ 4 files changed, 255 insertions(+) create mode 100644 package/kernel/rtl8812au-ct/Makefile create mode 100644 package/kernel/rtl8812au-ct/patches/001-use-kernel-byteorder.patch create mode 100644 package/kernel/rtl8812au-ct/patches/002-vendor_command_policy.patch create mode 100644 package/kernel/rtl8812au-ct/patches/003-wireless-5.8.patch diff --git a/package/kernel/rtl8812au-ct/Makefile b/package/kernel/rtl8812au-ct/Makefile new file mode 100644 index 0000000000..fa2cd295ab --- /dev/null +++ b/package/kernel/rtl8812au-ct/Makefile @@ -0,0 +1,54 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=rtl8812au-ct +PKG_RELEASE=1 + +PKG_LICENSE:=GPLv2 +PKG_LICENSE_FILES:= + +PKG_SOURCE_URL:=https://github.com/greearb/rtl8812AU_8821AU_linux.git +PKG_MIRROR_HASH:=aee819df4ba83251b59bd1d4f412287b27105e5de9284bb09579f0e1a1538328 +PKG_SOURCE_PROTO:=git +PKG_SOURCE_DATE:=2020-12-07 +PKG_SOURCE_VERSION:=1e9689c89fa627d2d764ba0e8359fd444fe8458f + +PKG_MAINTAINER:=Ben Greear +PKG_BUILD_PARALLEL:=1 +#PKG_EXTMOD_SUBDIRS:=rtl8812au-ct + +STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h + +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/rtl8812au-ct + SUBMENU:=Wireless Drivers + TITLE:=Driver for Realtek 8812 AU devices comfast 912-ac, etc + DEPENDS:=+kmod-cfg80211 +kmod-usb-core +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT + FILES:=\ + $(PKG_BUILD_DIR)/rtl8812au.ko + AUTOLOAD:=$(call AutoProbe,rtl8812au) + PROVIDES:=kmod-rtl8812au +endef + +NOSTDINC_FLAGS := \ + $(KERNEL_NOSTDINC_FLAGS) \ + -I$(PKG_BUILD_DIR) \ + -I$(PKG_BUILD_DIR)/include \ + -I$(STAGING_DIR)/usr/include/mac80211-backport \ + -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \ + -I$(STAGING_DIR)/usr/include/mac80211 \ + -I$(STAGING_DIR)/usr/include/mac80211/uapi \ + -include backport/backport.h + +NOSTDINC_FLAGS+=-DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT -DBUILD_OPENWRT + +define Build/Compile + +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ + $(KERNEL_MAKE_FLAGS) \ + M="$(PKG_BUILD_DIR)" \ + NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \ + modules +endef + +$(eval $(call KernelPackage,rtl8812au-ct)) diff --git a/package/kernel/rtl8812au-ct/patches/001-use-kernel-byteorder.patch b/package/kernel/rtl8812au-ct/patches/001-use-kernel-byteorder.patch new file mode 100644 index 0000000000..dd42b12438 --- /dev/null +++ b/package/kernel/rtl8812au-ct/patches/001-use-kernel-byteorder.patch @@ -0,0 +1,15 @@ +Fix compile problem when rtw_byteorder.h and asm/byteorder.h gets +included in addition for example indirectly, do not use realtek own copy +of the byteorder headers. + +--- a/include/drv_types.h ++++ b/include/drv_types.h +@@ -30,7 +30,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include diff --git a/package/kernel/rtl8812au-ct/patches/002-vendor_command_policy.patch b/package/kernel/rtl8812au-ct/patches/002-vendor_command_policy.patch new file mode 100644 index 0000000000..0b56ed6e59 --- /dev/null +++ b/package/kernel/rtl8812au-ct/patches/002-vendor_command_policy.patch @@ -0,0 +1,156 @@ +mac80211 from kernel 5.3 and later checks the new policy attribute. +As this driver does not define any policies and does strange things, +just tell mac80211 to ignore the policies. + +--- a/os_dep/linux/rtw_cfgvendor.c ++++ b/os_dep/linux/rtw_cfgvendor.c +@@ -1173,7 +1173,8 @@ static const struct wiphy_vendor_command + .subcmd = BRCM_VENDOR_SCMD_PRIV_STR + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_priv_string_handler ++ .doit = wl_cfgvendor_priv_string_handler, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + #if defined(GSCAN_SUPPORT) && 0 + { +@@ -1182,7 +1183,8 @@ static const struct wiphy_vendor_command + .subcmd = GSCAN_SUBCMD_GET_CAPABILITIES + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_gscan_get_capabilities ++ .doit = wl_cfgvendor_gscan_get_capabilities, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1190,7 +1192,8 @@ static const struct wiphy_vendor_command + .subcmd = GSCAN_SUBCMD_SET_CONFIG + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_set_scan_cfg ++ .doit = wl_cfgvendor_set_scan_cfg, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1198,7 +1201,8 @@ static const struct wiphy_vendor_command + .subcmd = GSCAN_SUBCMD_SET_SCAN_CONFIG + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_set_batch_scan_cfg ++ .doit = wl_cfgvendor_set_batch_scan_cfg, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1206,7 +1210,8 @@ static const struct wiphy_vendor_command + .subcmd = GSCAN_SUBCMD_ENABLE_GSCAN + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_initiate_gscan ++ .doit = wl_cfgvendor_initiate_gscan, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1214,7 +1219,8 @@ static const struct wiphy_vendor_command + .subcmd = GSCAN_SUBCMD_ENABLE_FULL_SCAN_RESULTS + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_enable_full_scan_result ++ .doit = wl_cfgvendor_enable_full_scan_result, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1222,7 +1228,8 @@ static const struct wiphy_vendor_command + .subcmd = GSCAN_SUBCMD_SET_HOTLIST + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_hotlist_cfg ++ .doit = wl_cfgvendor_hotlist_cfg, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1230,7 +1237,8 @@ static const struct wiphy_vendor_command + .subcmd = GSCAN_SUBCMD_SET_SIGNIFICANT_CHANGE_CONFIG + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_significant_change_cfg ++ .doit = wl_cfgvendor_significant_change_cfg, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1238,7 +1246,8 @@ static const struct wiphy_vendor_command + .subcmd = GSCAN_SUBCMD_GET_SCAN_RESULTS + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_gscan_get_batch_results ++ .doit = wl_cfgvendor_gscan_get_batch_results, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1246,7 +1255,8 @@ static const struct wiphy_vendor_command + .subcmd = GSCAN_SUBCMD_GET_CHANNEL_LIST + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_gscan_get_channel_list ++ .doit = wl_cfgvendor_gscan_get_channel_list, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + #endif /* GSCAN_SUPPORT */ + #if defined(RTT_SUPPORT) && 0 +@@ -1256,7 +1266,8 @@ static const struct wiphy_vendor_command + .subcmd = RTT_SUBCMD_SET_CONFIG + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_rtt_set_config ++ .doit = wl_cfgvendor_rtt_set_config, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1264,7 +1275,8 @@ static const struct wiphy_vendor_command + .subcmd = RTT_SUBCMD_CANCEL_CONFIG + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_rtt_cancel_config ++ .doit = wl_cfgvendor_rtt_cancel_config, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1272,7 +1284,8 @@ static const struct wiphy_vendor_command + .subcmd = RTT_SUBCMD_GETCAPABILITY + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_rtt_get_capability ++ .doit = wl_cfgvendor_rtt_get_capability, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + #endif /* RTT_SUPPORT */ + { +@@ -1281,7 +1294,8 @@ static const struct wiphy_vendor_command + .subcmd = ANDR_WIFI_SUBCMD_GET_FEATURE_SET + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = rtw_cfgvendor_get_feature_set ++ .doit = rtw_cfgvendor_get_feature_set, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1289,7 +1303,8 @@ static const struct wiphy_vendor_command + .subcmd = ANDR_WIFI_SUBCMD_GET_FEATURE_SET_MATRIX + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = rtw_cfgvendor_get_feature_set_matrix ++ .doit = rtw_cfgvendor_get_feature_set_matrix, ++ .policy = VENDOR_CMD_RAW_DATA, + } + }; + diff --git a/package/kernel/rtl8812au-ct/patches/003-wireless-5.8.patch b/package/kernel/rtl8812au-ct/patches/003-wireless-5.8.patch new file mode 100644 index 0000000000..67ebb82b38 --- /dev/null +++ b/package/kernel/rtl8812au-ct/patches/003-wireless-5.8.patch @@ -0,0 +1,30 @@ +--- a/os_dep/linux/ioctl_cfg80211.c ++++ b/os_dep/linux/ioctl_cfg80211.c +@@ -5177,6 +5177,15 @@ exit: + return ret; + } + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) || defined(BUILD_OPENWRT) ++static void cfg80211_rtw_update_mgmt_frame_registrations(struct wiphy *wiphy, ++ struct wireless_dev *wdev, ++ struct mgmt_frame_regs *upd) ++{ ++ ++} ++#endif ++ + #if defined(CONFIG_TDLS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) + static int cfg80211_rtw_tdls_mgmt(struct wiphy *wiphy, + struct net_device *ndev, +@@ -5990,7 +5999,10 @@ static struct cfg80211_ops rtw_cfg80211_ + .cancel_remain_on_channel = cfg80211_rtw_cancel_remain_on_channel, + #endif + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)) || defined(BUILD_OPENWRT) ++ .mgmt_tx = cfg80211_rtw_mgmt_tx, ++ .update_mgmt_frame_registrations = cfg80211_rtw_update_mgmt_frame_registrations, ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + .mgmt_tx = cfg80211_rtw_mgmt_tx, + #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,34) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,35)) + .action = cfg80211_rtw_mgmt_tx,