MediaTek wifi driver already supported WPA3, and works stable; compared to the opensourced one, still has high chance(20~30%) disconnect while using, and speed is very unstable. So before I can understand and fix the opensource wifi driver problem, I guess a fast way is to port the MediaTek wifi driver first.
Currently I am making some progress about Makefile, but still can not get compiled mt7628.ko yet. There is a lot of CONFIG define need to be clear first, or it will bring weird trouble. This must be a long way to go.
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mt7628-wifi
PKG_SOURCE:=MT7628_LinuxAP_V4.1.1.0_DPA_20190925.tar.bz2
PKG_SOURCE_URL:=http://vonger.cn/misc/vocore2/
PKG_MD5SUM:=20db265032718ccde1c9e12f89939c0e
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
PKG_CONFIG_DEPENDS:=\
CONFIG_MT7628_AP_SUPPORT=m \
CONFIG_SUPPORT_OPENWRT=y \
CONFIG_RALINK_MT7628=y \
CONFIG_MT7628_NEW_RATE_ADAPT_SUPPORT=y \
CONFIG_MT7628_UAPSD=y \
CONFIG_MT7628_MAC=y \
CONFIG_MT7628_WSC_INCLUDED=y \
CONFIG_MT7628_WSC_V2_SUPPORT=y \
CONFIG_MT7628_DOT11W_PMF_SUPPORT=y \
CONFIG_MT7628_MBSS_SUPPORT=y \
CONFIG_MT7628_WPA3_SUPPORT=y
include $(INCLUDE_DIR)/package.mk
TAR_CMD=$(HOST_TAR) -C $(1)/ $(TAR_OPTIONS)
define KernelPackage/mt7628-wifi
TITLE:=MTK MT7628 WiFi Driver
FILES:=$(PKG_BUILD_DIR)/mt7628.ko
SECTION:=vocore2
CATEGORY:=VoCore2
AUTOLOAD:=$(call AutoLoad,98,mt7628)
endef
define Build/Compile
$(MAKE) -C "$(LINUX_DIR)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
SUBDIRS="$(PKG_BUILD_DIR)/mt7628_wifi_ap" \
M="$(PKG_BUILD_DIR)/mt7628_wifi_ap" \
$(PKG_CONFIG_DEPENDS) \
modules
endef
$(eval $(call KernelPackage,mt7628-wifi))
A simple explain of the Makefile. First from start to “include package.mk” just declare the package download path. PKG_CONFIG_DEPENDS is the real driver configure, this should be done in menuconfig, but for simple, I put it into Makefile. TAR_CMD is a modify version of tar, or when you compile openwrt will complain source code path is not correct. “define KernelPackage/mt7628-wifi” to “endef” is used to show this driver in openwrt menuconfig.
The most important one is “define Build/Compile”, this block is the command used to compile Linux kernel driver, we use the PKG_CONFIG_DEPENDS here. Actually you can directly change every marco in this command line to real path and file, then it can directly work in command line.