2012-12-10 15:58:23| 分类: arm9 linux|字号 订阅
主机 ubuntu10.10。编译工具:arm-linux-gcc 4.3.3嵌入式平台s3c2440 内核linux。2.6.37.4。
刚拿到一个水星无线网卡。我的第一反应是拆开看看。瑞昱rtl8188cus的芯片、我看下网卡自带的光盘资料有linux下的驱动。里面一个word文档对我的帮助是很大的。how to support new platform。doc。会教你怎样修改makefile。首先把驱动文件copy到主机。修改makefile。CONFIG_PLATFORM_I386_PC = y
CONFIG_PLATFORM_ANDROID_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_MT53XX = n
CONFIG_PLATFORM_RTK_DMP = n
CONFIG_PLATFORM_ARM_TCC8900 = n
CONFIG_PLATFORM_ARM_MX51_241H = n
CONFIG_PLATFORM_ACTIONS_ATJ227X = n
CONFIG_PLATFORM_TI_DM365 = n
CONFIG_PLATFORM_RK2818 = n
CONFIG_PLATFORM_MIPS_JZ4760 = n。默认的是 i386——pc。根据自己的平台去选择。我的开发板是芯片s3c2440.我只需arm_S3C2K4=y,i386_pc=n;然后是去修改编译工具。内核路径。
ifeq ($(CONFIG_PLATFORM_ARM_S3C2K4), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
ARCH := arm
CROSS_COMPILE := arm-linux-
KVER := 2.6.37.4
KSRC := /home/lilei/linux-2.6.37.4
endif
cross——complize 对应编译工具。kver对应的是内核版本。然后是ksrc是内核路径。这个一定不能搞错。好啦。makefile已经改完啦,是不是很简单啊。修改后make编译


rtw driver version=v2.0.1502.20110402
register rtl8192_netdev_ops to netdev_ops
bLength=7
bDescriptorType=5
bEndpointAddress=81
wMaxPacketSize=40
bInterval=0
bLength=7
bDescriptorType=5
bEndpointAddress=2
wMaxPacketSize=40
bInterval=0
bLength=7
bDescriptorType=5
bEndpointAddress=3
wMaxPacketSize=40
bInterval=0
bLength=7
bDescriptorType=5
bEndpointAddress=84
wMaxPacketSize=40
bInterval=1
nr_endpoint=4, in_num=2, out_num=2
Chip Version ID: VERSION_NORMAL_TSMC_CHIP_88C.
initial psecuritypriv->sw_encrypt:0
EEPROM type is E-FUSE
====> ReadAdapterInfo8192C
Boot from EFUSE, Autoload Success !
rtw_efuse_get_max_phy_size...eeprompriv.efuse_phy_max_size(504)
EEPROMVID = 0x0bda
EEPROMPID = 0x8176
EEPROMCustomerID : 0x00
EEPROMSubCustomerID: 0x00
RT_CustomerID: 0x00
RT_ChannelPlan: (0x02:0x02)
_ReadBoardType(0)
### AntDivCfg(0)
BT Coexistance = disable
_ReadHWPDSelection...bHWPwrPindetect(0)-bHWPowerdown(0) ,bSupportRemoteWakeup(0)
### PS params=> power_mgnt(0),usbss_enable(0) ###
_InitAdapterVariablesByPROM(): REPLACEMENT = 1
<==== ReadAdapterInfo8192C
MAC Address from efuse= 5c:63:bf:2d:f0:ff
usbcore: registered new interface driver rtw_usb_drv。
eth0 Link encap:Ethernet HWaddr 08:09:0A:A0:90:80
inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:62 Base address:0x8000
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
+8192cu_drv - drv_open, bup=0
===> FirmwareDownload91C() fw:Rtl819XFwImageArray_TSMC
fw_ver=v68, fw_subver=1, sig=0x88c0
fw download ok!
Set RF Chip ID to RF_6052 and RF type to 1T1R.
rf_chip=0x4, rf_type=0x3
IQK:Start!!!
Path A IQK Success!!
Path A IQK Success!!
IQK: final_candidate is 0
IQK: RegE94=ff RegE9C=11 RegEA4=fe RegEAC=2 RegEB4=0 RegEBC=0 RegEC4=0 RegECC=0
Path A IQ Calibration Success !
MAC Address from REG = 5c-63-bf-2d-f0-ff
pdmpriv->TxPowerTrackControl = 1
MAC Address = 5c-63-bf-2d-f0-ff
-871x_drv - drv_open, bup=1
[root@XC2440 /]# iwlist wlan0 scanning
survey done event(0x18)
wlan0 Scan completed :
Cell 01 - Address: 54:E6:FC:7E:AB:BC
ESSID:"ZERO_Net"
Protocol:IEEE 802.11bgn
Mode:Master
Frequency:2.427 GHz (Channel 4)
Encryption key:on
Bit Rates:150 Mb/s
Extra:rsn_ie=30140100000fac040100000fac040100000fac020000
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
IE: Unknown: DD0E0050F204104A0001101044000102
Quality=70/100 Signal level=70/100
Cell 02 - Address: 6C:E8:73:B8:61:F0
ESSID:"lilei"
Protocol:IEEE 802.11bg
Mode:Master
Frequency:2.412 GHz (Channel 1)
Encryption key:on
Bit Rates:54 Mb/s
Quality=100/100 Signal level=100/100
下面还需要移植一个工具,wireless_tools.29.tar.gz。这个网上都能下到的,同样修改makefile
## Compiler to use (modify this for cross compile).
CC = arm-linux-gcc
## Other tools you need to modify for cross compile (static lib only).
AR = arm-linux-ar
RANLIB = arm-linux-ranlib
make 编译。会生成iwpriv,iwconfig,iwlist,iwspy,copy这些文件到开发板/sbin 目录下。同时copy同目录下的libiw。so。29到开发板/lib 目录下。下面要开始建立连接。
iwconfig wlan0 key #####
iwconfig wlan0 essid “网络名称”
下面可以通过iwconfig wlan0 看下连接状态
[root@XC2440 /]# iwconfig wlan0
wlan0 IEEE 802.11bg ESSID:"lilei" Nickname:"<WIFI@REALTEK>"
Mode:Managed Frequency:2.412 GHz Access Point: 6C:E8:73:B8:61:F0
Bit Rate:54 Mb/s Sensitivity:45/0
Retry:off RTS thr:off Fragment thr:off
Encryption key:1122-3344-55 Security mode:open
Power Management:off
Link Quality=99/100 Signal level=-45 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0。
好啦。我先把开发板上的那个dm9000 网卡屏蔽掉。ifconfig eth0 down。
然后ping下192.168.1.1.我连的是无线路由器发射的网络。
[root@XC2440 /]# ifconfig eth0 down
[root@XC2440 /]# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: seq=0 ttl=64 time=91.224 ms
64 bytes from 192.168.1.1: seq=1 ttl=64 time=3.603 ms
64 bytes from 192.168.1.1: seq=2 ttl=64 time=4.004 ms
64 bytes from 192.168.1.1: seq=3 ttl=64 time=3.974 ms
64 bytes from 192.168.1.1: seq=4 ttl=64 time=4.063 ms
64 bytes from 192.168.1.1: seq=5 ttl=64 time=4.020 ms
64 bytes from 192.168.1.1: seq=6 ttl=64 time=3.964 ms
64 bytes from 192.168.1.1: seq=7 ttl=64 time=4.205 ms
64 bytes from 192.168.1.1: seq=8 ttl=64 time=4.075 ms
64 bytes from 192.168.1.1: seq=9 ttl=64 time=3.771 ms。ping通啦。已经建立连接。嘻嘻。太激动啦、