笔记本电脑安装CentOS8.0操作系统,无线网卡无法使用?!

近日在Thinkpad E490笔记本电脑上物理安装了新发布的CentOS8.0.1905系统。

安装时发现CentOS8.0缺少Realtek8822be无线网卡驱动?!抱着试一试的心态,安装完系统之后,使用有线网卡连接,更新了系统,内核升级到4.18.0-80.7.1.el8_0.x86_64,还是无法使用无线网卡。

此前已经在CentOS7系统中发现此问题(CentOS7.6以及更早的版本),并附有解决方案,请点击以下链接,参考此前的文章,获取解决思路与方法:

CentOS7.6操作系统安装Realtek8822be无线网卡驱动

大约10余天前发布的CentOS Linux 7.7(1908),已经包含Realtek8822be无线网卡驱动!无须再采用此文的解决方案了。

原本以为CentOS8.0应有支持Realtek8822be的驱动,但实际缺少。参考此前的方法,于是上https://www.kernel.org,找到linux kernel 4.19.67(如有更高版本>=4.19.67可参考)。

分析之后,发现rtl8822be是在drivers\staging\rtlwifi目录下,于是复制rtlwifi目录出来,移植CentOS8.0系统中。

在CentOS8.0系统中,进行编译之前,先对Makefile补充了一些内容(如下图所示,加到原Makefile顶部)

加到原Makefile底部(如下图所示)

编译时,需要root权限,系统要安装有当前内核版本的模块、头文件等。尝试执行make,结果发现有小问题:

[root@server rtlwifi-centos8]# makemake -C /lib/modules/4.18.0-80.7.1.el8_0.x86_64/build M=/work/kernel/rtlwifi-centos8 modulesmake[1]: Entering directory '/usr/src/kernels/4.18.0-80.7.1.el8_0.x86_64'Makefile:958: *** "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel".  Stop.make[1]: Leaving directory '/usr/src/kernels/4.18.0-80.7.1.el8_0.x86_64'make: *** [Makefile:107: all] Error 2

提示需要安装(please install libelf-dev, libelf-devel or elfutils-libelf-devel),于是挨个尝试(libelf-dev, libelf-devel),没有找到匹配项:

[root@server rtlwifi-centos8]# yum install libelf-devLast metadata expiration check: 0:26:30 ago on Mon 30 Sep 2019 12:09:24 AM CST.No match for argument: libelf-devError: Unable to find a match
[root@server rtlwifi-centos8]# yum install libelf-develLast metadata expiration check: 0:26:40 ago on Mon 30 Sep 2019 12:09:24 AM CST.No match for argument: libelf-develError: Unable to find a match

继续尝试(elfutils-libelf-devel):

[root@demon rtlwifi-centos8]# yum install elfutils-libelf-develLast metadata expiration check: 0:27:28 ago on Mon 30 Sep 2019 12:09:24 AM CST.Dependencies resolved.=================================================================================================================================================================================================================== Package                                                     Arch                                         Version                                               Repository                                    Size===================================================================================================================================================================================================================Installing: elfutils-libelf-devel                                       x86_64                                       0.174-6.el8                                           BaseOS                                        53 kInstalling dependencies: zlib-devel                                                  x86_64                                       1.2.11-10.el8                                         BaseOS                                        56 k
Transaction Summary===================================================================================================================================================================================================================Install  2 Packages
Total download size: 110 kInstalled size: 170 kIs this ok [y/N]: yDownloading Packages:(1/2): elfutils-libelf-devel-0.174-6.el8.x86_64.rpm                                                                                                                                 44 kB/s |  53 kB     00:01    (2/2): zlib-devel-1.2.11-10.el8.x86_64.rpm                                                                                                                                          47 kB/s |  56 kB     00:01    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Total                                                                                                                                                                               25 kB/s | 110 kB     00:04     Running transaction checkTransaction check succeeded.Running transaction testTransaction test succeeded.Running transaction  Preparing        :                                                                                                                                                                                           1/1   Installing       : zlib-devel-1.2.11-10.el8.x86_64                                                                                                                                                           1/2   Installing       : elfutils-libelf-devel-0.174-6.el8.x86_64                                                                                                                                                  2/2   Running scriptlet: elfutils-libelf-devel-0.174-6.el8.x86_64                                                                                                                                                  2/2   Verifying        : elfutils-libelf-devel-0.174-6.el8.x86_64                                                                                                                                                  1/2   Verifying        : zlib-devel-1.2.11-10.el8.x86_64                                                                                                                                                           2/2 
Installed:  elfutils-libelf-devel-0.174-6.el8.x86_64                                                                     zlib-devel-1.2.11-10.el8.x86_64
Complete!

