Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MGV2000-CW创维版 1+8G,S905L2,无线MT7668RSN在5.10可用,建议纳入适配清单 #2616

Open
w2xg2022 opened this issue Oct 27, 2024 · 14 comments
Labels
documentation Improvements or additions to documentation new box Research Fills in the Blanks support This need is supported

Comments

@w2xg2022
Copy link

w2xg2022 commented Oct 27, 2024

Device Information | 设备信息

  • SOC: [e.g. S095x3]gxlx_p261_1g,应该是S905L2【没有拆机】
  • Model [e.g. HK1]MGV2000-CW

Armbian Version | 系统版本

  • Kernel Version: [e.g. 5.15.100]6.6.53、5.10.228
  • Release: [e.g. jammy/bullseye]bookworm

Describe the bug | 问题描述
Armbian_24.11.0_amlogic_s905l2_bookworm_6.6.53_server_2024.10.02.img.gz下HDMI有输出、有线正常,但无线、蓝牙未驱动。如果要写入EMMC需要修改默认meson-gxl-s905l2-x7-5g.dtb的mmc@74000,0xbebc200 -> 0x2faf080;写入EMMC选119(s905l2 MGV2000,MGV3000,M301A,CM201-1 meson-gxl-s905l2-x7-5g.dtb),写入后可正常使用。

希望板载MT7668RSN无线能用起来,爬了很多文发现只能在5.10内核中实现,经过一番折腾确实也成功了,iperf3内网实测可以跑140Mpbs左右,突破了百兆有线,有实际利用价值了。

先上图:
微信图片_20241027083251
微信图片_20241027083258
搜狗截图20241026230946

过程整理:
前置作业
1、刷入安卓底包S905L2_A9_Armbian.img,引导U盘启动(紫屏按2次电源键可恢复正常;先进magisk后重启,再用外置系统启动器)
2、基于Armbian_24.11.0_amlogic_s905l2_bookworm_6.6.53_server_2024.10.02.img.gz用rufus制作U盘,使用默认dtb即meson-gxl-s905l2-x7-5g.dtb
3、MT7668驱动只适用内核5.10.x,运行armbian-update -k 5.10调整内核版本
4、5.10.x(实际是5.10.228)还需要启用extlinux\extlinux.conf,并复制u-boot-s905x-s912.bin为u-boot.ext,才能正常启动和使用

编译过程
1、对齐gcc版本
mkdir -p /usr/local/toolchain
cd /usr/local/toolchain
wget https://github.com/ophub/kernel/releases/download/dev/arm-gnu-toolchain-13.3.rel1-aarch64-aarch64-none-elf.tar.xz
tar -Jxf arm-gnu-toolchain-13.3.rel1-aarch64-aarch64-none-elf.tar.xz

echo 'export PATH=$PATH:/usr/local/toolchain/arm-gnu-toolchain-13.3.rel1-aarch64-aarch64-none-elf/bin/' | tee -a /etc/profile.d/gcc-aarch64-none-elf.sh
source /etc/profile
ln -sf /usr/local/toolchain/arm-gnu-toolchain-13.3.rel1-aarch64-aarch64-none-elf/bin/aarch64-none-elf-gcc /usr/local/bin/gcc

2、修改驱动源代码
cd /root
git clone -b 5.15 https://github.com/fujianzz/mt7668-ce
cd mt7668-ce/MT7668-WiFi/

sed -i 's/kernel_version/5.10.228-ophub/' /root/mt7668-ce/MT7668-WiFi/Makefile.x86
sed -i 's/x86/arm64/' /root/mt7668-ce/MT7668-WiFi/Makefile.x86

3、开始编译
make EXTRA_CFLAGS="-w" CROSS_COMPILE= -f Makefile.x86 -j$(nproc)

