交叉编译和安装ARM板(RK3288)和Linux 3.10上的RTL8188无线网卡驱动
插入无线网卡,输入ifconfig,发现没有检测到网卡。
输入lsusb,查看无线网卡型号。
我用的无线网卡是EDUP的网卡,包装盒里有一张驱动光盘,把光盘里linux下的驱动目录复制下来。如果没有驱动光盘,可以去网上下载RTL8188的Linux版驱动包。
提前准备好ARM板系统的交叉编译器和系统源码,如这里的RK3288的Ubuntu系统的源码位于~/proj/firefly-rk3288,交叉编译器目录为/usr/bin/arm-linux-gnueabihf-gcc。
打开驱动目录下的linux/rtl8188.../Makefile文件。(可能需要解压linux目录下的压缩包)
修改大约30行的CONFIG_POWER_SAVING = n,修改下面的CONFIG_PLATFORM_I386_PC = n,在下面选择合适的平台,如这里用的是RK3288,选择CONFIG_PLATFORM_ARM_RK2818 = y。
CONFIG_MP_INCLUDED = n CONFIG_POWER_SAVING = n CONFIG_USB_AUTOSUSPEND = n CONFIG_HW_PWRP_DETECTION = n CONFIG_WIFI_TEST = n CONFIG_BT_COEXISTENCE = n CONFIG_RTL8192CU_REDEFINE_1X1 = n CONFIG_INTEL_WIDI = n CONFIG_WAKE_ON_WLAN = n CONFIG_PLATFORM_I386_PC = n CONFIG_PLATFORM_TI_AM3517 = n CONFIG_PLATFORM_ANDROID_X86 = n CONFIG_PLATFORM_JB_X86 = n CONFIG_PLATFORM_ARM_S3C2K4 = n CONFIG_PLATFORM_ARM_PXA2XX = n CONFIG_PLATFORM_ARM_S3C6K4 = n CONFIG_PLATFORM_MIPS_RMI = n CONFIG_PLATFORM_RTD2880B = n CONFIG_PLATFORM_MIPS_AR9132 = n CONFIG_PLATFORM_RTK_DMP = n CONFIG_PLATFORM_MIPS_PLM = n CONFIG_PLATFORM_MSTAR389 = n CONFIG_PLATFORM_MT53XX = n CONFIG_PLATFORM_ARM_MX51_241H = n CONFIG_PLATFORM_FS_MX61 = n CONFIG_PLATFORM_ACTIONS_ATJ227X = n CONFIG_PLATFORM_TEGRA3_CARDHU = n CONFIG_PLATFORM_TEGRA4_DALMORE = n CONFIG_PLATFORM_ARM_TCC8900 = n CONFIG_PLATFORM_ARM_TCC8920 = n CONFIG_PLATFORM_ARM_TCC8920_JB42 = n CONFIG_PLATFORM_ARM_RK2818 = y CONFIG_PLATFORM_ARM_TI_PANDA = n CONFIG_PLATFORM_MIPS_JZ4760 = n CONFIG_PLATFORM_DMP_PHILIPS = n CONFIG_PLATFORM_TI_DM365 = n CONFIG_PLATFORM_MN10300 = n CONFIG_PLATFORM_MSTAR_TITANIA12 = n CONFIG_PLATFORM_MSTAR_A3 = n CONFIG_PLATFORM_ARM_SUNxI = n CONFIG_PLATFORM_ARM_SUN6I = n
找到下面的ifeq ($(CONFIG_PLATFORM_ARM_RK2818), y)部分,修改为:
ifeq ($(CONFIG_PLATFORM_ARM_RK2818), y) EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_ROCKCHIPS -DCONFIG_MINIMAL_MEMORY_USAGE ARCH := arm CROSS_COMPILE := /usr/bin/arm-linux-gnueabihf- KSRC := /home/XXX/proj/firefly-rk3288/kernel MODULE_NAME := wlanrtl8188 endif
然后在该目录下执行make,出错:
os_dep/linux/os_intfs.c:320:3: error: implicit declaration of function ‘create_proc_entry’
原因:Linux 3.10版本中已经去除了create_proc_entry函数。
解决方法:下载另一个文件:wget https://raw.github.com/raspberrypi/linux/rpi-3.10.y/drivers/net/wireless/rtl8192cu/os_dep/linux/os_intfs.c,将下载到的文件覆盖原来的os_dep/linux/os_intfs.c。
如果出现错误:os_dep/linux/rtw_android.c: error: implicit declaration of function ‘strnicmp’ [Werror=implicitfunctiondeclaration]
打开os_dep/linux/rtw_android.c文件,在const char *android_wifi_cmd_str[ANDROID_WIFI_CMD_MAX]函数前添加以下内容:
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) #define strnicmp strncasecmp #endif
再次make,编译完成后可以得到wlanrtl8188.ko文件。
将wlanrtl8188.ko文件复制到开发板/home/firefly目录下,执行sudo depmod -n /home/firefly/wlanrtl8188.ko,然后执行insmod /home/firefly/wlanrtl8188.ko,即可使用无线网卡。
如果需要以后开机后也能使用无线网卡,编辑/etc/rc.local文件,加入/sbin/insmod /home/firefly/wlanrtl8188.ko即可。