0x00 自行下載下傳網卡驅動,一般購買無線網卡會附贈驅動。
0x01 修改config.mk檔案,一般在os/linux/config.mk下。
将“HAS_WPA_SUPPLICANT=n”改為“HAS_WPA_SUPPLICANT=y”;
“HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n”改為“HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y”。
0x02 終端切換進入解壓目錄,執行編譯指令:sudo make,編譯出現錯誤,
解決方法一:将 os/linux/rt_linux.c檔案的pOSFSInfo->fsuid= current_fsuid();和pOSFSInfo->fsgid=current_fsgid(); 用#号注釋掉即可。
解決方法二:強制類型轉換。
将“pOSFSInfo->fsuid= current_fsuid(); ”改為“pOSFSInfo->fsuid= *(int *)¤t_fsuid(); ”
将“pOSFSInfo->fsgid=current_fsgid(); ”改為“pOSFSInfo->fsgid= *(int *)¤t_fsgid(); ”
0x03 如果報錯是這樣的話;
sta_cfg.c:5766:85: error: macro "__DATE__" might prevent reproducible builds [-Werror=date-time]
snprintf(extra, size, "Driver version-%s, %s %s\n", STA_DRIVER_VERSION, __DATE__, __TIME__ );
^
sta/sta_cfg.c:5766:95: error: macro "__TIME__" might prevent reproducible builds [-Werror=date-time]
snprintf(extra, size, "Driver version-%s, %s %s\n", STA_DRIVER_VERSION, __DATE__, __TIME__ );
這個錯誤是因為編譯選項開啟了-Werror,這樣可以解決。
修改/lib/modules/`uname -r`/build/Makefile
#gedit /lib/modules/`uname -r`/build/Makefile
查找-Werror 用#号注釋或者删掉下面4段文本
<span style="display: none; width: 0px; height: 0px;" id="transmark"></span>-Werror-implicit-function-declaration
,-Werror=implicit-int
,-Werror=strict-prototypes
,-Werror=date-time
0x04 編譯安裝
sudo make
sudo make install
0x05 禁用系統自帶驅動
/etc/modprobe.d/blacklist.conf
在裡面寫入需要禁用的驅動。如:
sudo echo "blacklist rt2800usb">>/etc/modprobe.d/blacklist.conf
0x06 重新開機
reboot