4、安装驱动
cp /root/mt7668-ce/MT7668-WiFi/7668_firmware/* /usr/lib/firmware/
cp -f /root/mt7668-ce/MT7668-WiFi/drv_wlan/MT6632/wlan/wlan_mt76x8_sdio.ko /lib/modules/5.10.228-ophub/kernel/drivers/net/wireless/
depmod -a

modprobe wlan_mt76x8_sdio

后续操作
1、删除临时文档(可选)
rm -rf /usr/local/toolchain/arm-gnu-toolchain-13.3.rel1-aarch64-aarch64-none-elf.tar.xz
rm -rf /root/mt7668-ce/

2、无线连接路由器(iperf3内网测速约140Mbps)
nmtui

3、写入EMMC(可选)
需要修改dtb/dts中mmc@74000的0xbebc200 -> 0x2faf080,才能写入EMMC
armbian-install -m yes(一定要加-m yes参数,才能正确生成u-boot.emmc)
选119,119 s905l2 MGV2000,MGV3000,M301A,CM201-1 meson-gxl-s905l2-x7-5g.dtb

总结和文档下载
链接:https://pan.baidu.com/s/19_nMbN06wxXuo9lUrt0DmA?pwd=iafy
提取码:iafy
1、安卓9底包:S905L2_A9_Armbian.rar
2、改过的5.10版本dtb:meson-gxl-s905l2-x7-5g.dtb
3、完整固件:Armbian_24.11.0_amlogic_s905l2_mgv2000-cw_wifi_bookworm_5.10.228_server_2024.10.02.img.gz(root/1234)

遗留问题
1、如果直接用Armbian_24.11.0_amlogic_s905l2_mgv2000-cw_wifi_bookworm_5.10.228_server_2024.10.02.img.gz,第一次启动可能需要插拔网线才能取得IP【只需一次】
2、蓝牙不可用
3、关闭[wlan]相关跑码,太烦了
4、6.1、6.6内核适配MT7668

参考资料
1、驱动编译:https://github.com/fujianzz/mt7668-armbian
2、缝合安卓底包:#2539

@ophub 搜索过issue,看到比较多MGV2000 JL版,不知道CW版有没有重复,麻烦视需要纳入适配清单。谢谢。

@LondyGhost
Copy link

有无试过6.x编译此WiFi驱动能正常使用的?

@jumkey
Copy link

jumkey commented Oct 29, 2024

有无试过6.x编译此WiFi驱动能正常使用的?

https://github.com/SOUTH5663/MT7668/tree/k6.1 这个可以试试,我在这个分支基础上微调了6.6编译可用,6.1未测试

@ophub ophub added documentation Improvements or additions to documentation support This need is supported new box Research Fills in the Blanks labels Oct 29, 2024
@ophub
Copy link
Owner

ophub commented Oct 29, 2024

感谢分享,我添加到支持的设备列表里。
119, 120, 131的配置信息系统,这3个序号对应的的固件是一样的。
你分享的安卓系统我也转存到了: https://github.com/ophub/kernel/releases/tag/tools

@w2xg2022
Copy link
Author

w2xg2022 commented Nov 4, 2024

很奇怪,今天重复之前所有动作,发现写入EMMC、从EMMC启动的时候出现下面问题(U盘运行正常):

搜狗截图20241104195104
搜狗截图20241104202257

@ophub
Copy link
Owner

ophub commented Nov 5, 2024

无法读取存储设备,可能是选择的u-boot不对(不要选择-m yes添加这个u-boot,或者选择其他的u-boot),也可能是dtb的频率高(调低dtb到25hz试试)。

@w2xg2022
Copy link
Author

w2xg2022 commented Nov 5, 2024

谢谢O大指导,反复测试了25000000、30000000、35000000、37500000等频率,也在各种dtb和u-boot(例如u-boot-s905x-s912.bin、u-boot-p212.bin)之间横跳,连btrfs都试了,还是没有能从EMMC启动。

特别好奇之前竟然能成功,不知道发生了什么。

现在先用U盘启动,如果拿到其他同型号机器会再测试。

@gantoday
Copy link

@w2xg2022 大哥我看你的 ty1608 1g内存在 armbian 里可用只有 800m。
这个 mgv2000 却有 921m。
ty1608 有办法识别更多内存吗?

@liubei1998
Copy link

liubei1998 commented Nov 15, 2024

MGV2000-CW创维版 1+8G,S905L2,无线MT7668RSN,使用openwrt.ai编译的固件,成功刷入emmc,dtb选126创维的meson-gxl-s905l3b-e900v22e.dtb,该dtb进系统后无法识别无线硬件MT7668RSN,可以尝试其他dtb能否开机能否识别无线MT7668RSN。
Device Information | 设备信息

  • SOC: 905l2
  • 使用正确型号的,能从u盘启动,刷不进emmc,误打误撞试试心态选126,刷入成功,正常启动
    MGV2000CW - LuCI

@ophub
Copy link
Owner

ophub commented Nov 15, 2024

我把选项也更新到126了

@easonchan-1874
Copy link

有无试过6.x编译此WiFi驱动能正常使用的?

https://github.com/SOUTH5663/MT7668/tree/k6.1 这个可以试试,我在这个分支基础上微调了6.6编译可用,6.1未测试

@jumkey 大佬,能拉个改好后的分支吗?我在6.1和6.6内核上报错,看不懂里面的代码😭
CC [M] /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_kal.o In file included from /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/include/gl_os.h:206, from /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_init.c:73: /root/src/MT7668/drv_wlan/MT6632/wlan/os/version.h:87:29: error: expected declaration specifiers or '...' before string constant 87 | #define NIC_NAME "MT6632" | ^~~~~~~~ /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_init.c:112:25: note: in expansion of macro 'NIC_NAME' 112 | MODULE_SUPPORTED_DEVICE(NIC_NAME); | ^~~~~~~~ make[3]: *** [scripts/Makefile.build:243: /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_init.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[2]: *** [/usr/src/linux-headers-6.6.56-ophub/Makefile:1921: /root/src/MT7668/drv_wlan/MT6632/wlan] Error 2 make[1]: *** [Makefile:234: __sub-make] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-6.6.56-ophub' make: *** [Makefile.x86:50: driver] Error 2

@jumkey
Copy link

jumkey commented Nov 19, 2024

有无试过6.x编译此WiFi驱动能正常使用的?

https://github.com/SOUTH5663/MT7668/tree/k6.1 这个可以试试,我在这个分支基础上微调了6.6编译可用,6.1未测试

@jumkey 大佬,能拉个改好后的分支吗?我在6.1和6.6内核上报错,看不懂里面的代码😭 CC [M] /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_kal.o In file included from /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/include/gl_os.h:206, from /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_init.c:73: /root/src/MT7668/drv_wlan/MT6632/wlan/os/version.h:87:29: error: expected declaration specifiers or '...' before string constant 87 | #define NIC_NAME "MT6632" | ^~~~~~~~ /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_init.c:112:25: note: in expansion of macro 'NIC_NAME' 112 | MODULE_SUPPORTED_DEVICE(NIC_NAME); | ^~~~~~~~ make[3]: *** [scripts/Makefile.build:243: /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_init.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[2]: *** [/usr/src/linux-headers-6.6.56-ophub/Makefile:1921: /root/src/MT7668/drv_wlan/MT6632/wlan] Error 2 make[1]: *** [Makefile:234: __sub-make] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-6.6.56-ophub' make: *** [Makefile.x86:50: driver] Error 2

diff --git a/Makefile.x86 b/Makefile.x86
index 9bd034f..11d9018 100644
--- a/Makefile.x86
+++ b/Makefile.x86
@@ -20,7 +20,7 @@ ifeq ($(hif),)
     hif=usb
 endif
 
-MODULES_NAME := wlan_$(shell echo $(MTK_COMBO_CHIP) | tr A-Z a-z)
+MODULES_NAME := wlan_mt76x8
 
 export CONFIG_MTK_COMBO_WIFI_HIF=$(hif)
 
diff --git a/drv_wlan/MT6632/wlan/mgmt/p2p_func.c b/drv_wlan/MT6632/wlan/mgmt/p2p_func.c
index 7bc03b4..1648520 100644
--- a/drv_wlan/MT6632/wlan/mgmt/p2p_func.c
+++ b/drv_wlan/MT6632/wlan/mgmt/p2p_func.c
@@ -1222,7 +1222,7 @@ VOID p2pFuncDfsSwitchCh(IN P_ADAPTER_T prAdapter, IN P_BSS_INFO_T prBssInfo, IN
 
 	DBGLOG(P2P, INFO, "p2pFuncDfsSwitchCh: Update to OS\n");
 	cfg80211_ch_switch_notify(prGlueInfo->prP2PInfo[prP2pRoleFsmInfo->ucRoleIndex]->prDevHandler,
-					prGlueInfo->prP2PInfo[prP2pRoleFsmInfo->ucRoleIndex]->chandef);
+					prGlueInfo->prP2PInfo[prP2pRoleFsmInfo->ucRoleIndex]->chandef, 0, 0);
 	DBGLOG(P2P, INFO, "p2pFuncDfsSwitchCh: Update to OS Done\n");
 
 	if (prGlueInfo->prP2PInfo[prP2pRoleFsmInfo->ucRoleIndex]->chandef) {
diff --git a/drv_wlan/MT6632/wlan/os/linux/gl_cfg80211.c b/drv_wlan/MT6632/wlan/os/linux/gl_cfg80211.c
index 207e028..e13e104 100644
--- a/drv_wlan/MT6632/wlan/os/linux/gl_cfg80211.c
+++ b/drv_wlan/MT6632/wlan/os/linux/gl_cfg80211.c
@@ -2720,19 +2720,19 @@ mtk_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev, const
 
 	if (params == NULL)
 		return 0;
-	else if (params->supported_rates == NULL)
+	else if (params->link_sta_params.supported_rates == NULL)
 		return 0;
 
 	/* init */
 	kalMemZero(&rCmdUpdate, sizeof(rCmdUpdate));
 	kalMemCopy(rCmdUpdate.aucPeerMac, mac, 6);
 
-	if (params->supported_rates != NULL) {
+	if (params->link_sta_params.supported_rates != NULL) {
 
-		u4Temp = params->supported_rates_len;
+		u4Temp = params->link_sta_params.supported_rates_len;
 		if (u4Temp > CMD_PEER_UPDATE_SUP_RATE_MAX)
 			u4Temp = CMD_PEER_UPDATE_SUP_RATE_MAX;
-		kalMemCopy(rCmdUpdate.aucSupRate, params->supported_rates, u4Temp);
+		kalMemCopy(rCmdUpdate.aucSupRate, params->link_sta_params.supported_rates, u4Temp);
 		rCmdUpdate.u2SupRateLen = u4Temp;
 	}
 
@@ -2754,23 +2754,23 @@ mtk_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev, const
 		rCmdUpdate.u2ExtCapLen = u4Temp;
 	}
 
