2012年8月1日 星期三

[ARM] Porting Wi-Fi Dongle

要把linux driver port到ARM板上,除了正確作法之外有的時候還要看Wi-Fi dongle的driver支不支援ARM的環境。前後評估兩款Wi-Fi dongle: 1. RT3070 chipset Comfast Inc., 2. rtl8712u chipset ASUS Inc.。前者經過一個禮拜的調適爬文,最後卡在系統無法啟動Wi-Fi dongle而宣告放棄 (ifconfig ra0 up時,會出現SIOCSIFFLAGS: Operation not permitted錯誤)。後者則很順暢的按照Readme,一步一步照著做,配合相關網路工具花了一天就輕鬆搞定了。

測試環境為:
ARM8, AP連線需WPA加密(#R4), rtl8712u chipset



[ PC部分 ]
# tar xvf rtl8712_8188_8191_8192SU_usb_linux_v2.6.6.0.20110401.tar.gz
# cd rtl8712_8188_8191_8192SU_usb_linux_v2.6.6.0.20110401
# vi Makefile
(modify)
#CONFIG_PLATFORM_I386_PC        =       n #line14, comment
CONFIG_PLATFORM_ARM_S3C         =       y #line16, un-comment
KSRC := /your-project-path/ #line104,modify to toolchain kernel path

# make

(copy 8712u.ko to ARM)



[ ARM部分 ]
add module to OS
# insmod 8712u.ko

(plugin Wi-Fi dongle)

check wlan0 is created after plug-in
# iwconfig

start wlan0 interface
# ifconfig wlan0 up

scan AP (how to Cross-Compile wpa_passphrase @PS1: to build wireless tools)
# iwlist wlan0 scan

create a wpa configuration file (how to Cross-Compile wpa_passphrase @PS2: to build WPA tools)
# wpa_passphrase your-AP-name your-AP-password > wpa2.conf

add wpa encryption, and let it run at background
# wpa_supplicant -Dwext -iwlan0 -c wpa2.conf -B

add access point
# iwconfig wlan0 ap your-AP-MAC

setup a setting file for DHCP (udhcpc)
# cp default.script /usr/share/udhcpc/

get a IP from AP's DHCP
# udhcpc -i wlan0

ping test to AP
# ping 192.168.0.1




[ Q&A and other tools ] 
PS1: build wireless tools
# tar xvf wireless_tools.29.tar.gz
# cd wireless_tools.29
# vi Makefile
CC = arm-linux-gcc
AR = arm-linux-ar
RANLIB = arm-linux-ranlib

# make 
(copy execution file to /sbin,and libiw.so.29 to /lib (ARM))



PS2: build WPA tools
#tar xvfz wpa_supplicant-0.7.2.tar.gz

将wpa_supplicant中的补丁拷贝到openssl中
build openssl lib
# cp wpa_supplicant-0.7.2/patches/openssl-0.9.8e-tls-extensions.patch openssl-0.9.8e/
# cd openssl-0.9.8e
# patch -Np1 -d . < openssl-0.9.8i-tls-extensions.patch 
# mkdir /usr/local/ssl
# vi Makefile
CC= arm-linux-gcc
AR= arm-linux- r $(ARFLAGS) r
RANLIB= arm-linux-ranlib
INSTALLTOP=/usr/local/ssl
OPENSSLDIR=/usr/local/ssl

# make 
# make install
# cp defconfig .config
# vi .config
CC= arm-linux-gcc -L /usr/local/ssl/lib/
CFLAGS += -I/usr/local/ssl/include/
LIBS += -L/usr/local/ssl/lib/

# make
(copy wpa_supplicant, wpa_passphrase to /sbin, and libcrypto.a, libssl.a to /lib (ARM))



PS3: build udhcpc tools (busybox)
reference to #R1

kernel needs to support TCP/IP





[ Reference ]
#R1. 2410开发板上实现DHCP自动获取IP地址(转) 
#R2. 移植wireless tools 到2440
#R3. RT73 wifi无线网卡驱动移植过程
#R4. Linux 無線網路 WEP/WPA 手動設定 全集

2 則留言:

nikeasyanzi 提到...
作者已經移除這則留言。
nikeasyanzi 提到...

Hi Knem

This is a good article. thanks for sharing. would you please provide model name of the WIFI USB stick you used? Thanks!