Chinaunix首页 | 论坛 | 博客
  • 博客访问: 287472
  • 博文数量: 59
  • 博客积分: 1346
  • 博客等级: 中尉
  • 技术积分: 461
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-06 17:17
文章分类

全部博文(59)

文章存档

2012年(9)

2011年(50)

分类: LINUX

2012-06-14 10:17:25

参考博客

http://blog.csdn.net/zhuqing_739/article/details/6259686

http://linfengdu.blog.163.com/blog/static/11771073201102093848182/

http://blog.csdn.net/zxy_cs/article/details/7107050

http://oddy.blog.hexun.com/63056709_d.html

首先是驱动的编译,从网上下了好多RT3070的驱动,都没交叉编译过去,只有2009_1106_RT3070_Linux_STA_V2.1.1.0.bz2这一版本的编译过去了,呵呵!

交叉编译过程:

1.tar -jxvf 2009_1106_RT3070_Linux_STA_V2.1.1.0.bz2

2. cd 2009_1106_RT3070_Linux_STA_V2.1.1.0

3.vi makefile

  1. #PLATFORM: Target platform  
  2. #PLATFORM = PC   
  3. PLATFORM = 5VT  
  4. #PLATFORM = IKANOS_V160  
  5. #PLATFORM = IKANOS_V180  
  6. #PLATFORM = SIGMA  
  7. #PLATFORM = SIGMA_8622  
  8. #PLATFORM = INIC  
  9. #PLATFORM = STAR  
  10. #PLATFORM = IXP  
  11. #PLATFORM = INF_TWINPASS  
  12. #PLATFORM = INF_DANUBE  
  13. #PLATFORM = BRCM_6358  
  14. #PLATFORM = INF_AMAZON_SE  
  15. #PLATFORM = CAVM_OCTEON  
  16. #PLATFORM = CMPC  
  17. #PLATFORM = RALINK_2880  
#PLATFORM: Target platform #PLATFORM = PC PLATFORM = 5VT #PLATFORM = IKANOS_V160 #PLATFORM = IKANOS_V180 #PLATFORM = SIGMA #PLATFORM = SIGMA_8622 #PLATFORM = INIC #PLATFORM = STAR #PLATFORM = IXP #PLATFORM = INF_TWINPASS #PLATFORM = INF_DANUBE #PLATFORM = BRCM_6358 #PLATFORM = INF_AMAZON_SE #PLATFORM = CAVM_OCTEON #PLATFORM = CMPC #PLATFORM = RALINK_2880

 

  1. ifeq ($(PLATFORM),5VT)  
  2. LINUX_SRC = /home/Hi3511_VSSDK_V1.1.2.2/pub/kbuild-FULL_REL  
  3. CROSS_COMPILE = arm-hismall-linux-  
  4. endif  
ifeq ($(PLATFORM),5VT) LINUX_SRC = /home/Hi3511_VSSDK_V1.1.2.2/pub/kbuild-FULL_REL CROSS_COMPILE = arm-hismall-linux- endif

4.cd os/linux

5.vi config.mk

  1. #ifdef WPA_SUPPLICANT_SUPPORT  
  2. # Support Wpa_Supplicant   
  3. HAS_WPA_SUPPLICANT=y  
  4. #endif // WPA_SUPPLICANT_SUPPORT //  
  5. #ifdef NATIVE_WPA_SUPPLICANT_SUPPORT  
  6. # Support Native WpaSupplicant for Network Maganger   
  7. HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y  
  8. #endif // NATIVE_WPA_SUPPLICANT_SUPPORT //  
#ifdef WPA_SUPPLICANT_SUPPORT # Support Wpa_Supplicant HAS_WPA_SUPPLICANT=y #endif // WPA_SUPPLICANT_SUPPORT // #ifdef NATIVE_WPA_SUPPLICANT_SUPPORT # Support Native WpaSupplicant for Network Maganger HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y #endif // NATIVE_WPA_SUPPLICANT_SUPPORT //

