blob: e85ca1a632ad82006a4ca615e61f389f652edbb2 [file] [log] [blame]
#
# Copyright (C) 2018 OpenWrt.org
#
# 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:=realtek-wlan
PKG_VERSION:=2018
PKG_RELEASE:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/realtek-wl/Default
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Realtek WiFi driver
SUBMENUDEP:=TARGET_mmp
endef
define KernelPackage/realtek-wl
$(call Package/realtek-wl/Default)
SECTION:=kernel
DEPENDS:=@TARGET_mmp +@DRIVER_11N_SUPPORT \
+(RTL8192_SDIO_USE_NL80211||RTL8822BS_SDIO_USE_NL80211):kmod-mac80211 \
+(RTL8192_SDIO_USE_NL80211||RTL8822BS_SDIO_USE_NL80211):kmod-cfg80211
TITLE:=Kernel driver for Realtek chipsets
ifneq ($(CONFIG_RTL8192_SDIO_USE_NL80211)$(CONFIG_RTL8192_SDIO_USE_WEXT),)
ifeq ($(CONFIG_RTL8192FS_SDIO),y)
FILES:=$(PKG_BUILD_DIR)/driver_rtl8192fs/rtl8192fs.ko
AUTOLOAD:=$(call AutoLoad,50,rtl8192fs, 1)
else
FILES:=$(PKG_BUILD_DIR)/driver_rtl8192es/rtl8192es.ko
AUTOLOAD:=$(call AutoLoad,50,rtl8192es, 1)
endif
endif
ifneq ($(CONFIG_RTL8822BS_SDIO_USE_NL80211)$(CONFIG_RTL8822BS_SDIO_USE_WEXT),)
FILES:=$(PKG_BUILD_DIR)/driver_rtl8822bs/rtl8822bs.ko
AUTOLOAD:=$(call AutoLoad,50,rtl8822bs, 1)
endif
ifneq ($(CONFIG_RTL8192FR_PCIE_USE_WEXT),)
FILES+= $(PKG_BUILD_DIR)/driver_rtl8192cd/rtl8192cd.ko
AUTOLOAD+=$(call AutoLoad,50,rtl8192cd, 1)
endif
ifneq ($(CONFIG_RTL8812FR_PCIE_USE_WEXT),)
FILES+= $(PKG_BUILD_DIR)/driver_rtl8192cd/rtl8192cd.ko
AUTOLOAD+=$(call AutoLoad,50,rtl8192cd, 1)
endif
endef
define KernelPackage/realtek-wl/description
This package contains the proprietary wireless driver for the Realtek
819x chipset.
endef
define KernelPackage/realtek-wl/config
if PACKAGE_kmod-realtek-wl
menuconfig RTL_SDIO_WIFI
bool "SDIO WiFi"
default n
select RTL8192_RTL8192FR_APP
help
Select sdio wifi, 8192es or 8192fs.
if RTL_SDIO_WIFI
config RTL8192XX_SDIO
bool "Enabe realtek SDIO wifi RTL8192"
default n
help
Select sdio wifi RTL8192, IEEE 802.11a/b/g/n compatible
WLAN, single band(2.4G only).
if RTL8192XX_SDIO
config RTL8192FS_SDIO
bool "Enabe realtek SDIO RTL8192FS, if not select, use 8192ES"
default n
help
Enable 8192FS
choice
prompt "RTL8192 use WEXT or NL80211"
default RTL8192_SDIO_USE_NL80211
help
Select WEXT or NL80211.
config RTL8192_SDIO_USE_WEXT
bool "WEXT"
select PACKAGE_realtek-app
select RTL8192_RTL8192FR_APP
help
Use Wext For WiFi Mangement.
config RTL8192_SDIO_USE_NL80211
bool "NL80211"
select PACKAGE_realtek-app
help
Default use NL80211 For RTL WiFi Management.
endchoice
endif
config RTL8822BS_SDIO
bool "Enabe realtek SDIO wifi RTL8822BS"
default n
help
Select sdio wifi RTL8822BS, IEEE 802.11a/b/g/n/ac compatible
WLAN, dual band(2.4G and 5G).
if RTL8822BS_SDIO
choice
prompt "RTL8822BS use WEXT or NL80211"
default RTL8822BS_SDIO_USE_NL80211
help
Select WEXT or NL80211 for 8822BS.
config RTL8822BS_SDIO_USE_WEXT
bool "WEXT"
select PACKAGE_realtek-app
select RTL8192_RTL8192FR_APP
help
Use Wext For WiFi Mangement.
config RTL8822BS_SDIO_USE_NL80211
bool "NL80211"
select PACKAGE_realtek-app
help
Default use NL80211 For RTL WiFi Management.
endchoice
endif
endif
menuconfig RTL_PCIE_WIFI
bool "PCIE WiFi"
default n
select RTL8192_RTL8192FR_APP
help
Select sdio wifi, 8192fr or 8812fr.
if RTL_PCIE_WIFI
config RTL8192FR_PCIE
bool "Enable realtek PCIe RTL8192FR driver"
default n
help
Select pcie wifi RTL8192FR, IEEE 802.11a/b/g/n compatible
WLAN, single band(2.4G only).
if RTL8192FR_PCIE
choice
prompt "RTL8192FR use WEXT"
default RTL8192FR_PCIE_USE_WEXT
help
Select WEXT for RTL8192FR.
config RTL8192FR_PCIE_USE_WEXT
bool "WEXT"
select PACKAGE_realtek-app
select RTL8192_RTL8192FR_APP
help
Support RTL8192FR PCIe Wifi.
endchoice
endif
config RTL8812FR_PCIE
bool "Enable realtek PCIe RTL8812FR driver"
default n
help
Select pcie wifi RTL8812FR, IEEE 802.11a/b/g/n/ac compatible
WLAN, single band(5G only).
if RTL8812FR_PCIE
choice
prompt "RTL8812FR use WEXT"
default RTL8812FR_PCIE_USE_WEXT
help
Select WEXT for RTL8812FR.
config RTL8812FR_PCIE_USE_WEXT
bool "WEXT"
select PACKAGE_realtek-app
select RTL8192_RTL8192FR_APP
help
Support RTL8812FR PCIe Wifi.
endchoice
endif
endif
endif
endef
define KernelPackage/realtek-wl/install
$(INSTALL_DIR) $(1)/etc/config
$(CP) ./files/etc/* $(1)/etc
$(RM) -rf $(1)/etc/config/wireless
ifeq ($(CONFIG_RTL8192_SDIO_USE_NL80211),y)
$(CAT) ./files/wireless_mac80211 >> $(1)/etc/config/wireless
endif
ifeq ($(CONFIG_RTL8192_SDIO_USE_WEXT),y)
$(CAT) ./files/wireless_wext >> $(1)/etc/config/wireless
endif
ifeq ($(CONFIG_RTL8822BS_SDIO_USE_NL80211),y)
$(CAT) ./files/wireless_mac80211_rtl8822bs >> $(1)/etc/config/wireless
endif
ifeq ($(CONFIG_RTL8822BS_SDIO_USE_WEXT),y)
$(CAT) ./files/wireless_wext_rtl8822bs >> $(1)/etc/config/wireless
endif
ifneq ($(CONFIG_RTL8812FR_PCIE_USE_WEXT),y)
ifeq ($(CONFIG_RTL8192FR_PCIE_USE_WEXT),y)
$(CAT) ./files/wireless_wext_rtl8192fr >> $(1)/etc/config/wireless
endif
endif
ifeq ($(CONFIG_RTL8812FR_PCIE_USE_WEXT),y)
ifeq ($(CONFIG_RTL8192FR_PCIE_USE_WEXT),y)
$(CAT) ./files/wireless_wext_wlan0_rtl8192fr >> $(1)/etc/config/wireless
endif
endif
ifeq ($(CONFIG_RTL8812FR_PCIE_USE_WEXT),y)
$(CAT) ./files/wireless_wext_rtl8812fr >> $(1)/etc/config/wireless
endif
ifeq ($(CONFIG_RTL8192_RTL8192FR_APP),y)
$(INSTALL_DIR) $(1)/lib/wifi
$(INSTALL_DIR) $(1)/root/wifi/script
$(CP) ./files/lib/wifi/realtek.sh $(1)/lib/wifi/
$(INSTALL_DATA) ./files/lib/wifi/rtk_flash.txt $(1)/lib/wifi/
$(CP) ./files/script/* $(1)/root/wifi/script/
ifneq ($(CONFIG_RTL8812FR_PCIE_USE_WEXT),)
$(INSTALL_DATA) ./files/lib/wifi/rtk_flash_ac.txt $(1)/lib/wifi/
endif
endif
ifeq ($(CONFIG_FALCON_DKB_SHARE_PINS),y)
$(CP) ./files/lib/mwlan-1803dkb $(1)/etc/init.d/mwlan
endif
ifeq ($(CONFIG_RTL8812FR_PCIE_USE_WEXT),y)
ifeq ($(CONFIG_RTL8192FR_PCIE_USE_WEXT),y)
$(CP) ./files/lib/mwlan-1826sp801 $(1)/etc/init.d/mwlan
endif
endif
endef
define Package/realtek-app
$(call Package/realtek-wl/Default)
DEPENDS+= +librt
TITLE:=Realtek proprietary wireless application utility
endef
define Package/realtek-app/description
This package contains an utility for the proprietary Realtek wireless driver.
endef
define Package/realtek-app/config
if PACKAGE_realtek-app
config RTL8192_RTL8192FR_APP
bool "Enabe realtek RTL8192 and RTL8192FR App"
default y
help
Realtek RTL8192 SDIO WiFi App, Realtek RTL8192FR PCIe WiFi App.
endif
endef
MAKE_OPTS:= \
ARCH="$(LINUX_KARCH)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
M="$(PKG_BUILD_DIR)"
MAKE_KMOD := $(MAKE) -C "$(LINUX_DIR)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
PATH="$(TARGET_PATH)" \
M="$(PKG_BUILD_DIR)/kmod" \
define Build/Prepare
rm -rf $(PKG_BUILD_DIR)
mkdir -p $(PKG_BUILD_DIR)
$(PKG_UNPACK)
$(Build/Patch)
ifneq ($(CONFIG_RTL8192FR_PCIE_USE_WEXT)$(CONFIG_RTL8812FR_PCIE_USE_WEXT),)
$(CP) ./src/Driver/rtl8192cd_92fr $(PKG_BUILD_DIR)/driver_rtl8192cd
endif
ifneq ($(CONFIG_RTL8192_SDIO_USE_NL80211)$(CONFIG_RTL8192_SDIO_USE_WEXT),)
ifeq ($(CONFIG_RTL8192FS_SDIO),y)
$(CP) ./src/Driver/rtl8192cd_92fs $(PKG_BUILD_DIR)/driver_rtl8192fs
else
$(CP) ./src/Driver/rtl8192cd_92es $(PKG_BUILD_DIR)/driver_rtl8192es
endif
endif
ifneq ($(CONFIG_RTL8822BS_SDIO_USE_NL80211)$(CONFIG_RTL8822BS_SDIO_USE_WEXT),)
$(CP) ./src/Driver/rtl8822bs $(PKG_BUILD_DIR)/driver_rtl8822bs
endif
ifeq ($(CONFIG_RTL8192_RTL8192FR_APP),y)
$(CP) ./src/Users $(PKG_BUILD_DIR)/app_rtl8192cd
endif
endef
define Build/Compile
# Compile the kernel part
ifeq ($(CONFIG_RTL8192_SDIO_USE_NL80211),y)
ifeq ($(CONFIG_RTL8192FS_SDIO),y)
$(CP) ./files/config_92fs_mac80211.mk $(PKG_BUILD_DIR)/driver_rtl8192fs/config.mk
$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" $(KERNEL_MAKE_FLAGS) \
M="$(PKG_BUILD_DIR)/driver_rtl8192fs" \
RTK_WIFI_8192CD_SRC="$(PKG_BUILD_DIR)/driver_rtl8192fs" \
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
CONFIG_PLATFORM=_ARM_ASR_ \
modules
else
$(CP) ./files/config_mac80211.mk $(PKG_BUILD_DIR)/driver_rtl8192es/config.mk
$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" $(KERNEL_MAKE_FLAGS) \
M="$(PKG_BUILD_DIR)/driver_rtl8192es" \
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
RTK_WIFI_8192CD_SRC="$(PKG_BUILD_DIR)/driver_rtl8192es" \
CONFIG_PLATFORM=_ARM_ASR_ \
modules
endif
endif
ifeq ($(CONFIG_RTL8192_SDIO_USE_WEXT),y)
ifeq ($(CONFIG_RTL8192FS_SDIO),y)
$(CP) ./files/config_92fs_wext.mk $(PKG_BUILD_DIR)/driver_rtl8192fs/config.mk
$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" $(KERNEL_MAKE_FLAGS) \
M="$(PKG_BUILD_DIR)/driver_rtl8192fs" \
RTK_WIFI_8192CD_SRC="$(PKG_BUILD_DIR)/driver_rtl8192fs" \
CONFIG_PLATFORM=_ARM_ASR_ \
modules
else
$(CP) ./files/config_wext.mk $(PKG_BUILD_DIR)/driver_rtl8192es/config.mk
$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" $(KERNEL_MAKE_FLAGS) \
M="$(PKG_BUILD_DIR)/driver_rtl8192es" \
RTK_WIFI_8192CD_SRC="$(PKG_BUILD_DIR)/driver_rtl8192es" \
CONFIG_PLATFORM=_ARM_ASR_ \
modules
endif
endif
ifeq ($(CONFIG_RTL8822BS_SDIO_USE_NL80211),y)
$(CP) ./files/config_mac80211_rtl8822bs.mk $(PKG_BUILD_DIR)/driver_rtl8822bs/config.mk
$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" $(KERNEL_MAKE_FLAGS) \
M="$(PKG_BUILD_DIR)/driver_rtl8822bs" \
RTK_WIFI_8192CD_SRC="$(PKG_BUILD_DIR)/driver_rtl8822bs" \
CONFIG_PLATFORM=_ARM_ASR_ \
modules
endif
ifeq ($(CONFIG_RTL8822BS_SDIO_USE_WEXT),y)
$(CP) ./files/config_wext_rtl8822bs.mk $(PKG_BUILD_DIR)/driver_rtl8822bs/config.mk
$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" $(KERNEL_MAKE_FLAGS) \
M="$(PKG_BUILD_DIR)/driver_rtl8822bs" \
RTK_WIFI_8192CD_SRC="$(PKG_BUILD_DIR)/driver_rtl8822bs" \
CONFIG_PLATFORM=_ARM_ASR_ \
modules
endif
ifneq ($(CONFIG_RTL8812FR_PCIE_USE_WEXT),y)
ifeq ($(CONFIG_RTL8192FR_PCIE_USE_WEXT),y)
$(CP) ./files/config_wext_rtl8192fr.mk $(PKG_BUILD_DIR)/driver_rtl8192cd/config.mk
$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" $(KERNEL_MAKE_FLAGS) \
M="$(PKG_BUILD_DIR)/driver_rtl8192cd" \
RTK_WIFI_8192CD_SRC="$(PKG_BUILD_DIR)/driver_rtl8192cd" \
CONFIG_PLATFORM=_ARM_ASR_ \
modules
endif
endif
ifneq ($(CONFIG_RTL8192FR_PCIE_USE_WEXT),y)
ifeq ($(CONFIG_RTL8812FR_PCIE_USE_WEXT),y)
$(CP) ./files/config_wext_rtl8812fr.mk $(PKG_BUILD_DIR)/driver_rtl8192cd/config.mk
$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" $(KERNEL_MAKE_FLAGS) \
M="$(PKG_BUILD_DIR)/driver_rtl8192cd" \
RTK_WIFI_8192CD_SRC="$(PKG_BUILD_DIR)/driver_rtl8192cd" \
CONFIG_PLATFORM=_ARM_ASR_ \
modules
endif
endif
ifeq ($(CONFIG_RTL8192FR_PCIE_USE_WEXT),y)
ifeq ($(CONFIG_RTL8812FR_PCIE_USE_WEXT),y)
$(CP) ./files/config_wext_rtl8192fr_rtl8812fr.mk $(PKG_BUILD_DIR)/driver_rtl8192cd/config.mk
$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" $(KERNEL_MAKE_FLAGS) \
M="$(PKG_BUILD_DIR)/driver_rtl8192cd" \
RTK_WIFI_8192CD_SRC="$(PKG_BUILD_DIR)/driver_rtl8192cd" \
CONFIG_PLATFORM=_ARM_ASR_ \
modules
endif
endif
ifeq ($(CONFIG_RTL8192_RTL8192FR_APP),y)
$(MAKE) -C $(PKG_BUILD_DIR)/app_rtl8192cd \
CROSS_COMPILE="$(TARGET_CROSS)" $(TARGET_CONFIGURE_OPTS) \
CONFIG_PLATFORM=_ARM_ASR_
endif
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/lib
endef
define Package/realtek-app/install
$(INSTALL_DIR) $(1)/bin
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_DIR) $(1)/etc
ifeq ($(CONFIG_RTL8192_RTL8192FR_APP),y)
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app_rtl8192cd/bin/auth $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app_rtl8192cd/bin/iwcontrol $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app_rtl8192cd/bin/UDPserver $(1)/bin
#$(INSTALL_BIN) $(PKG_BUILD_DIR)/app_rtl8192cd/bin/iwpriv $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app_rtl8192cd/bin/wscd $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app_rtl8192cd/bin/flash $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app_rtl8192cd/bin/webs $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app_rtl8192cd/bin/ftd $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app_rtl8192cd/wsc/src/wscd.conf $(1)/etc/wscd.conf
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app_rtl8192cd/wsc/src/simplecfgservice.xml $(1)/etc
endif
endef
$(eval $(call KernelPackage,realtek-wl))
$(eval $(call BuildPackage,realtek-app))