安装成功了。接下来编译遇到个小问题:

[root@server rtlwifi-centos8]# make installmake -C /lib/modules/4.18.0-80.7.1.el8_0.x86_64/build M=/work/kernel/rtlwifi-centos8 modulesmake[1]: Entering directory '/usr/src/kernels/4.18.0-80.7.1.el8_0.x86_64'  CC [M]  /work/kernel/rtlwifi-centos8/base.o/work/kernel/rtlwifi-centos8/base.c: In function ‘rtl_rx_ampdu_apply’:/work/kernel/rtlwifi-centos8/base.c:1834:31: error: ‘IEEE80211_MAX_AMPDU_BUF_HT’ undeclared (first use in this function); did you mean ‘IEEE80211_MAX_AMPDU_BUF’?   (ctrl_agg_size ? agg_size : IEEE80211_MAX_AMPDU_BUF_HT);                               ^~~~~~~~~~~~~~~~~~~~~~~~~~                               IEEE80211_MAX_AMPDU_BUF/work/kernel/rtlwifi-centos8/base.c:1834:31: note: each undeclared identifier is reported only once for each function it appears inmake[2]: *** [scripts/Makefile.build:316: /work/kernel/rtlwifi-centos8/base.o] Error 1make[1]: *** [Makefile:1528: _module_/work/kernel/rtlwifi-centos8] Error 2make[1]: Leaving directory '/usr/src/kernels/4.18.0-80.7.1.el8_0.x86_64'make: *** [Makefile:107: all] Error 2

在base.h文件中增加一个定义:

#define IEEE80211_MAX_AMPDU_BUF_HT      0x40

继续编译,正常编译成功:

[root@server rtlwifi-centos8]# makemake -C /lib/modules/4.18.0-80.7.1.el8_0.x86_64/build M=/work/kernel/rtlwifi-centos8 modulesmake[1]: Entering directory '/usr/src/kernels/4.18.0-80.7.1.el8_0.x86_64'  CC [M]  /work/kernel/rtlwifi-centos8/base.o  ......    LD [M]  /work/kernel/rtlwifi-centos8/r8822be.o  Building modules, stage 2.  MODPOST 1 modules  CC      /work/kernel/rtlwifi-centos8/r8822be.mod.o  LD [M]  /work/kernel/rtlwifi-centos8/r8822be.komake[1]: Leaving directory '/usr/src/kernels/4.18.0-80.7.1.el8_0.x86_64

安装成功:

[root@server rtlwifi-centos8]# make installmake -C /lib/modules/4.18.0-80.7.1.el8_0.x86_64/build M=/work/kernel/rtlwifi-centos8 modulesmake[1]: Entering directory '/usr/src/kernels/4.18.0-80.7.1.el8_0.x86_64'  Building modules, stage 2.  MODPOST 1 modulesmake[1]: Leaving directory '/usr/src/kernels/4.18.0-80.7.1.el8_0.x86_64'Install rtlwifi SUCCESS

安装后,动态加载模块:

modprobe r8822be

查看驱动加载情况:

[root@server ~]# lsmod | grep 8822r8822be               958464  0mac80211              839680  1 r8822becfg80211              745472  2 mac80211,r8822be

查看无线网卡,已经可以搜索到SSID,连接后可以上网了,问题已经解决!

注:本文为Toyo Lau原创,未经许可不得在任何平台转载,侵权必究。如需转载,可关注公众号,在后台留言,与作者联系,取得许可才能转载~欢迎加入linux交流群:734638086,技术讨论。

 

微信扫一扫,发现更精彩。

你可能感兴趣的:(网络,操作系统,centOS8.0,linux)