6.cd ../../common

vi rtusb_io.c:

  1. if (ret < 0) {  
  2.     //DBGPRINT(RT_DEBUG_OFF, ("#/n"));   
  3.                 RTMPusecDelay(5000);  
  4.             }  
if (ret < 0) { //DBGPRINT(RT_DEBUG_OFF, ("#/n")); RTMPusecDelay(5000); }

否则,加载驱动后会一直打印"#",很烦!!!!!

7.cd ../../..

8.make

这时,应该就编译通过了。在2009_1106_RT3070_Linux_STA_V2.1.1.0/os/linux目录下生成了rt3070sta.ko,也就是RT3070的驱动了。

9.把RT2870STA.dat拷贝到/etc/Wireless/RT2870STA目录下

加载驱动过程

insmod rt3070sta.ko

看一下打印消息:

  1. rtusb init --->  
  2.   
  3.   
  4. === pAd = ca901000, size = 465920 ===  
  5.   
  6. <-- RTMPAllocAdapterBlock, Status=0  
  7. usbcore: registered new driver rt2870  
rtusb init ---> === pAd = ca901000, size = 465920 === <-- RTMPAllocAdapterBlock, Status=0 usbcore: registered new driver rt2870

iwconfig看一下

  1. ra0       RT2870 Wireless  ESSID:""  
  2.           Mode:Auto  Frequency=2.412 GHz  
  3.           Link Quality=10/100  Signal level:-256 dBm  Noise level:-143 dBm  
  4.           Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0  
  5.           Tx excessive retries:0  Invalid misc:0   Missed beacon:0  
ra0 RT2870 Wireless ESSID:"" Mode:Auto Frequency=2.412 GHz Link Quality=10/100 Signal level:-256 dBm Noise level:-143 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0

注意wireless_tools之前要移植到开发板上!

接下来就是wpa_supplicant的交叉编译,这个比较麻烦,在这里就不详细说明了,给个网址给大家,我也是参考着做的:

http://blog.csdn.net/farsight2009/archive/2010/06/10/5660878.aspx

不过,我使用的是0.6.10这个版本,其他版本我都没用起来!

由于这个版本比较高,上述网址中的

  1. #cp ../2009_0713_RT73_Linux_STA_Drv1.1.0.3/WPA_Supplicant-0.5.8/driver_ralink.* ./  
  2.         #cp ../2009_0713_RT73_Linux_STA_Drv1.1.0.3/WPA_Supplicant-0.5.8/driver.h ./  
  3.         #cp ../2009_0713_RT73_Linux_STA_Drv1.1.0.3/WPA_Supplicant-0.5.8/events.c ./  
  4.         #cp ../2009_0713_RT73_Linux_STA_Drv1.1.0.3/WPA_Supplicant-0.5.8/wpa_supplicant.c ./  
  5.         #cp ../2009_0713_RT73_Linux_STA_Drv1.1.0.3/WPA_Supplicant-0.5.8/wpa_supplicant_i.h ./  
  6.         #cp ../2009_0713_RT73_Linux_STA_Drv1.1.0.3/WPA_Supplicant-0.5.8/defconfig ./  
  7.         #cp ../2009_0713_RT73_Linux_STA_Drv1.1.0.3/WPA_Supplicant-0.5.8/drivers.c ./  
  8.         #cp ../2009_0713_RT73_Linux_STA_Drv1.1.0.3/WPA_Supplicant-0.5.8/Makefile ./   
  9.   
  10.   
  11. 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/farsight2009/archive/2010/06/10/5660878.aspx  
#cp ../2009_0713_RT73_Linux_STA_Drv1.1.0.3/WPA_Supplicant-0.5.8/driver_ralink.* ./ #cp ../2009_0713_RT73_Linux_STA_Drv1.1.0.3/WPA_Supplicant-0.5.8/driver.h ./ #cp ../2009_0713_RT73_Linux_STA_Drv1.1.0.3/WPA_Supplicant-0.5.8/events.c ./ #cp ../2009_0713_RT73_Linux_STA_Drv1.1.0.3/WPA_Supplicant-0.5.8/wpa_supplicant.c ./ #cp ../2009_0713_RT73_Linux_STA_Drv1.1.0.3/WPA_Supplicant-0.5.8/wpa_supplicant_i.h ./ #cp ../2009_0713_RT73_Linux_STA_Drv1.1.0.3/WPA_Supplicant-0.5.8/defconfig ./ #cp ../2009_0713_RT73_Linux_STA_Drv1.1.0.3/WPA_Supplicant-0.5.8/drivers.c ./ #cp ../2009_0713_RT73_Linux_STA_Drv1.1.0.3/WPA_Supplicant-0.5.8/Makefile ./ 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/farsight2009/archive/2010/06/10/5660878.aspx

这些部分就可以略去了,不用做了,呵呵!

顺利地话,就可以在wpa_supplicant-0.6.10/wpa_supplicant下生成wpa_supplicant了!接着就是把wpa_supplicant拷贝到开发板中。

关于wpa_supplicant的使用:

1.把wpa_supplicant.conf拷贝到/etc目录下,当然要根据情况修改wpa_supplicant.conf的内容了!

这里我提供一个我修改的模板,屡试不爽!

  1. ctrl_interface=/var/run/wpa_supplicant  
  2. network={  
  3.     ssid="XXXXXX"  
  4.     scan_ssid=1  
  5.     key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE   
  6.     pairwise=TKIP CCMP    
  7.     group=CCMP TKIP WEP104 WEP40      
  8.     psk="XXXXXX"  
  9. }  
ctrl_interface=/var/run/wpa_supplicant network={ ssid="XXXXXX" scan_ssid=1 key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE pairwise=TKIP CCMP group=CCMP TKIP WEP104 WEP40 psk="XXXXXX" }

其中XXXXXX要替换成相应的ssid和密码!无论是什么加密方式和认证类型,都搞定!WEP除外,因为WEP加密比较简单,在后面会提到,呵呵!!!

2.mkdir -p /var/run/wpa_supplicant

3.最后就是用命令

 wpa_supplicant -B -ira0 -c /etc/wpa_supplicant.conf -Dwext

看一下超级终端的打印:

  1. <-- RTMPAllocTxRxRingMemory, Status=0  
  2. -->RTUSBVenderReset  
  3. <--RTUSBVenderReset  
  4. Key1Str is Invalid key length(0) or Type(0)  
  5. Key2Str is Invalid key length(0) or Type(0)  
  6. Key3Str is Invalid key length(0) or Type(0)  
  7. Key4Str is Invalid key length(0) or Type(0)  
  8. 1. Phy Mode = 9  
  9. 2. Phy Mode = 9  
  10. NVM is Efuse and its size =2d[2d0-2fc]  
  11. 3. Phy Mode = 9  
  12. RTMPSetPhyMode: channel is out of range, use first channel=1  
  13. MCS Set = ff 00 00 00 01  
  14. <==== rt28xx_init, Status=0  
  15. 0x1300 = 00064300  
  16. /mnt $ ===>rt_ioctl_giwscan. 4(4) BSS returned, data->length = 447  
  17. ==>rt_ioctl_siwfreq::SIOCSIWFREQ[cmd=0x8b04] (Channel=1)  
<-- RTMPAllocTxRxRingMemory, Status=0 -->RTUSBVenderReset <--RTUSBVenderReset Key1Str is Invalid key length(0) or Type(0) Key2Str is Invalid key length(0) or Type(0) Key3Str is Invalid key length(0) or Type(0) Key4Str is Invalid key length(0) or Type(0) 1. Phy Mode = 9 2. Phy Mode = 9 NVM is Efuse and its size =2d[2d0-2fc] 3. Phy Mode = 9 RTMPSetPhyMode: channel is out of range, use first channel=1 MCS Set = ff 00 00 00 01 <==== rt28xx_init, Status=0 0x1300 = 00064300 /mnt $ ===>rt_ioctl_giwscan. 4(4) BSS returned, data->length = 447 ==>rt_ioctl_siwfreq::SIOCSIWFREQ[cmd=0x8b04] (Channel=1)

 

这过程可能要花费几秒钟!

接着ifconfig一下它的ip,ping一下无线路由器,应该能ping通的。

当然,这些都是让RT3070工作在managed模式下的,工作在ad-hoc模式下的配置跟简单,不需要使用wpa_supplicant!

可以参考里面的iwpriv_usage.txt进行配置,我配置了一下,发现其中有几种情况配置不成功,这里我把配置成功的罗列下来:

  1. ===========================================================================  
  2. Config STA to link with AP which is SHARED/WEP(Authentication/Encryption)  
  3.     1. iwpriv ra0 set NetworkType=Infra  
  4.     2. iwpriv ra0 set AuthMode=SHARED  
  5.     3. iwpriv ra0 set EncrypType=WEP  
  6.     4. iwpriv ra0 set DefaultKeyID=1  
  7.     5. iwpriv ra0 set Key1="AP's wep key"  
  8.     6. iwpriv ra0 set SSID="AP's SSID"  
  9. ===========================================================================  
  10. Config STA to link with AP which is OPEN/WEP(Authentication/Encryption)  
  11.     1. iwpriv ra0 set NetworkType=Infra  
  12.     2. iwpriv ra0 set AuthMode=OPEN  
  13.     3. iwpriv ra0 set EncrypType=WEP  
  14.     4. iwpriv ra0 set DefaultKeyID=1  
  15.     5. iwpriv ra0 set Key1="AP's wep key"  
  16.     6. iwpriv ra0 set SSID="AP's SSID"  
  17. ===========================================================================  
  18. Config STA to link with AP which is OPEN or SHARED/WEP(Authentication/Encryption)  
  19.     1. iwpriv ra0 set NetworkType=Infra  
  20.     2. iwpriv ra0 set AuthMode=WEPAUTO  
  21.     3. iwpriv ra0 set EncrypType=WEP  
  22.     4. iwpriv ra0 set DefaultKeyID=1  
  23.     5. iwpriv ra0 set Key1="AP's wep key"  
  24.     6. iwpriv ra0 set SSID="AP's SSID"  
  25. ===========================================================================  
  26. Config STA to create/link as adhoc mode, which is OPEN/NONE(Authentication/Encryption)  
  27.     1. iwpriv ra0 set NetworkType=Adhoc  
  28.     2. iwpriv ra0 set AuthMode=OPEN  
  29.     3. iwpriv ra0 set EncrypType=NONE  
  30.     4. iwpriv ra0 set SSID="Adhoc's SSID"  
  31. ===========================================================================  
  32. Config STA to create/link as adhoc mode, which is OPEN/WEP(Authentication/Encryption)  
  33.     1. iwpriv ra0 set NetworkType=Adhoc  
  34.     2. iwpriv ra0 set AuthMode=OPEN  
  35.     3. iwpriv ra0 set EncrypType=WEP  
  36.     4. iwpriv ra0 set DefaultKeyID=1  
  37.     5. iwpriv ra0 set Key1="AP's wep key"  
  38.     6. iwpriv ra0 set SSID="Adhoc's SSID"  
  39. ===========================================================================  
  40. Config STA to create/link as adhoc mode, which is SHARED/WEP(Authentication/Encryption)  
  41.     1. iwpriv ra0 set NetworkType=Adhoc  
  42.     2. iwpriv ra0 set AuthMode=SHARED  
  43.     3. iwpriv ra0 set EncrypType=WEP  
  44.     4. iwpriv ra0 set DefaultKeyID=1  
  45.     5. iwpriv ra0 set Key1="AP's wep key"  
  46.     6. iwpriv ra0 set SSID="Adhoc's SSID"  
  47. ===========================================================================  
  48. Config STA to create/link as adhoc mode, which is OPEN or SHARED/WEP(Authentication/Encryption)  
  49.     1. iwpriv ra0 set NetworkType=Adhoc  
  50.     2. iwpriv ra0 set AuthMode=WEPAUTO  
  51.     3. iwpriv ra0 set EncrypType=WEP  
  52.     4. iwpriv ra0 set DefaultKeyID=1  
  53.     5. iwpriv ra0 set Key1="AP's wep key"  
  54.     6. iwpriv ra0 set SSID="Adhoc's SSID"  
=========================================================================== Config STA to link with AP which is SHARED/WEP(Authentication/Encryption) 1. iwpriv ra0 set NetworkType=Infra 2. iwpriv ra0 set AuthMode=SHARED 3. iwpriv ra0 set EncrypType=WEP 4. iwpriv ra0 set DefaultKeyID=1 5. iwpriv ra0 set Key1="AP's wep key" 6. iwpriv ra0 set SSID="AP's SSID" =========================================================================== Config STA to link with AP which is OPEN/WEP(Authentication/Encryption) 1. iwpriv ra0 set NetworkType=Infra 2. iwpriv ra0 set AuthMode=OPEN 3. iwpriv ra0 set EncrypType=WEP 4. iwpriv ra0 set DefaultKeyID=1 5. iwpriv ra0 set Key1="AP's wep key" 6. iwpriv ra0 set SSID="AP's SSID" =========================================================================== Config STA to link with AP which is OPEN or SHARED/WEP(Authentication/Encryption) 1. iwpriv ra0 set NetworkType=Infra 2. iwpriv ra0 set AuthMode=WEPAUTO 3. iwpriv ra0 set EncrypType=WEP 4. iwpriv ra0 set DefaultKeyID=1 5. iwpriv ra0 set Key1="AP's wep key" 6. iwpriv ra0 set SSID="AP's SSID" =========================================================================== Config STA to create/link as adhoc mode, which is OPEN/NONE(Authentication/Encryption) 1. iwpriv ra0 set NetworkType=Adhoc 2. iwpriv ra0 set AuthMode=OPEN 3. iwpriv ra0 set EncrypType=NONE 4. iwpriv ra0 set SSID="Adhoc's SSID" =========================================================================== Config STA to create/link as adhoc mode, which is OPEN/WEP(Authentication/Encryption) 1. iwpriv ra0 set NetworkType=Adhoc 2. iwpriv ra0 set AuthMode=OPEN 3. iwpriv ra0 set EncrypType=WEP 4. iwpriv ra0 set DefaultKeyID=1 5. iwpriv ra0 set Key1="AP's wep key" 6. iwpriv ra0 set SSID="Adhoc's SSID" =========================================================================== Config STA to create/link as adhoc mode, which is SHARED/WEP(Authentication/Encryption) 1. iwpriv ra0 set NetworkType=Adhoc 2. iwpriv ra0 set AuthMode=SHARED 3. iwpriv ra0 set EncrypType=WEP 4. iwpriv ra0 set DefaultKeyID=1 5. iwpriv ra0 set Key1="AP's wep key" 6. iwpriv ra0 set SSID="Adhoc's SSID" =========================================================================== Config STA to create/link as adhoc mode, which is OPEN or SHARED/WEP(Authentication/Encryption) 1. iwpriv ra0 set NetworkType=Adhoc 2. iwpriv ra0 set AuthMode=WEPAUTO 3. iwpriv ra0 set EncrypType=WEP 4. iwpriv ra0 set DefaultKeyID=1 5. iwpriv ra0 set Key1="AP's wep key" 6. iwpriv ra0 set SSID="Adhoc's SSID"
阅读(2881) | 评论(0) | 转发(0) |
0

上一篇:malloc

下一篇:嵌入式wpa_supplicant的移植 .

给主人留下些什么吧!~~