我是 Linux 新手,不知道驱动程序如何工作,特别是那些未包含在内核中的驱动程序。我在 Ubuntu 20.04 上,lsusb 给了我
Bus 001 Device 004: ID 2357:0115 TP-Link 802.11ac NIC
因此问题出在制造商提供的官方 Linux 驱动程序上: https://www.tp-link.com/us/support/download/archer-t4u/#Driver 按照安装指南:https://static.tp-link.com/2018/201812/20181207/Installation%20Guide%20for%20Linux.pdf 我在 make 命令之后收到 2 个错误:
make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/5.8.0-43-generic/build M=/home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED modules
make[1]: Entering directory '/usr/src/linux-headers-5.8.0-43-generic'
CC [M] /home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/core/rtw_cmd.o
In file included from /home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/include/osdep_service.h:42,
from /home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/include/drv_types.h:27,
from /home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/core/rtw_cmd.c:17:
/home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/include/osdep_service_linux.h: In function ‘_init_timer’:
/home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/include/osdep_service_linux.h:282:8: error: ‘_timer’ {aka ‘struct timer_list’} has no member named ‘data’
282 | ptimer->data = (unsigned long)cntx;
| ^~
/home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/include/osdep_service_linux.h:283:2: error: implicit declaration of function ‘init_timer’; did you mean ‘_init_timer’? [-Werror=implicit-function-declaration]
283 | init_timer(ptimer);
| ^~~~~~~~~~
| _init_timer
In file included from /home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/include/drv_types.h:30,
from /home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/core/rtw_cmd.c:17:
/home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/include/wifi.h: At top level:
/home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/include/wifi.h:1014: warning: "IEEE80211_MAX_AMPDU_BUF" redefined
1014 | #define IEEE80211_MAX_AMPDU_BUF 0x40
|
In file included from /home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/include/osdep_service_linux.h:83,
from /home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/include/osdep_service.h:42,
from /home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/include/drv_types.h:27,
from /home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/core/rtw_cmd.c:17:
./include/linux/ieee80211.h:1600: note: this is the location of the previous definition
1600 | #define IEEE80211_MAX_AMPDU_BUF 0x100
|
In file included from /home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/include/drv_types.h:77,
from /home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/core/rtw_cmd.c:17:
/home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/include/rtw_security.h:242:8: error: redefinition of ‘struct sha256_state’
242 | struct sha256_state {
| ^~~~~~~~~~~~
In file included from ./include/linux/filter.h:23,
from ./include/net/sock.h:59,
from ./include/linux/tcp.h:19,
from ./include/linux/ipv6.h:88,
from ./include/net/addrconf.h:50,
from /home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/include/osdep_service_linux.h:48,
from /home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/include/osdep_service.h:42,
from /home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/include/drv_types.h:27,
from /home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/core/rtw_cmd.c:17:
./include/crypto/sha.h:84:8: note: originally defined here
84 | struct sha256_state {
| ^~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:290: /home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED/core/rtw_cmd.o] Error 1
make[1]: *** [Makefile:1780: /home/z3/tmpstuff/rtl88x2BU_WiFi_linux_v5.2.4.1_22719.20170613_COEX20170518-4444_AddLED] Error 2
有没有办法纠正这 2 个错误?因为它没有按要求创建任何 .ko 文件
并且如果成功将结果文件复制到 /lib/modules/[kernel version]/kernel/drivers/net/wireless/ 是可行的方法吗?
答案1
您可以从安装驱动程序Cilynx 的 RTL88x2BU GitHub 仓库这对我来说很有效。
正如 repo 中详细说明的那样,我已经使用以下方式安装了驱动程序DKMS 安装方法:
git clone https://github.com/cilynx/rtl88x2bu.git
cd rtl88x2bu
VER=$(sed -n 's/\PACKAGE_VERSION="\(.*\)"/\1/p' dkms.conf)
sudo rsync -rvhP ./ /usr/src/rtl88x2bu-${VER}
sudo dkms add -m rtl88x2bu -v ${VER}
sudo dkms build -m rtl88x2bu -v ${VER}
sudo dkms install -m rtl88x2bu -v ${VER}
sudo modprobe 88x2bu