rtl8189es: add new package

This commit is contained in:
AmadeusGhost 2021-11-01 13:10:49 +08:00 committed by Tianling Shen
parent 89390604f2
commit b8d43ba477
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
5 changed files with 161 additions and 0 deletions

View File

@ -0,0 +1,70 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=rtl8189es
PKG_RELEASE:=1
PKG_SOURCE_URL:=https://github.com/jwrdegoede/rtl8189ES_linux.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2021-03-03
PKG_SOURCE_VERSION:=03ac413135a355b55b693154c44b70f86a39732e
PKG_MIRROR_HASH:=5cdd69a0c2383e66ae27b0518b4d6a3e845928767d644e1e2b12095b98ed8fbe
PKG_MAINTAINER:=Hauke Mehrtens <hauke@hauke-m.de>
PKG_BUILD_PARALLEL:=1
STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
define KernelPackage/rtl8189es
SUBMENU:=Wireless Drivers
TITLE:=Realtek RTL8189ETV SDIO WiFi
DEPENDS:=+kmod-cfg80211 +kmod-mmc +@DRIVER_11N_SUPPORT
FILES:=$(PKG_BUILD_DIR)/rtl8189es.ko
AUTOLOAD:=$(call AutoProbe,rtl8189es)
endef
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/autoconf.h \
-include backport/backport.h
EXTRA_KCONFIG:= \
CONFIG_RTL8189ES=m \
USER_MODULE_NAME=rtl8189es
EXTRA_CFLAGS:= \
-DRTW_SINGLE_WIPHY \
-DRTW_USE_CFG80211_STA_EVENT \
-DCONFIG_IOCTL_CFG80211 \
-DBUILD_OPENWRT
MAKE_OPTS:= \
$(KERNEL_MAKE_FLAGS) \
M="$(PKG_BUILD_DIR)" \
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
USER_EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
$(EXTRA_KCONFIG)
define Build/Compile
+$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
$(MAKE_OPTS) \
modules
endef
define KernelPackage/rtl8189es/install
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_DATA) ./files/50_rtl-wifi $(1)/etc/uci-defaults/
endef
$(eval $(call KernelPackage,rtl8189es))

View File

@ -0,0 +1,6 @@
#!/bin/sh
sed -i '/iw dev "$wdev" del/d' /lib/netifd/wireless/mac80211.sh
ip link set dev wlan0 up
exit 0

View File

@ -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
@@ -29,7 +29,7 @@
#include <drv_conf.h>
#include <basic_types.h>
#include <osdep_service.h>
-#include <rtw_byteorder.h>
+#include <asm/byteorder.h>
#include <wlan_bssdef.h>
#include <wifi.h>
#include <ieee80211.h>

View File

@ -0,0 +1,39 @@
From 9b2b0ec1bc2d31ddf93ed74d63fdfa6044e329a4 Mon Sep 17 00:00:00 2001
From: Ben Greear <greearb@candelatech.com>
Date: Fri, 9 Nov 2018 16:21:43 -0800
Subject: [PATCH] Fix build against openwrt backports tree.
Like breaks builds elsewhere, can fix it up later.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
include/drv_conf.h | 4 +++-
.../{wireless.h => old_unused_rtl_wireless.h} | 0
include/{autoconf.h => rtl_autoconf.h} | 0
3 files changed, 3 insertions(+), 1 deletions(-)
rename include/linux/{wireless.h => old_unused_rtl_wireless.h} (100%)
rename include/{autoconf.h => rtl_autoconf.h} (100%)
diff --git a/include/drv_conf.h b/include/drv_conf.h
index 0d20a7e..f0a9f88 100644
--- a/include/drv_conf.h
+++ b/include/drv_conf.h
@@ -19,7 +19,9 @@
******************************************************************************/
#ifndef __DRV_CONF_H__
#define __DRV_CONF_H__
-#include "autoconf.h"
+
+#include <generated/autoconf.h>
+#include "rtl_autoconf.h"
#include "hal_ic_cfg.h"
#if defined (PLATFORM_LINUX) && defined (PLATFORM_WINDOWS)
diff --git a/include/linux/wireless.h b/include/linux/old_unused_rtl_wireless.h
similarity index 100%
rename from include/linux/wireless.h
rename to include/linux/old_unused_rtl_wireless.h
diff --git a/include/autoconf.h b/include/rtl_autoconf.h
similarity index 100%
rename from include/autoconf.h
rename to include/rtl_autoconf.h

View File

@ -0,0 +1,31 @@
diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c
index b5eb513..901501a 100644
--- a/os_dep/linux/ioctl_cfg80211.c
+++ b/os_dep/linux/ioctl_cfg80211.c
@@ -5573,7 +5573,7 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy,
#else
struct net_device *ndev,
#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) || defined(BUILD_OPENWRT)
struct mgmt_frame_regs *upd)
#else
u16 frame_type, bool reg)
@@ -5583,7 +5583,7 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy,
struct net_device *ndev = wdev_to_ndev(wdev);
#endif
_adapter *adapter;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) || defined(BUILD_OPENWRT)
u16 frame_type = BIT(upd->global_stypes << 4);
bool reg = false;
#endif
@@ -6516,7 +6516,7 @@ static struct cfg80211_ops rtw_cfg80211_ops = {
.action = cfg80211_rtw_mgmt_tx,
#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) || defined(BUILD_OPENWRT)
.update_mgmt_frame_registrations = cfg80211_rtw_mgmt_frame_register,
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
.mgmt_frame_register = cfg80211_rtw_mgmt_frame_register,