-	if (params->ht_capa != NULL) {
+	if (params->link_sta_params.ht_capa != NULL) {
 
-		rCmdUpdate.rHtCap.u2CapInfo = params->ht_capa->cap_info;
-		rCmdUpdate.rHtCap.ucAmpduParamsInfo = params->ht_capa->ampdu_params_info;
-		rCmdUpdate.rHtCap.u2ExtHtCapInfo = params->ht_capa->extended_ht_cap_info;
-		rCmdUpdate.rHtCap.u4TxBfCapInfo = params->ht_capa->tx_BF_cap_info;
-		rCmdUpdate.rHtCap.ucAntennaSelInfo = params->ht_capa->antenna_selection_info;
+		rCmdUpdate.rHtCap.u2CapInfo = params->link_sta_params.ht_capa->cap_info;
+		rCmdUpdate.rHtCap.ucAmpduParamsInfo = params->link_sta_params.ht_capa->ampdu_params_info;
+		rCmdUpdate.rHtCap.u2ExtHtCapInfo = params->link_sta_params.ht_capa->extended_ht_cap_info;
+		rCmdUpdate.rHtCap.u4TxBfCapInfo = params->link_sta_params.ht_capa->tx_BF_cap_info;
+		rCmdUpdate.rHtCap.ucAntennaSelInfo = params->link_sta_params.ht_capa->antenna_selection_info;
 		kalMemCopy(rCmdUpdate.rHtCap.rMCS.arRxMask,
-			   params->ht_capa->mcs.rx_mask, sizeof(rCmdUpdate.rHtCap.rMCS.arRxMask));
+			   params->link_sta_params.ht_capa->mcs.rx_mask, sizeof(rCmdUpdate.rHtCap.rMCS.arRxMask));
 
-		rCmdUpdate.rHtCap.rMCS.u2RxHighest = params->ht_capa->mcs.rx_highest;
-		rCmdUpdate.rHtCap.rMCS.ucTxParams = params->ht_capa->mcs.tx_params;
+		rCmdUpdate.rHtCap.rMCS.u2RxHighest = params->link_sta_params.ht_capa->mcs.rx_highest;
+		rCmdUpdate.rHtCap.rMCS.ucTxParams = params->link_sta_params.ht_capa->mcs.tx_params;
 		rCmdUpdate.fgIsSupHt = TRUE;
 	}
 	/* vht */
 
