1. 程式人生 > >Linux下無線網絡卡驅動異常解決辦法

Linux下無線網絡卡驅動異常解決辦法

檢視本機無線網絡卡型號:lspci | grep Network    本機型號是RTL8723BE

在 https://github.com/lwfinger/rtlwifi_new 找到自己對應型號的驅動


閱讀README.md 

rtlwifi_new
A repo for the newest Realtek rtlwifi codes.

This code will build on any kernel 4.2 and newer as long as the distro has not modified any of the kernel APIs. IF YOU RUN UBUNTU, YOU CAN BE ASSURED THAT THE APIs HAVE CHANGED. NO, I WILL NOT MODIFY THE SOURCE FOR YOU. YOU ARE ON YOUR OWN!!!!!

It includes the following drivers:

rtl8192ce, rtl8192cu, rtl8192se, rtl8192de, rtl8188ee, rtl8192ee, rtl8723ae, rtl8723be, and rtl8821ae.

If you are looking for the driver for rtl8822be or rtl8723de, then execute the following command:

git checkout origin/extended -b extended
Installation instruction

You can find <> using lspci | grep Wireless. Afterwards, execute the following lines of codes in your shell:

You will need to install "make", "gcc", "kernel headers", "kernel build essentials", and "git".

If you are running Ubuntu, then

 sudo apt-get install linux-headers-generic build-essential git

Please note the first paragraph above.

For all distros:
git clone https://github.com/lwfinger/rtlwifi_new.git
cd rtlwifi_new
sudo make install
sudo modprobe -r <<YOUR WIRELESS DRIVER CODE>>
sudo modprobe <<YOUR WIRELESS DRIVER CODE>>

#### Option configuration
If it turns out that your system needs one of the configuration options, then do the following:

vim /etc/modprobe.d/<<YOUR WIRELESS DRIVER CODE>>.conf 

There, enter the line below:
`options <<YOUR WIRELESS DRIVER CODE>> <<driver_option_name>>=<value>`

首先知道要核心版本至少要4.2版本(uname -r檢視核心版本),若不符合要求則需要編譯核心。

下載核心原始碼並解壓進入原始碼安裝包 推薦下載地址 https://www.kernel.org/ 找到合適版本的核心下載,我用的是4.4.126。

下載完成後執行下面命令

tar xvf linux-4.4.126.tar.xz -C /usr/src/kernels/ && cd /usr/src/kernels/linux-4.4.126
make oldconfig        //會出現很多選項,選擇預設
make bzImage && make modules && make modules_install && make install     //等待編譯安裝完成
cat /boot/grub2/grub.cfg | grep menuentry        //檢視系統可用核心
grub2-set-default 'Red Hat Enterprise Linux Server (4.4.126) 7.2 (Maipo)'    //修改開機預設使用的核心

執行完畢後重啟即可。編譯過程可參考https://blog.csdn.net/GuoQiiang/article/details/75810075

繼續進入到要安裝目錄執行 make,若make出錯

錯誤內容:“make: * /lib/modules/2.6.32-431.el6.x86_64/build:沒有那個檔案或目錄”
-安裝kernel-header和kernel-devel 解決錯誤     //kernel-header和kernel-devel可在 https://pkgs.org/ 上找到
-重新make
-make完成執行 make install
-最後執行 modprobe rtl8723be
注意:以上命令要在root使用者下執行


然後重啟系統你會發現你的無線網絡卡已經可以用了