说明
出于学习的目的,需要在hi3518ev200平台上接入RTL8192无线网卡传输数据。本文记录自己对编译操作的步骤,以期望帮助到其它的初学者。
RTL8192介绍
嵌入式应用中可供选择的WIFI网络芯片非常多,RTL系列只是众水中的一支,其它的例如XR819、AP6256.有些还将Wifi和蓝牙做在了一起。RTL系列中常见的型号有RTL8188、RTL8723、RTL8189、RTL8192等等。其中,RTL8192传输速率是300Mbps。
——注意! 本文编译的驱动程序是 RTL8192EU。
——注意!经验证,CUS版本的驱动不能支持EU网卡,如果使用CUS版本驱动EU硬件,将无法显示wlan0。
驱动程序编译
0.准备操作
在开始之前,你需要做出以下准备:
(1)已经建立了hi3518的交叉编译环境。这一步骤可以参考我做的记录博文,详见【参考】部分第1项。
(2)已经准备好了一份linux内核源码,或者linux下编译需要使用的资源文件。linux源码的获取可以在其官方网站上得到,下载地址详见【参考】部分的第2项。但是下载的源码必须包含__gnu_mcount_nc补丁! 海思的Kernel-linux-3.4.y(35)中已经有了这个补丁。
否则驱动正常编译,但是加载时会出现如下错误:
(3)已经准备好了官方的RTL8192EU驱动程序源码,我们需要交叉编译得到在嵌入式Linux上运行的ko模块文件,驱动程序源码可从本文末的【原始驱动程序下载】部分得到。
1.Makefile文件的修改
在编译之前请确保已经安装make工具,众所周知对Makefile文件的配置是编译顺利的前提。
打开解压后文件夹根目录下的顶层Makefile文件,首先配置平台,因为我们要在hi3518的平台上运行驱动,所以需要新增一个平台配置做适配。将新增的配置项 CONFIG_PLATFORM_ARM_HI3518E 设置为 y,而原程序初始的 CONFIG_PLATFORM_I386_PC设置为 n。
而后查找上一项 CONFIG_PLATFORM_ARM_SPREADTRUM_8810 的配置实例,在其后增加一份新的配置实例如下:
ifeq ($(CONFIG_PLATFORM_ARM_HI3518), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
ARCH := arm
CROSS_COMPILE := arm-hisiv300-linux-
KVER := 3.4.35
KSRC := /home/wind/Downloads/linux-3.4.y
MODULE_NAME := RTL8192EU_hi3518
endif
其中,
ARCH为架构选择;
CROSS_COMPILE为交叉编译器前缀;
KSRC目录为目标linux内核的地址;
KVER是目标内核的版本;
MODULE_NAME是结果文件名,这些需要根据实际需要更改。
——注意! 根据文末【参考】部分第3项中所写的内容,为防万一,Makefile文件起始部分的 CONFIG_POWER_SAVING 项设置为 n。
如果你没有在Makefile设置EXTRA_CFLAGS,那么可以打开 ./include/rtw_byteorder.h 文件,在开头处新增一个 CONFIG_LITTLE_ENDIAN宏定义,在该文件中需要指定使用大端模式还是小端模式,在hi3518中使用的是小端模式。
3.开始编译
使用Terminal进入驱动程序目录,输入 make编译,稍等几十秒,编译完成后将在当前目录下生成ko模块文件。
使用file命令查看目标文件是否适配平台。
*注意事项
如果需要在Windows和虚拟机之间传输文件(夹),可以使用SCP工具,可以参考我做的记录博文,详见【参考】部分第4项。
编译过程输出
wind@WKC:~/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505$ make
make ARCH=arm CROSS_COMPILE=arm-hisiv300-linux- -C /home/wind/Downloads/linux-3.4.y M=/home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505 modules
make[1]: Entering directory '/home/wind/Downloads/linux-3.4.y'
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_cmd.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_security.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_debug.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_io.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_ioctl_query.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_ioctl_set.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_ieee80211.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_mlme.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_mlme_ext.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_wlan_util.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_vht.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_pwrctrl.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_rf.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_recv.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_sta_mgt.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_ap.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_xmit.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_p2p.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_tdls.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_br_ext.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_iol.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_sreset.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_btcoex.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_beamforming.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_odm.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/efuse/rtw_efuse.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/os_dep/osdep_service.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/os_dep/linux/os_intfs.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/os_dep/linux/usb_intf.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/os_dep/linux/usb_ops_linux.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/os_dep/linux/ioctl_linux.o
/home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/os_dep/linux/ioctl_linux.c: In function ‘translate_scan’:
/home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/os_dep/linux/ioctl_linux.c:771:1: warning: the frame size of 1152 bytes is larger than 1024 bytes [-Wframe-larger-than=]
}
^
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/os_dep/linux/xmit_linux.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/os_dep/linux/mlme_linux.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/os_dep/linux/recv_linux.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/os_dep/linux/ioctl_cfg80211.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/os_dep/linux/wifi_regd.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/os_dep/linux/rtw_android.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/os_dep/linux/rtw_proc.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/hal_intf.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/hal_com.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/hal_com_phycfg.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/hal_phy.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/hal_btcoex.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/hal_hci/hal_usb.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/led/hal_usb_led.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/HalPwrSeqCmd.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/rtl8192e/Hal8192EPwrSeq.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/rtl8192e/rtl8192e_xmit.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/rtl8192e/rtl8192e_sreset.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/rtl8192e/rtl8192e_hal_init.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/rtl8192e/rtl8192e_phycfg.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/rtl8192e/rtl8192e_rf6052.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/rtl8192e/rtl8192e_dm.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/rtl8192e/rtl8192e_rxdesc.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/rtl8192e/rtl8192e_cmd.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/rtl8192e/usb/usb_halinit.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/rtl8192e/usb/rtl8192eu_led.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/rtl8192e/usb/rtl8192eu_xmit.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/rtl8192e/usb/rtl8192eu_recv.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/rtl8192e/usb/usb_ops_linux.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/rtl8192e/rtl8192e_mp.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/OUTSRC/odm_debug.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/OUTSRC/odm_AntDiv.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/OUTSRC/odm_interface.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/OUTSRC/odm_HWConfig.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/OUTSRC/odm.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/OUTSRC/HalPhyRf.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/OUTSRC/rtl8192e/HalHWImg8192E_MAC.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/OUTSRC/rtl8192e/HalHWImg8192E_BB.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/OUTSRC/rtl8192e/HalHWImg8192E_RF.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/OUTSRC/rtl8192e/HalHWImg8192E_FW.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/OUTSRC/rtl8192e/HalPhyRf_8192e.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/OUTSRC/rtl8192e/odm_RegConfig8192E.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/hal/OUTSRC/rtl8192e/odm_RTL8192E.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/platform/platform_ops.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_mp.o
CC [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/core/rtw_mp_ioctl.o
LD [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/RTL8192EU_hi3518.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/RTL8192EU_hi3518.mod.o
LD [M] /home/wind/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505/RTL8192EU_hi3518.ko
make[1]: Leaving directory '/home/wind/Downloads/linux-3.4.y'
wind@WKC:~/Downloads/rtl8192EU_linux_v4.3.1.1_11320.20140505$
原始驱动程序下载
百度网盘链接:https://pan.baidu.com/s/1JGiPffeTAS554j83fTgAAw
提取码:19xg
参考
1.【燕卫博】从零开始进行Hi3518_SDK安装、环境搭建和Linux内核编译,并生成可供烧写的uImage
2.Linux内核源码下载地址
3.关于在2440上移植rtl8192和rtl8188cus linux驱动遇到的问题及解决方法!!!
4.【燕卫博】使用SCP工具和SSH实现主机与Hyper-V虚拟机之间的文件传输
————2019-11-24 @燕卫博————