-	if (params->vht_capa != NULL) {
+	if (params->link_sta_params.vht_capa != NULL) {
 		/* rCmdUpdate.rVHtCap */
 		/* rCmdUpdate.rVHtCap */
 	}
@@ -2823,19 +2823,19 @@ mtk_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev, u8 *ma
 
 	if (params == NULL)
 		return 0;
-	else if (params->supported_rates == NULL)
+	else if (params->link_sta_params.supported_rates == NULL)
 		return 0;
 
 	/* init */
 	kalMemZero(&rCmdUpdate, sizeof(rCmdUpdate));
 	kalMemCopy(rCmdUpdate.aucPeerMac, mac, 6);
 
-	if (params->supported_rates != NULL) {
+	if (params->link_sta_params.supported_rates != NULL) {
 
-		u4Temp = params->supported_rates_len;
+		u4Temp = params->link_sta_params.supported_rates_len;
 		if (u4Temp > CMD_PEER_UPDATE_SUP_RATE_MAX)
 			u4Temp = CMD_PEER_UPDATE_SUP_RATE_MAX;
-		kalMemCopy(rCmdUpdate.aucSupRate, params->supported_rates, u4Temp);
+		kalMemCopy(rCmdUpdate.aucSupRate, params->link_sta_params.supported_rates, u4Temp);
 		rCmdUpdate.u2SupRateLen = u4Temp;
 	}
 
@@ -2857,23 +2857,23 @@ mtk_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev, u8 *ma
 		rCmdUpdate.u2ExtCapLen = u4Temp;
 	}
 
-	if (params->ht_capa != NULL) {
+	if (params->link_sta_params.ht_capa != NULL) {
 
-		rCmdUpdate.rHtCap.u2CapInfo = params->ht_capa->cap_info;
-		rCmdUpdate.rHtCap.ucAmpduParamsInfo = params->ht_capa->ampdu_params_info;
-		rCmdUpdate.rHtCap.u2ExtHtCapInfo = params->ht_capa->extended_ht_cap_info;
-		rCmdUpdate.rHtCap.u4TxBfCapInfo = params->ht_capa->tx_BF_cap_info;
-		rCmdUpdate.rHtCap.ucAntennaSelInfo = params->ht_capa->antenna_selection_info;
+		rCmdUpdate.rHtCap.u2CapInfo = params->link_sta_params.ht_capa->cap_info;
+		rCmdUpdate.rHtCap.ucAmpduParamsInfo = params->link_sta_params.ht_capa->ampdu_params_info;
+		rCmdUpdate.rHtCap.u2ExtHtCapInfo = params->link_sta_params.ht_capa->extended_ht_cap_info;
+		rCmdUpdate.rHtCap.u4TxBfCapInfo = params->link_sta_params.ht_capa->tx_BF_cap_info;
+		rCmdUpdate.rHtCap.ucAntennaSelInfo = params->link_sta_params.ht_capa->antenna_selection_info;
 		kalMemCopy(rCmdUpdate.rHtCap.rMCS.arRxMask,
-			   params->ht_capa->mcs.rx_mask, sizeof(rCmdUpdate.rHtCap.rMCS.arRxMask));
+			   params->link_sta_params.ht_capa->mcs.rx_mask, sizeof(rCmdUpdate.rHtCap.rMCS.arRxMask));
 
-		rCmdUpdate.rHtCap.rMCS.u2RxHighest = params->ht_capa->mcs.rx_highest;
-		rCmdUpdate.rHtCap.rMCS.ucTxParams = params->ht_capa->mcs.tx_params;
+		rCmdUpdate.rHtCap.rMCS.u2RxHighest = params->link_sta_params.ht_capa->mcs.rx_highest;
+		rCmdUpdate.rHtCap.rMCS.ucTxParams = params->link_sta_params.ht_capa->mcs.tx_params;
 		rCmdUpdate.fgIsSupHt = TRUE;
 	}
 	/* vht */
 
-	if (params->vht_capa != NULL) {
+	if (params->link_sta_params.vht_capa != NULL) {
 		/* rCmdUpdate.rVHtCap */
 		/* rCmdUpdate.rVHtCap */
 	}
diff --git a/drv_wlan/MT6632/wlan/os/linux/gl_init.c b/drv_wlan/MT6632/wlan/os/linux/gl_init.c
index 54007d2..5dd5ac4 100644
--- a/drv_wlan/MT6632/wlan/os/linux/gl_init.c
+++ b/drv_wlan/MT6632/wlan/os/linux/gl_init.c
@@ -109,7 +109,7 @@ typedef struct _WLANDEV_INFO_T {
 
 MODULE_AUTHOR(NIC_AUTHOR);
 MODULE_DESCRIPTION(NIC_DESC);
-MODULE_SUPPORTED_DEVICE(NIC_NAME);
+//MODULE_SUPPORTED_DEVICE(NIC_NAME);
 
 /* MODULE_LICENSE("MTK Propietary"); */
 MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drv_wlan/MT6632/wlan/os/linux/gl_kal.c b/drv_wlan/MT6632/wlan/os/linux/gl_kal.c
index b534a5f..b97a94b 100644
--- a/drv_wlan/MT6632/wlan/os/linux/gl_kal.c
+++ b/drv_wlan/MT6632/wlan/os/linux/gl_kal.c
@@ -89,6 +89,8 @@
 #define FILE_NAME_MAX   CFG_FW_NAME_MAX_LEN /* the maximum length of a file name */
 #define FILE_NAME_TOTAL 8  /* the maximum number of all possible file name */
 
+#define netif_rx_ni netif_rx
+
 /*******************************************************************************
 *                             D A T A   T Y P E S
 ********************************************************************************
diff --git a/drv_wlan/MT6632/wlan/os/linux/include/gl_kal.h b/drv_wlan/MT6632/wlan/os/linux/include/gl_kal.h
index 12192f5..423a5aa 100644
--- a/drv_wlan/MT6632/wlan/os/linux/include/gl_kal.h
+++ b/drv_wlan/MT6632/wlan/os/linux/include/gl_kal.h
@@ -812,7 +812,7 @@ do { \
 		(_Interval) += KAL_GET_TIME_INTERVAL(); \
 	}
 
-#define KAL_GET_HOST_CLOCK()		local_clock()
+#define KAL_GET_HOST_CLOCK()		ktime_get_ns()
 
 /*******************************************************************************
 *                  F U N C T I O N   D E C L A R A T I O N S
diff --git a/drv_wlan/MT7663/wlan/common/wlan_lib.c b/drv_wlan/MT7663/wlan/common/wlan_lib.c
index 25fe6e2..51cafd2 100644
--- a/drv_wlan/MT7663/wlan/common/wlan_lib.c
+++ b/drv_wlan/MT7663/wlan/common/wlan_lib.c
@@ -74,6 +74,7 @@
 #include <linux/sched/clock.h>
 #include <linux/sched/task.h>
 #include <linux/sched/mm.h>
+#include <linux/ktime.h>
 
 /*******************************************************************************
  *                              C O N S T A N T S

这是6.6的patch 没有加内核版本判断,你可以保存成patch文件应用。local_clock()不知道为啥没导出我随便改成了ktime_get_ns()除错。
你这个报错可以注释掉drv_wlan/MT6632/wlan/os/linux/gl_init.c文件里的MODULE_SUPPORTED_DEVICE(NIC_NAME);解决

@easonchan-1874
Copy link

easonchan-1874 commented Nov 19, 2024

有无试过6.x编译此WiFi驱动能正常使用的?

https://github.com/SOUTH5663/MT7668/tree/k6.1 这个可以试试,我在这个分支基础上微调了6.6编译可用,6.1未测试

@jumkey 大佬,能拉个改好后的分支吗?我在6.1和6.6内核上报错,看不懂里面的代码😭 CC [M] /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_kal.o In file included from /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/include/gl_os.h:206, from /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_init.c:73: /root/src/MT7668/drv_wlan/MT6632/wlan/os/version.h:87:29: error: expected declaration specifiers or '...' before string constant 87 | #define NIC_NAME "MT6632" | ^~~~~~~~ /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_init.c:112:25: note: in expansion of macro 'NIC_NAME' 112 | MODULE_SUPPORTED_DEVICE(NIC_NAME); | ^~~~~~~~ make[3]: *** [scripts/Makefile.build:243: /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_init.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[2]: *** [/usr/src/linux-headers-6.6.56-ophub/Makefile:1921: /root/src/MT7668/drv_wlan/MT6632/wlan] Error 2 make[1]: *** [Makefile:234: __sub-make] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-6.6.56-ophub' make: *** [Makefile.x86:50: driver] Error 2

diff --git a/Makefile.x86 b/Makefile.x86
index 9bd034f..11d9018 100644
--- a/Makefile.x86
+++ b/Makefile.x86
@@ -20,7 +20,7 @@ ifeq ($(hif),)
     hif=usb
 endif
 
-MODULES_NAME := wlan_$(shell echo $(MTK_COMBO_CHIP) | tr A-Z a-z)
+MODULES_NAME := wlan_mt76x8
 
 export CONFIG_MTK_COMBO_WIFI_HIF=$(hif)
 
diff --git a/drv_wlan/MT6632/wlan/mgmt/p2p_func.c b/drv_wlan/MT6632/wlan/mgmt/p2p_func.c
index 7bc03b4..1648520 100644
--- a/drv_wlan/MT6632/wlan/mgmt/p2p_func.c
+++ b/drv_wlan/MT6632/wlan/mgmt/p2p_func.c
@@ -1222,7 +1222,7 @@ VOID p2pFuncDfsSwitchCh(IN P_ADAPTER_T prAdapter, IN P_BSS_INFO_T prBssInfo, IN
 
 	DBGLOG(P2P, INFO, "p2pFuncDfsSwitchCh: Update to OS\n");
 	cfg80211_ch_switch_notify(prGlueInfo->prP2PInfo[prP2pRoleFsmInfo->ucRoleIndex]->prDevHandler,
-					prGlueInfo->prP2PInfo[prP2pRoleFsmInfo->ucRoleIndex]->chandef);
+					prGlueInfo->prP2PInfo[prP2pRoleFsmInfo->ucRoleIndex]->chandef, 0, 0);
 	DBGLOG(P2P, INFO, "p2pFuncDfsSwitchCh: Update to OS Done\n");
 
 	if (prGlueInfo->prP2PInfo[prP2pRoleFsmInfo->ucRoleIndex]->chandef) {
diff --git a/drv_wlan/MT6632/wlan/os/linux/gl_cfg80211.c b/drv_wlan/MT6632/wlan/os/linux/gl_cfg80211.c
index 207e028..e13e104 100644
--- a/drv_wlan/MT6632/wlan/os/linux/gl_cfg80211.c
+++ b/drv_wlan/MT6632/wlan/os/linux/gl_cfg80211.c
@@ -2720,19 +2720,19 @@ mtk_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev, const
 
 	if (params == NULL)
 		return 0;
-	else if (params->supported_rates == NULL)
+	else if (params->link_sta_params.supported_rates == NULL)
 		return 0;
 
 	/* init */
 	kalMemZero(&rCmdUpdate, sizeof(rCmdUpdate));
 	kalMemCopy(rCmdUpdate.aucPeerMac, mac, 6);
 
-	if (params->supported_rates != NULL) {
+	if (params->link_sta_params.supported_rates != NULL) {
 
-		u4Temp = params->supported_rates_len;
+		u4Temp = params->link_sta_params.supported_rates_len;
 		if (u4Temp > CMD_PEER_UPDATE_SUP_RATE_MAX)
 			u4Temp = CMD_PEER_UPDATE_SUP_RATE_MAX;
-		kalMemCopy(rCmdUpdate.aucSupRate, params->supported_rates, u4Temp);
+		kalMemCopy(rCmdUpdate.aucSupRate, params->link_sta_params.supported_rates, u4Temp);
 		rCmdUpdate.u2SupRateLen = u4Temp;
 	}
 
@@ -2754,23 +2754,23 @@ mtk_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev, const
 		rCmdUpdate.u2ExtCapLen = u4Temp;
 	}
 
-	if (params->ht_capa != NULL) {
+	if (params->link_sta_params.ht_capa != NULL) {
 
-		rCmdUpdate.rHtCap.u2CapInfo = params->ht_capa->cap_info;
-		rCmdUpdate.rHtCap.ucAmpduParamsInfo = params->ht_capa->ampdu_params_info;
-		rCmdUpdate.rHtCap.u2ExtHtCapInfo = params->ht_capa->extended_ht_cap_info;
-		rCmdUpdate.rHtCap.u4TxBfCapInfo = params->ht_capa->tx_BF_cap_info;
-		rCmdUpdate.rHtCap.ucAntennaSelInfo = params->ht_capa->antenna_selection_info;
+		rCmdUpdate.rHtCap.u2CapInfo = params->link_sta_params.ht_capa->cap_info;
+		rCmdUpdate.rHtCap.ucAmpduParamsInfo = params->link_sta_params.ht_capa->ampdu_params_info;
+		rCmdUpdate.rHtCap.u2ExtHtCapInfo = params->link_sta_params.ht_capa->extended_ht_cap_info;
+		rCmdUpdate.rHtCap.u4TxBfCapInfo = params->link_sta_params.ht_capa->tx_BF_cap_info;
+		rCmdUpdate.rHtCap.ucAntennaSelInfo = params->link_sta_params.ht_capa->antenna_selection_info;
 		kalMemCopy(rCmdUpdate.rHtCap.rMCS.arRxMask,
-			   params->ht_capa->mcs.rx_mask, sizeof(rCmdUpdate.rHtCap.rMCS.arRxMask));
+			   params->link_sta_params.ht_capa->mcs.rx_mask, sizeof(rCmdUpdate.rHtCap.rMCS.arRxMask));
 
-		rCmdUpdate.rHtCap.rMCS.u2RxHighest = params->ht_capa->mcs.rx_highest;
-		rCmdUpdate.rHtCap.rMCS.ucTxParams = params->ht_capa->mcs.tx_params;
+		rCmdUpdate.rHtCap.rMCS.u2RxHighest = params->link_sta_params.ht_capa->mcs.rx_highest;
+		rCmdUpdate.rHtCap.rMCS.ucTxParams = params->link_sta_params.ht_capa->mcs.tx_params;
 		rCmdUpdate.fgIsSupHt = TRUE;
 	}
 	/* vht */
 
-	if (params->vht_capa != NULL) {
+	if (params->link_sta_params.vht_capa != NULL) {
 		/* rCmdUpdate.rVHtCap */
 		/* rCmdUpdate.rVHtCap */
 	}
@@ -2823,19 +2823,19 @@ mtk_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev, u8 *ma
 
 	if (params == NULL)
 		return 0;
-	else if (params->supported_rates == NULL)
+	else if (params->link_sta_params.supported_rates == NULL)
 		return 0;
 
 	/* init */
 	kalMemZero(&rCmdUpdate, sizeof(rCmdUpdate));
 	kalMemCopy(rCmdUpdate.aucPeerMac, mac, 6);
 
-	if (params->supported_rates != NULL) {
+	if (params->link_sta_params.supported_rates != NULL) {
 
-		u4Temp = params->supported_rates_len;
+		u4Temp = params->link_sta_params.supported_rates_len;
 		if (u4Temp > CMD_PEER_UPDATE_SUP_RATE_MAX)
 			u4Temp = CMD_PEER_UPDATE_SUP_RATE_MAX;
-		kalMemCopy(rCmdUpdate.aucSupRate, params->supported_rates, u4Temp);
+		kalMemCopy(rCmdUpdate.aucSupRate, params->link_sta_params.supported_rates, u4Temp);
 		rCmdUpdate.u2SupRateLen = u4Temp;
 	}
 
@@ -2857,23 +2857,23 @@ mtk_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev, u8 *ma
 		rCmdUpdate.u2ExtCapLen = u4Temp;
 	}
 
-	if (params->ht_capa != NULL) {
+	if (params->link_sta_params.ht_capa != NULL) {
 
-		rCmdUpdate.rHtCap.u2CapInfo = params->ht_capa->cap_info;
-		rCmdUpdate.rHtCap.ucAmpduParamsInfo = params->ht_capa->ampdu_params_info;
-		rCmdUpdate.rHtCap.u2ExtHtCapInfo = params->ht_capa->extended_ht_cap_info;
-		rCmdUpdate.rHtCap.u4TxBfCapInfo = params->ht_capa->tx_BF_cap_info;
-		rCmdUpdate.rHtCap.ucAntennaSelInfo = params->ht_capa->antenna_selection_info;
+		rCmdUpdate.rHtCap.u2CapInfo = params->link_sta_params.ht_capa->cap_info;
+		rCmdUpdate.rHtCap.ucAmpduParamsInfo = params->link_sta_params.ht_capa->ampdu_params_info;
+		rCmdUpdate.rHtCap.u2ExtHtCapInfo = params->link_sta_params.ht_capa->extended_ht_cap_info;
+		rCmdUpdate.rHtCap.u4TxBfCapInfo = params->link_sta_params.ht_capa->tx_BF_cap_info;
+		rCmdUpdate.rHtCap.ucAntennaSelInfo = params->link_sta_params.ht_capa->antenna_selection_info;
 		kalMemCopy(rCmdUpdate.rHtCap.rMCS.arRxMask,
-			   params->ht_capa->mcs.rx_mask, sizeof(rCmdUpdate.rHtCap.rMCS.arRxMask));
+			   params->link_sta_params.ht_capa->mcs.rx_mask, sizeof(rCmdUpdate.rHtCap.rMCS.arRxMask));
 
-		rCmdUpdate.rHtCap.rMCS.u2RxHighest = params->ht_capa->mcs.rx_highest;
-		rCmdUpdate.rHtCap.rMCS.ucTxParams = params->ht_capa->mcs.tx_params;
+		rCmdUpdate.rHtCap.rMCS.u2RxHighest = params->link_sta_params.ht_capa->mcs.rx_highest;
+		rCmdUpdate.rHtCap.rMCS.ucTxParams = params->link_sta_params.ht_capa->mcs.tx_params;
 		rCmdUpdate.fgIsSupHt = TRUE;
 	}
 	/* vht */
 
-	if (params->vht_capa != NULL) {
+	if (params->link_sta_params.vht_capa != NULL) {
 		/* rCmdUpdate.rVHtCap */
 		/* rCmdUpdate.rVHtCap */
 	}
diff --git a/drv_wlan/MT6632/wlan/os/linux/gl_init.c b/drv_wlan/MT6632/wlan/os/linux/gl_init.c
index 54007d2..5dd5ac4 100644
--- a/drv_wlan/MT6632/wlan/os/linux/gl_init.c
+++ b/drv_wlan/MT6632/wlan/os/linux/gl_init.c
@@ -109,7 +109,7 @@ typedef struct _WLANDEV_INFO_T {
 
 MODULE_AUTHOR(NIC_AUTHOR);
 MODULE_DESCRIPTION(NIC_DESC);
-MODULE_SUPPORTED_DEVICE(NIC_NAME);
+//MODULE_SUPPORTED_DEVICE(NIC_NAME);
 
 /* MODULE_LICENSE("MTK Propietary"); */
 MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drv_wlan/MT6632/wlan/os/linux/gl_kal.c b/drv_wlan/MT6632/wlan/os/linux/gl_kal.c
index b534a5f..b97a94b 100644
--- a/drv_wlan/MT6632/wlan/os/linux/gl_kal.c
+++ b/drv_wlan/MT6632/wlan/os/linux/gl_kal.c
@@ -89,6 +89,8 @@
 #define FILE_NAME_MAX   CFG_FW_NAME_MAX_LEN /* the maximum length of a file name */
 #define FILE_NAME_TOTAL 8  /* the maximum number of all possible file name */
 
+#define netif_rx_ni netif_rx
+
 /*******************************************************************************
 *                             D A T A   T Y P E S
 ********************************************************************************
diff --git a/drv_wlan/MT6632/wlan/os/linux/include/gl_kal.h b/drv_wlan/MT6632/wlan/os/linux/include/gl_kal.h
index 12192f5..423a5aa 100644
--- a/drv_wlan/MT6632/wlan/os/linux/include/gl_kal.h
+++ b/drv_wlan/MT6632/wlan/os/linux/include/gl_kal.h
@@ -812,7 +812,7 @@ do { \
 		(_Interval) += KAL_GET_TIME_INTERVAL(); \
 	}
 
-#define KAL_GET_HOST_CLOCK()		local_clock()
+#define KAL_GET_HOST_CLOCK()		ktime_get_ns()
 
 /*******************************************************************************
 *                  F U N C T I O N   D E C L A R A T I O N S
diff --git a/drv_wlan/MT7663/wlan/common/wlan_lib.c b/drv_wlan/MT7663/wlan/common/wlan_lib.c
index 25fe6e2..51cafd2 100644
--- a/drv_wlan/MT7663/wlan/common/wlan_lib.c
+++ b/drv_wlan/MT7663/wlan/common/wlan_lib.c
@@ -74,6 +74,7 @@
 #include <linux/sched/clock.h>
 #include <linux/sched/task.h>
 #include <linux/sched/mm.h>
+#include <linux/ktime.h>
 
 /*******************************************************************************
  *                              C O N S T A N T S

这是6.6的patch 没有加内核版本判断,你可以保存成patch文件应用。local_clock()不知道为啥没导出我随便改成了ktime_get_ns()除错。 你这个报错可以注释掉drv_wlan/MT6632/wlan/os/linux/gl_init.c文件里的MODULE_SUPPORTED_DEVICE(NIC_NAME);解决

CC [M] /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_proc.o
In file included from ./arch/arm64/include/asm/preempt.h:6,
from ./include/linux/preempt.h:79,
from ./include/linux/smp.h:110,
from ./arch/arm64/include/asm/arch_timer.h:18,
from ./arch/arm64/include/asm/timex.h:8,
from ./include/linux/timex.h:67,
from ./include/linux/time32.h:13,
from ./include/linux/time.h:60,
from ./include/linux/ktime.h:24,
from ./include/linux/timer.h:6,
from /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/include/gl_os.h:127,
from /root/src/MT7668/drv_wlan/MT6632/wlan/include/precomp.h:81,
from /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_proc.c:72:
In function 'check_copy_size',
inlined from 'copy_from_user' at ./include/linux/uaccess.h:182:6,
inlined from 'procDbgLevelWrite' at /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_proc.c:594:6:
./include/linux/thread_info.h:246:25: error: call to '__bad_copy_to' declared with attribute error: copy destination size is too small
246 | __bad_copy_to();
| ^~~~~~~~~~~~~~~
In function 'check_copy_size',
inlined from 'copy_from_user' at ./include/linux/uaccess.h:182:6,
inlined from 'procDriverCmdWrite' at /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_proc.c:562:6:
./include/linux/thread_info.h:246:25: error: call to '__bad_copy_to' declared with attribute error: copy destination size is too small
246 | __bad_copy_to();
| ^~~~~~~~~~~~~~~
make[3]: *** [scripts/Makefile.build:243: /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_proc.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/usr/src/linux-headers-6.6.50-ophub/Makefile:1921: /root/src/MT7668/drv_wlan/MT6632/wlan] Error 2
make[1]: *** [Makefile:234: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.6.50-ophub'
make: *** [Makefile.x86:50: driver] Error 2

大佬,我的armbian系统目前是6.6.50-ophub内核,又又又出现了新的报错😂

@jumkey
Copy link

jumkey commented Nov 19, 2024

有无试过6.x编译此WiFi驱动能正常使用的?

https://github.com/SOUTH5663/MT7668/tree/k6.1 这个可以试试,我在这个分支基础上微调了6.6编译可用,6.1未测试

@jumkey 大佬,能拉个改好后的分支吗?我在6.1和6.6内核上报错,看不懂里面的代码😭 CC [M] /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_kal.o In file included from /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/include/gl_os.h:206, from /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_init.c:73: /root/src/MT7668/drv_wlan/MT6632/wlan/os/version.h:87:29: error: expected declaration specifiers or '...' before string constant 87 | #define NIC_NAME "MT6632" | ^~~~~~~~ /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_init.c:112:25: note: in expansion of macro 'NIC_NAME' 112 | MODULE_SUPPORTED_DEVICE(NIC_NAME); | ^~~~~~~~ make[3]: *** [scripts/Makefile.build:243: /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_init.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[2]: *** [/usr/src/linux-headers-6.6.56-ophub/Makefile:1921: /root/src/MT7668/drv_wlan/MT6632/wlan] Error 2 make[1]: *** [Makefile:234: __sub-make] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-6.6.56-ophub' make: *** [Makefile.x86:50: driver] Error 2

diff --git a/Makefile.x86 b/Makefile.x86
index 9bd034f..11d9018 100644
--- a/Makefile.x86
+++ b/Makefile.x86
@@ -20,7 +20,7 @@ ifeq ($(hif),)
     hif=usb
 endif
 
-MODULES_NAME := wlan_$(shell echo $(MTK_COMBO_CHIP) | tr A-Z a-z)
+MODULES_NAME := wlan_mt76x8
 
 export CONFIG_MTK_COMBO_WIFI_HIF=$(hif)
 
diff --git a/drv_wlan/MT6632/wlan/mgmt/p2p_func.c b/drv_wlan/MT6632/wlan/mgmt/p2p_func.c
index 7bc03b4..1648520 100644
--- a/drv_wlan/MT6632/wlan/mgmt/p2p_func.c
+++ b/drv_wlan/MT6632/wlan/mgmt/p2p_func.c
@@ -1222,7 +1222,7 @@ VOID p2pFuncDfsSwitchCh(IN P_ADAPTER_T prAdapter, IN P_BSS_INFO_T prBssInfo, IN
 
 	DBGLOG(P2P, INFO, "p2pFuncDfsSwitchCh: Update to OS\n");
 	cfg80211_ch_switch_notify(prGlueInfo->prP2PInfo[prP2pRoleFsmInfo->ucRoleIndex]->prDevHandler,
-					prGlueInfo->prP2PInfo[prP2pRoleFsmInfo->ucRoleIndex]->chandef);
+					prGlueInfo->prP2PInfo[prP2pRoleFsmInfo->ucRoleIndex]->chandef, 0, 0);
 	DBGLOG(P2P, INFO, "p2pFuncDfsSwitchCh: Update to OS Done\n");
 
 	if (prGlueInfo->prP2PInfo[prP2pRoleFsmInfo->ucRoleIndex]->chandef) {
diff --git a/drv_wlan/MT6632/wlan/os/linux/gl_cfg80211.c b/drv_wlan/MT6632/wlan/os/linux/gl_cfg80211.c
index 207e028..e13e104 100644
--- a/drv_wlan/MT6632/wlan/os/linux/gl_cfg80211.c
+++ b/drv_wlan/MT6632/wlan/os/linux/gl_cfg80211.c
@@ -2720,19 +2720,19 @@ mtk_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev, const
 
 	if (params == NULL)
 		return 0;
-	else if (params->supported_rates == NULL)
+	else if (params->link_sta_params.supported_rates == NULL)
 		return 0;
 
 	/* init */
 	kalMemZero(&rCmdUpdate, sizeof(rCmdUpdate));
 	kalMemCopy(rCmdUpdate.aucPeerMac, mac, 6);
 
-	if (params->supported_rates != NULL) {
+	if (params->link_sta_params.supported_rates != NULL) {
 
-		u4Temp = params->supported_rates_len;
+		u4Temp = params->link_sta_params.supported_rates_len;
 		if (u4Temp > CMD_PEER_UPDATE_SUP_RATE_MAX)
 			u4Temp = CMD_PEER_UPDATE_SUP_RATE_MAX;
-		kalMemCopy(rCmdUpdate.aucSupRate, params->supported_rates, u4Temp);
+		kalMemCopy(rCmdUpdate.aucSupRate, params->link_sta_params.supported_rates, u4Temp);
 		rCmdUpdate.u2SupRateLen = u4Temp;
 	}
 
@@ -2754,23 +2754,23 @@ mtk_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev, const
 		rCmdUpdate.u2ExtCapLen = u4Temp;
 	}
 
-	if (params->ht_capa != NULL) {
+	if (params->link_sta_params.ht_capa != NULL) {
 
-		rCmdUpdate.rHtCap.u2CapInfo = params->ht_capa->cap_info;
-		rCmdUpdate.rHtCap.ucAmpduParamsInfo = params->ht_capa->ampdu_params_info;
-		rCmdUpdate.rHtCap.u2ExtHtCapInfo = params->ht_capa->extended_ht_cap_info;
-		rCmdUpdate.rHtCap.u4TxBfCapInfo = params->ht_capa->tx_BF_cap_info;
-		rCmdUpdate.rHtCap.ucAntennaSelInfo = params->ht_capa->antenna_selection_info;
+		rCmdUpdate.rHtCap.u2CapInfo = params->link_sta_params.ht_capa->cap_info;
+		rCmdUpdate.rHtCap.ucAmpduParamsInfo = params->link_sta_params.ht_capa->ampdu_params_info;
+		rCmdUpdate.rHtCap.u2ExtHtCapInfo = params->link_sta_params.ht_capa->extended_ht_cap_info;
+		rCmdUpdate.rHtCap.u4TxBfCapInfo = params->link_sta_params.ht_capa->tx_BF_cap_info;
+		rCmdUpdate.rHtCap.ucAntennaSelInfo = params->link_sta_params.ht_capa->antenna_selection_info;
 		kalMemCopy(rCmdUpdate.rHtCap.rMCS.arRxMask,
-			   params->ht_capa->mcs.rx_mask, sizeof(rCmdUpdate.rHtCap.rMCS.arRxMask));
+			   params->link_sta_params.ht_capa->mcs.rx_mask, sizeof(rCmdUpdate.rHtCap.rMCS.arRxMask));
 
-		rCmdUpdate.rHtCap.rMCS.u2RxHighest = params->ht_capa->mcs.rx_highest;
-		rCmdUpdate.rHtCap.rMCS.ucTxParams = params->ht_capa->mcs.tx_params;
+		rCmdUpdate.rHtCap.rMCS.u2RxHighest = params->link_sta_params.ht_capa->mcs.rx_highest;
+		rCmdUpdate.rHtCap.rMCS.ucTxParams = params->link_sta_params.ht_capa->mcs.tx_params;
 		rCmdUpdate.fgIsSupHt = TRUE;
 	}
 	/* vht */
 
-	if (params->vht_capa != NULL) {
+	if (params->link_sta_params.vht_capa != NULL) {
 		/* rCmdUpdate.rVHtCap */
 		/* rCmdUpdate.rVHtCap */
 	}
@@ -2823,19 +2823,19 @@ mtk_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev, u8 *ma
 
 	if (params == NULL)
 		return 0;
-	else if (params->supported_rates == NULL)
+	else if (params->link_sta_params.supported_rates == NULL)
 		return 0;
 
 	/* init */
 	kalMemZero(&rCmdUpdate, sizeof(rCmdUpdate));
 	kalMemCopy(rCmdUpdate.aucPeerMac, mac, 6);
 
-	if (params->supported_rates != NULL) {
+	if (params->link_sta_params.supported_rates != NULL) {
 
-		u4Temp = params->supported_rates_len;
+		u4Temp = params->link_sta_params.supported_rates_len;
 		if (u4Temp > CMD_PEER_UPDATE_SUP_RATE_MAX)
 			u4Temp = CMD_PEER_UPDATE_SUP_RATE_MAX;
-		kalMemCopy(rCmdUpdate.aucSupRate, params->supported_rates, u4Temp);
+		kalMemCopy(rCmdUpdate.aucSupRate, params->link_sta_params.supported_rates, u4Temp);
 		rCmdUpdate.u2SupRateLen = u4Temp;
 	}
 
@@ -2857,23 +2857,23 @@ mtk_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev, u8 *ma
 		rCmdUpdate.u2ExtCapLen = u4Temp;
 	}
 
-	if (params->ht_capa != NULL) {
+	if (params->link_sta_params.ht_capa != NULL) {
 
-		rCmdUpdate.rHtCap.u2CapInfo = params->ht_capa->cap_info;
-		rCmdUpdate.rHtCap.ucAmpduParamsInfo = params->ht_capa->ampdu_params_info;
-		rCmdUpdate.rHtCap.u2ExtHtCapInfo = params->ht_capa->extended_ht_cap_info;
-		rCmdUpdate.rHtCap.u4TxBfCapInfo = params->ht_capa->tx_BF_cap_info;
-		rCmdUpdate.rHtCap.ucAntennaSelInfo = params->ht_capa->antenna_selection_info;
+		rCmdUpdate.rHtCap.u2CapInfo = params->link_sta_params.ht_capa->cap_info;
+		rCmdUpdate.rHtCap.ucAmpduParamsInfo = params->link_sta_params.ht_capa->ampdu_params_info;
+		rCmdUpdate.rHtCap.u2ExtHtCapInfo = params->link_sta_params.ht_capa->extended_ht_cap_info;
+		rCmdUpdate.rHtCap.u4TxBfCapInfo = params->link_sta_params.ht_capa->tx_BF_cap_info;
+		rCmdUpdate.rHtCap.ucAntennaSelInfo = params->link_sta_params.ht_capa->antenna_selection_info;
 		kalMemCopy(rCmdUpdate.rHtCap.rMCS.arRxMask,
-			   params->ht_capa->mcs.rx_mask, sizeof(rCmdUpdate.rHtCap.rMCS.arRxMask));
+			   params->link_sta_params.ht_capa->mcs.rx_mask, sizeof(rCmdUpdate.rHtCap.rMCS.arRxMask));
 
-		rCmdUpdate.rHtCap.rMCS.u2RxHighest = params->ht_capa->mcs.rx_highest;
-		rCmdUpdate.rHtCap.rMCS.ucTxParams = params->ht_capa->mcs.tx_params;
+		rCmdUpdate.rHtCap.rMCS.u2RxHighest = params->link_sta_params.ht_capa->mcs.rx_highest;
+		rCmdUpdate.rHtCap.rMCS.ucTxParams = params->link_sta_params.ht_capa->mcs.tx_params;
 		rCmdUpdate.fgIsSupHt = TRUE;
 	}
 	/* vht */
 
-	if (params->vht_capa != NULL) {
+	if (params->link_sta_params.vht_capa != NULL) {
 		/* rCmdUpdate.rVHtCap */
 		/* rCmdUpdate.rVHtCap */
 	}
diff --git a/drv_wlan/MT6632/wlan/os/linux/gl_init.c b/drv_wlan/MT6632/wlan/os/linux/gl_init.c
index 54007d2..5dd5ac4 100644
--- a/drv_wlan/MT6632/wlan/os/linux/gl_init.c
+++ b/drv_wlan/MT6632/wlan/os/linux/gl_init.c
@@ -109,7 +109,7 @@ typedef struct _WLANDEV_INFO_T {
 
 MODULE_AUTHOR(NIC_AUTHOR);
 MODULE_DESCRIPTION(NIC_DESC);
-MODULE_SUPPORTED_DEVICE(NIC_NAME);
+//MODULE_SUPPORTED_DEVICE(NIC_NAME);
 
 /* MODULE_LICENSE("MTK Propietary"); */
 MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drv_wlan/MT6632/wlan/os/linux/gl_kal.c b/drv_wlan/MT6632/wlan/os/linux/gl_kal.c
index b534a5f..b97a94b 100644
--- a/drv_wlan/MT6632/wlan/os/linux/gl_kal.c
+++ b/drv_wlan/MT6632/wlan/os/linux/gl_kal.c
@@ -89,6 +89,8 @@
 #define FILE_NAME_MAX   CFG_FW_NAME_MAX_LEN /* the maximum length of a file name */
 #define FILE_NAME_TOTAL 8  /* the maximum number of all possible file name */
 
+#define netif_rx_ni netif_rx
+
 /*******************************************************************************
 *                             D A T A   T Y P E S
 ********************************************************************************
diff --git a/drv_wlan/MT6632/wlan/os/linux/include/gl_kal.h b/drv_wlan/MT6632/wlan/os/linux/include/gl_kal.h
index 12192f5..423a5aa 100644
--- a/drv_wlan/MT6632/wlan/os/linux/include/gl_kal.h
+++ b/drv_wlan/MT6632/wlan/os/linux/include/gl_kal.h
@@ -812,7 +812,7 @@ do { \
 		(_Interval) += KAL_GET_TIME_INTERVAL(); \
 	}
 
-#define KAL_GET_HOST_CLOCK()		local_clock()
+#define KAL_GET_HOST_CLOCK()		ktime_get_ns()
 
 /*******************************************************************************
 *                  F U N C T I O N   D E C L A R A T I O N S
diff --git a/drv_wlan/MT7663/wlan/common/wlan_lib.c b/drv_wlan/MT7663/wlan/common/wlan_lib.c
index 25fe6e2..51cafd2 100644
--- a/drv_wlan/MT7663/wlan/common/wlan_lib.c
+++ b/drv_wlan/MT7663/wlan/common/wlan_lib.c
@@ -74,6 +74,7 @@
 #include <linux/sched/clock.h>
 #include <linux/sched/task.h>
 #include <linux/sched/mm.h>
+#include <linux/ktime.h>
 
 /*******************************************************************************
  *                              C O N S T A N T S

这是6.6的patch 没有加内核版本判断,你可以保存成patch文件应用。local_clock()不知道为啥没导出我随便改成了ktime_get_ns()除错。 你这个报错可以注释掉drv_wlan/MT6632/wlan/os/linux/gl_init.c文件里的MODULE_SUPPORTED_DEVICE(NIC_NAME);解决

CC [M] /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_proc.o In file included from ./arch/arm64/include/asm/preempt.h:6, from ./include/linux/preempt.h:79, from ./include/linux/smp.h:110, from ./arch/arm64/include/asm/arch_timer.h:18, from ./arch/arm64/include/asm/timex.h:8, from ./include/linux/timex.h:67, from ./include/linux/time32.h:13, from ./include/linux/time.h:60, from ./include/linux/ktime.h:24, from ./include/linux/timer.h:6, from /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/include/gl_os.h:127, from /root/src/MT7668/drv_wlan/MT6632/wlan/include/precomp.h:81, from /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_proc.c:72: In function 'check_copy_size', inlined from 'copy_from_user' at ./include/linux/uaccess.h:182:6, inlined from 'procDbgLevelWrite' at /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_proc.c:594:6: ./include/linux/thread_info.h:246:25: error: call to '__bad_copy_to' declared with attribute error: copy destination size is too small 246 | __bad_copy_to(); | ^~~~~~~~~~~~~~~ In function 'check_copy_size', inlined from 'copy_from_user' at ./include/linux/uaccess.h:182:6, inlined from 'procDriverCmdWrite' at /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_proc.c:562:6: ./include/linux/thread_info.h:246:25: error: call to '__bad_copy_to' declared with attribute error: copy destination size is too small 246 | __bad_copy_to(); | ^~~~~~~~~~~~~~~ make[3]: *** [scripts/Makefile.build:243: /root/src/MT7668/drv_wlan/MT6632/wlan/os/linux/gl_proc.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[2]: *** [/usr/src/linux-headers-6.6.50-ophub/Makefile:1921: /root/src/MT7668/drv_wlan/MT6632/wlan] Error 2 make[1]: *** [Makefile:234: __sub-make] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-6.6.50-ophub' make: *** [Makefile.x86:50: driver] Error 2

大佬,我的armbian系统目前是6.6.50-ophub内核,又又又出现了新的报错😂

EXTRA_CFLAGS加个-O0试试
比如make EXTRA_CFLAGS="-w -O0" CROSS_COMPILE=/opt/gcc-aarch64-none-elf/bin/aarch64-none-elf- -f Makefile.x86 -j4

@easonchan-1874
Copy link

niceeeeeee,终于编译成功了,非常感谢大佬鼎力相助!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation new box Research Fills in the Blanks support This need is supported
Projects
None yet
Development

No branches or pull requests

7 participants