移植RTL8188CU

两盒软妹~` 提交于 2020-03-15 15:53:35

linux-3.2.35中包含RTL8188CU(pid=8176)的驱动,但不能正常工作,扫描时总是说设备忙

【1】从官网下载linux驱动和工具包。

http://www.realtek.com/downloads/downloadsView.aspx?Langid=3&PNid=21&PFid=48&Level=5&Conn=4&DownTypeID=3&GetDown=false&Downloads=true

下载到的文件为

RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911.zip

压缩包顶层目录:

android_ref_codes_JB_4.1             install.sh
android_ref_codes_JB_4.2             readme.txt
android_reference_codes              ReleaseNotes.pdf
android_reference_codes_ICS_nl80211  WiFi_Direct_User_Interface
document                             wireless_tools
driver                               wpa_supplicant_hostapd
hardware_wps_pbc

【2】编译驱动

linux驱动可以放在内核外编译,也可以加入内核树。前一种方式需修改文件夹中交叉编译器和源码树路径等的定义。这里使用后一种方式。

【2.1】解压driver/rtl8188C_8192C_usb_linux_v4.0.2_9000.20130911.tar.gz,并将解压得到的文件夹改名为rtl8188cu,目录结构:

clean  hal          include  Makefile  runwpa
core   ifcfg-wlan0  Kconfig  os_dep    wlan0dhcp

【2.2】将rtl8188cu移动/拷贝到内核树drivers/net/wireless中。

【2.3】修改drivers/net/wireless/Makefile

注释掉 obj-$(CONFIG_RTLWIFI)        += rtlwifi/

新加 obj-$(CONFIG_RTLWIFI)        += rtl8188cu/

【2.4】修改drivers/net/wireless/Kconfig

注释掉 source "drivers/net/wireless/rtlwifi/Kconfig"

新加 source "drivers/net/wireless/rtl8188cu/Kconfig"

【2.5】cd到内核源码树根目录,make menuconfig

Networking support  --->Wireless  --->cfg80211 - wireless configuration API

Networking support  --->Wireless  --->Generic IEEE 802.11 Networking Stack (mac80211)

Device Drivers  ---> Network device support  ---> Wireless LAN  --->Realtek 8192C USB WiFi

【2.6】编译内核源码树,并烧写到设备上

make

dnw arch/arm/boot/zImage

【3】hostapd

rtl8188cu驱动的AP部分使用了非标准接口,需使用工具包中提供的hostapd

wpa_supplicant_hostapd目录结构:

p2p_hostapd.conf     wpa_supplicant_8_jb_4.1_rtw_r7473.20130517.tar.gz
rtl_hostapd_2G.conf  wpa_supplicant_8_jb_4.2_rtw_r8680.20130821.tar.gz
rtl_hostapd_5G.conf  wpa_supplicant_hostapd-0.8_rtw_r7475.20130812.tar.gz
wpa_0_8.conf        

【3.1】解压wpa_supplicant_hostapd-0.8_rtw_r7475.20130812.tar.gz得到如下内容的目录

COPYING  hostapd  README  src  wpa_supplicant

cd hostapd

CC=arm-linux-gcc make

拷贝生成的hostapd和hostapd_cli文件到设备中(这里使用/usr/local/bin/,并重命名为hostapd_rtl和hostapd_cli_rtl)

【3.2】设备中创建/etc/hostapd.conf文件,内容:

interface=wlan0
driver=rtl871xdrv
ssid=rtl8188cu_ap
channel=6
hw_mode=g
ignore_broadcast_ssid=0
auth_algs=3
macaddr_acl=0
wpa=2
wpa_passphrase=11112222
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
ieee80211n=1
wpa_group_rekey=86400

【3.3】启动hostapd:

hostapd_rtl /etc/hostapd.conf

【4】dhcp服务器

这里使用busybox中的udhcpd。

【4.1】设置网卡的ip

ifconfig wlan0 192.168.3.1

【4.2】创建/etc/udhcpd.conf,内容

interface      wlan0
start 192.168.3.2
end 192.168.3.254
opt dns 192.168.3.1
option subnet 255.255.255.0
opt router 192.168.3.1
【4.3】启动服务器

udhcpd /etc/udhcpd.conf

【5】wpa_supplicant

可以使用标准的wpa_supplicant,也可以使用工具包中提供的。

【5.1】编译工具包中的程序

cd wpa_supplicant

CC=arm-linux-gcc make

将生成的wpa_passphrase,wpa_supplicant,wpa_cli拷贝到设备中(这里使用/usr/local/bin,并添加_rtl后缀)

【5.2】生成加密密钥

wpa_passphrase ssid password > /etc/wpa_supplicant.conf

【5.3】链接路由器

wpa_supplicant -Dwext -iwlan0 -c /etc/wpa_supplicant.conf

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!