我正在尝试编译我购买的 Ralink 5370 usb wifi 适配器附带的驱动程序,用于 Lubuntu 14.4.1(32 位版本)。我正在运行3.16.0-24-generic
内核。
sudo make
当我尝试按照一般程序进行编译时,头文件出现类型转换错误这里:
/home/username/wifidriver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/sta_ioctl.c: In function ‘rt_ioctl_giwscan’:
./arch/x86/include/asm/string_32.h:182:25: warning: array subscript is below array bounds [-Warray-bounds]
#define memcpy(t, f, n) __builtin_memcpy(t, f, n)
^
include/net/iw_handler.h:542:3: note: in expansion of macro ‘memcpy’
memcpy(stream + point_len, extra, iwe->u.data.length);
^
CC [M] /home/username/wifidriver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/rt_linux.o
/home/username/wifidriver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/rt_linux.c: In function ‘__RtmpOSFSInfoChange’:
/home/username/wifidriver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/rt_linux.c:1126:20: error: incompatible types when assigning to type ‘int’ from type ‘kuid_t’
pOSFSInfo->fsuid = current_fsuid();
^
/home/username/wifidriver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/rt_linux.c:1127:20: error: incompatible types when assigning to type ‘int’ from type ‘kgid_t’
pOSFSInfo->fsgid = current_fsgid();
^
scripts/Makefile.build:257: recipe for target '/home/username/wifidriver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/rt_linux.o' failed
make[2]: *** [/home/username/wifidriver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/rt_linux.o] Error 1
Makefile:1345: recipe for target '_module_/home/username/wifidriver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux' failed
make[1]: *** [_module_/home/username/wifidriver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-3.16.0-24-generic'
Makefile:356: recipe for target 'LINUX' failed
make: *** [LINUX] Error 2
相关输出来自lsusb
Bus 001 Device 002: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
我该如何处理这个问题?这个编译器错误看起来很奇怪,让我怀疑我是否应该深入研究它;也就是说,我的时间是否可以花在其他更好的地方。
答案1
对于任何试图解决相同问题的人而言,正确的答案是忽略供应商提供的设备驱动程序,而使用预编译的 Debianrt2800usb
驱动程序 - 仅此而已apt-get install firmware-ralink; sudo modprobe rt2800usb;
。显然,自 Ubuntu 12 以来,Ralink 的驱动程序就需要修补才能进行编译。
@ Michael Kjörling 感谢您的澄清。我的确打算将错误输出代码仅用于强调最简单和最佳的解决方案是开始破解驱动程序代码的可能性。无论如何,我都没有足够的时间或 C 语言技能来深入研究硬件驱动程序。要知道要使用计算 SE 并不容易 - 在 Linux 下构建时通过编译器错误识别设备驱动程序错误可能是这三种情况中的任何一种。