Linux编译Ralink无线网卡驱动

来源:互联网 发布:飞鸽传书是什么软件 编辑:程序博客网 时间:2024/06/11 11:07

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 makesudo make install

0x05 禁用系统自带驱动

/etc/modprobe.d/blacklist.conf

在里面写入需要禁用的驱动。如:

sudo echo "blacklist rt2800usb">>/etc/modprobe.d/blacklist.conf

0x06 重启

reboot








0 0
原创粉丝点击