linux rtl8189fs WiFi驱动移植
wifi驱动移植解压厂家给的驱动源码,进入到解压目录,修改Makefile修改Makefile先将平台支持修改为你自己用的平台,我是在rk1808上进行移植的,所以添加如下:###################### Platform Related #######################CONFIG_PLATFORM_I386_PC = nCONFIG_PLATFORM_ANDROID
wifi驱动移植
解压厂家给的驱动源码,进入到解压目录,修改Makefile
修改Makefile
先将平台支持修改为你自己用的平台,我是在rk1808上进行移植的,所以添加如下:
###################### Platform Related #######################
CONFIG_PLATFORM_I386_PC = n
CONFIG_PLATFORM_ANDROID_X86 = n
CONFIG_PLATFORM_ANDROID_INTEL_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_TCC8930_JB42 = n
CONFIG_PLATFORM_ARM_RK2818 = n
CONFIG_PLATFORM_ARM_RK3066 = n
CONFIG_PLATFORM_ARM_RK3188 = n
CONFIG_PLATFORM_ARM_RK1808 = y//自己的平台设置为y,其他为n
在Makefile里找到下面的位置:
ifeq ($(CONFIG_PLATFORM_ARM_RK3188), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_ROCKCHIPS
# default setting for Android 4.1, 4.2, 4.3, 4.4
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
# default setting for Power control
EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC
#EXTRA_CFLAGS += -DRTW_SUPPORT_PLATFORM_SHUTDOWN
# default setting for Special function
ARCH := arm
CROSS_COMPILE := /home/android_sdk/Rockchip/Rk3188/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
KSRC := /home/android_sdk/Rockchip/Rk3188/kernel
MODULE_NAME := wlan
endif
//以下为自己添加,直接复制上面,修改即可
ifeq ($(CONFIG_PLATFORM_ARM_RK1808), y)**改为自己的平台,我的是rk1808**
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_ROCKCHIPS
# default setting for Android 4.1, 4.2, 4.3, 4.4
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
# default setting for Power control
EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC
#EXTRA_CFLAGS += -DRTW_SUPPORT_PLATFORM_SHUTDOWN
# default setting for Special function
ARCH := arm64**架构体系**
CROSS_COMPILE := /media/gree/47037fce-de1d-40bd-8cd8-922f0e1edc8e/rk_docs/rk1808-sdk/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-**交叉编译器,建议是绝对路径**
KSRC := /media/gree/47037fce-de1d-40bd-8cd8-922f0e1edc8e/rk_docs/rk1808-sdk/kernel**内核源码路径**
MODULE_NAME := wlan**节点名称**
endif
内核配置
在内核路径下,执行make menuconfig
命令,通过图形化界面进行如下配置:
Device Drivers --->
[*] Network device support --->
[*] Wireless LAN --->
<*> IEEE 802.11 for Host AP (Prism2/2.5/3 and WEP/TKIP/CCMP)
[*] Support downloading firmware images with Host AP driver
[*] Support for non-volatile firmware download
[*] Rockchip Wireless LAN support --->//rk平台支持的WiFi模组,其他平台可以自己修改Kconfig文件,将相应模组进入到内核支持
[*] Wifi load driver when kernel bootup
<*> Realtek 8189F SDIO Wifi
内核配置基本这么多,重新编译内核,更新内核.
执行ifconfig查看是否有wlan节点,有wlan说明驱动加载成功了,如果没有自己检查下gpio是否正确。
调试
1、查看wifi的服务进程是否启动,ps查看是否有wpa_supplicant进程,如果没有,手动启动:wpa_supplicant -B -i wlan0 -c /data/cfg/wpa_supplicant.conf
2、扫描周边ap,成功会打印OK,如果有错那就是驱动问题,根据log自行查看解决
wpa_cli -i wlan0 -p /var/run/wpa_supplicant scan
查看扫描结果wpa_cli -i wlan0 -p /var/run/wpa_supplicant scan_results
有如下信息,说明WiFi正常工作
bssid / frequency / signal level / flags / ssid
88:10:8f:43:9f:c2 2412 -38 [WPA2-PSK-CCMP][ESS] HUAWEI
1c:15:1f:2d:40:54 2462 -38 [WPA-PSK-CCMP][WPA2-PSK-CCMP][WPS][ESS]4
9c:a5:25:8b:d7:0f 2422 -58 [WPA2-PSK-CCMP+TKIP][ESS] USR-G800
d0:d7:83:73:fc:c8 2417 -62 [WPA-PSK-CCMP][WPA2-PSK-CCMP][WPS][ESS]2
74:05:a5:50:92:e3 2437 -62 [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS] a
04:71:4b:2f:3f:d9 2412 -58 [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP]1
10:44:00:9a:ba:94 2447 -66 [WPA-PSK-CCMP][WPA2-PSK-CCMP][WPS][ESS]6
94:9b:2c:4b:b2:40 2437 -62 [WPA-PSK-TKIP][WPA2-PSK-CCMP+TKIP][ESS]2
b8:50:01:8d:45:00 2462 -64 [WPA2-PSK+FT/PSK-CCMP][ESS] LYKJ-2
04:71:4b:2f:3f:d8 2412 -64 [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP]i
b8:50:01:8d:45:01 2462 -66 [WPA2-PSK+FT/PSK-CCMP][ESS] LYKJ-6F2
b8:50:01:8d:45:02 2462 -66 [WPA2-PSK+FT/PSK-CCMP][ESS] LBJ-2
94:9b:2c:4c:33:f0 2437 -66 [WPA-PSK-TKIP][WPA2-PSK-CCMP+TKIP][ESS]2
94:9b:2c:4c:45:00 2437 -68 [WPA-PSK-TKIP][WPA2-PSK-CCMP+TKIP][ESS]2
74:67:f7:83:22:40 2412 -70 [WPA-PSK-TKIP][WPA2-PSK-CCMP+TKIP][ESS]2
64:05:e9:26:ce:08 2437 -76 [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP]i
c8:3a:35:6d:5f:61 2422 -77 [WPA-PSK-CCMP][WPA2-PSK-CCMP][WPS][ESS]5
28:64:b0:51:79:35 2432 -78 [WPA2-PSK-CCMP][WPS][ESS] HUAWEI_G
b8:50:01:8d:1e:b2 2437 -78 [WPA2-PSK+FT/PSK-CCMP][ESS] LBJ-2
b8:50:01:8d:1e:b1 2437 -82 [WPA2-PSK+FT/PSK-CCMP][ESS] LYKJ-6F2
3、连接热点
vi /data/cfg/wpa_supplicant.conf
#添加如下配置
network={
ssid="" //wifi名称
psk="" //wifi密码
key_mgmt=WPA-PSK //填加密方式
#key_mgmt=NONE //如果WiFi不加密
}
保存退出,重新读取配置wpa_cli -i wlan0 -p /var/run/wpa_supplicant reconfigure
发起连接wpa_cli -i wlan0 -p /var/run/wpa_supplicant reconnect
ifconfig发现wlan0分配了IP,尝试ping一下百度:
ping www.baidu.com
PING www.a.shifen.com (163.177.151.110) 56(84) bytes of data.
64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=1 ttl=55 time=61.3 ms
64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=2 ttl=55 time=76.0 ms
64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=3 ttl=55 time=91.4 ms
64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=4 ttl=55 time=37.5 ms
64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=5 ttl=55 time=24.8 ms
可以ping通,驱动移植完成。
总结
经过九九八十一难,终于调通了WiFi,这个过程真的艰辛,踩了很多坑,但是大体的步骤就是这样,遇到问题一定要检查最基本的是否正确。
我刚开始遇到的问题是rtw:error sd_cmd52 read fail,这种问题应该是驱动不匹配,千万别钻牛角尖,一直去解决这个问题,刚开始我是用的rk sdk里面的驱动,我换了模组厂给的驱动,重新编译解决了这个问题,但是遇到了新的问题,不报任何错,但是还是扫描不到周围的ap,经过不懈的努力,找到了解决方法,变异内核后出现了一个警告:
WARNING: modpost: Found 1 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
我就尝试在编译的时候加上了CONFIG_DEBUG_SECTION_MISMATCH=y,说WiFi驱动入口函数少了__init,出口函数少了__exit,我就在相应的地方添加了,重新编译不报错,重新烧录内核,发现可以使用了。
过程之艰难啊,没有大佬指点,只能自己踩坑!!!
更多推荐
所有评论(0)