Chinaunix首页 | 论坛 | 博客
  • 博客访问: 317665
  • 博文数量: 208
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 286
  • 用 户 组: 普通用户
  • 注册时间: 2014-05-20 11:39
文章分类

全部博文(208)

文章存档

2014年(208)

我的朋友

分类: LINUX

2014-05-20 12:53:22

原文地址:无线网卡移植 作者:transistor0

1、准备好hostap、pcmcia-cs及wireless_tools驱动
hostap驱动可从下载最新版hostap-driver-0.4.9.tar.gz
解压到自己的目录底下tar zxvf hostap-driver-0.4.9.tar.gz
需要把此驱动补丁打进内核里。进入linux内核目录
cd linux-2.6.9
运行补丁命令:
patch -p1 < ../hostap/kernel-patches/hostap-linux-2.6.2.patch
并把hostap驱动源代码(driver/modules/hostap*.[ch]全部拷贝到linux内核的drivers/net/wireless目录下
cp ../hostap/driver/modules/hostap*.[ch] drivers/net/wireless
内核配置如下:
make menuconfig
General setup  --->
PCMCIA/CardBus support  --->
       <*> PCMCIA/CardBus support                                                
          [ ]   Enable PCMCIA debugging                                      
          < >   Databook TCIC host bridge support                            
          <*>   PXA2xx support
Networking support  --->
[*] Network device support
Wireless LAN (non-hamradio)  --->
[*] Wireless LAN drivers (non-hamradio) & Wireless Extensions
 <*>   Host AP support for Prism2/2.5/3 IEEE 802.11b//也可以选择M作为模块的方式编译,此方法需要insmod hostap_cs.o
[ ]     Support downloading firmware images with Host AP driver
 <*>     Host AP driver for Prism2/2.5/3 PC Cards
2、pcmcia-cs驱动可从下载最新的pcmcia-cs-3.2.8.tar.gz
解压:
tar zxvf pcmcia-cs-3.2.8.tar.gz
cd pcmcia-3.2.8
编译pcmcia工具:
[root@localhost pcmcia-cs-3.2.8]./Configure --arch=arm --ucc=arm-linux-gcc --kcc=arm-linux-gcc --ld=arm-linux-ld

   -------- Linux PCMCIA Configuration Script --------

The default responses for each question are correct for most users.
Consult the PCMCIA-HOWTO for additional info about each option.

Linux kernel source directory [/usr/src/linux]: /home/zjx/dma-pxa270L/linux-2.6.9//此处填入内核目录

The kernel source tree is version 2.6.9-270SL1.
 WARNING: the current kernel is version 2.4.20-8.
The current kernel build date is Thu Mar 13 17:54:28 2003.

Build ''trusting'' versions of card utilities (y/n) [n]: y
Include 32-bit (CardBus) card support (y/n) [y]: n
Include PnP BIOS resource checking (y/n) [n]: n
Module install directory [/lib/modules/2.6.9-270SL1]:

The forms library is not available.

Configuration successful.

进入cardmgr目录
[root@localhost pcmcia-cs-3.2.8]# cd cardmgr/
[root@localhost cardmgr]# make
[root@localhost cardmgr]# cd ..
把cardmgr目录下生成的cardctl、cardmgr拷贝到文件系统的/sbin目录下,以及把etc目录下的所有文件拷贝到文件系统/etc/pcmcia目录下
cp cardmgr/cardctl /home/zjx/rootfs/dma_pxa270/sbin/
cp cardmgr/cardmgr /home/zjx/rootfs/dma_pxa270/sbin/
cp etc /home/zjx/rootfs/dma_pxa270/etc/pcmcia/ -R
同时需要把/hostap-driver-0.4.9/driver/etc下的hostap_cs.conf拷贝到/home/zjx/rootfs/dma_pxa270/etc/pcmcia目录下。

3、从
下载Wireless Extensions v18的补丁文件,保存为WE.v18.patch
进入linux-2.6.9内核目录,运行patch –p1 <../WE.v18.patch
重新编译内核make zImage。
4、从
下载wireless_tools.28.tar.gz
tar zxvf wireless_tools.28.tar.gz
cd wireless_tools.28
把Makefile中的CC改成CC=arm-linux-gcc
编译make
把生成的iwconfig iwevent iwgetid iwlist iwspy iwpriv拷贝到文件系统/sbin目录下
[root@localhost wireless_tools.28]# cp iwconfig iwevent iwgetid iwlist iwspy iwpriv /home/zjx/rootfs/dma_pxa270/sbin/
把libiw.so.28拷贝到文件系统/lib目录下
[root@localhost wireless_tools.28]# cp libiw.so.28 /home/zjx/rootfs/dma_pxa270/lib/
重新制作文件系统。

5、把编译好的内核及文件系统烧到板子上

6、启动开发板进入shell,插入无线网卡。

7、运行cardmgr:
[root@Linux /]#cardmgr                
cardmgr[711]: watching 1 socket
<6>cs: memory probe 0x0c0000-0x0fffff: clean.
[root@Linux /]#cardmgr[712]: socket 0: Senao NL-2011CD PLUS Ext2 Mercury
cardmgr[712]: executing: ''modprobe hostap 2>&1''
cardmgr[712]: + insmod: hostap.ko: no module by that name found
cardmgr[712]: + modprobe: failed to load module hostap
cardmgr[712]: modprobe exited with status 1
No module found in object
cardmgr[712]: executing: ''insmod /lib/modules/2.6.9-270SL1/pcmcia/hostap.o 2>&1''
cardmgr[712]: + Using /lib/modules/2.6.9-270SL1/pcmcia/hostap.o
cardmgr[712]: + insmod: cannot insert `/libhostap_cs: setting Vcc=33 (constant)
/modules/2.6.9-270SL1/pcmcia/hostap.o'': Invalid module format (-hostap_cs: CS_EVENT_CARD_INSERTION
1): Exec format error
cardmgr[712]: insmod exited with status hostap_cs: setting Vcc=33 (from config)
1
Checking CFTABLE_ENTRY 0x01 (default 0x01)
IO window settings: cfg->io.nwin=1 dflt.io.nwin=1
io->flags = 0x0046, io.base=0x0000, len=64
hostap_cs: Registered netdevice wifi0
rock pcmica: mst_pcmcia_configure_socket  power = 0x8
rock pcmica: mst_pcmcia_configure_socket  power = 0x8
IRQ41 (GPIO9): falling edges
hostap_cs: index 0x01: Vcc 3.3, irq 41, io 0xc48a0000-0xc48a003f
prism2_hw_init: initialized in 200 ms
wifi0: NIC: id=0x801b v1.0.0
wifi0: PRI: id=0x15 v1.1.1
wifi0: STA: id=0x1f v1.8.0
wifi0: registered netdevice wlan0
cardmgr[712]: start cmd exited with status 1

8、按以下步骤进行操作:
[root@Linux /]#ifconfig eth0 down
[root@Linux /]#ifconfig wlan0 192.168.1.23
[root@Linux /]#iwconfig wlan0 essid linksys //必须跟AP的ssid一致
[root@Linux /]#iwconfig wlan0 mode Manager//设置iw_mode=2,另外需要注意channel要与AP保持一致,可运行iwconfig wlan0 channel ?设置成与AP一致的channel
[root@Linux /]#iwconfig
[root@Linux pcmcia]#iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

irda0     no wireless extensions.

usb0      no wireless extensions.

Warning: Driver for device wifi0 has been compiled with version 18
of Wireless Extension, while this program is using version 15.
Some things may be broken...

wifi0     IEEE 802.11b  ESSID:"linksys"  
         Mode:Managed  Frequency:2.422GHz  Access Point: 00:06:25:6D:D9:A1  
         Bit Rate:11Mb/s   Sensitivity=1/0  
         Retry min limit:8   RTS thr:off   Fragment thr:off
         Encryption key:off
         Power Management:off
         
wlan0     IEEE 802.11b  ESSID:"linksys"  
         Mode:Managed  Frequency:2.422GHz  Access Point: 00:06:25:6D:D9:A1  
         Bit Rate:11Mb/s   Sensitivity=1/0  
         Retry min limit:8   RTS thr:off   Fragment thr:off
         Encryption key:off
         Power Management:off
         Link Quality:50/0  Signal level:-28 dBm  Noise level:-78 dBm
         Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
         Tx excessive retries:0  Invalid misc:50   Missed beacon:0

9.Ping AP:
[root@Linux /]#ping 192.168.1.44
PING 192.168.1.44 (192.168.1.44): 56 data bytes
64 bytes from 192.168.1.44: icmp_seq=0 ttl=150 time=8.1 ms
64 bytes from 192.168.1.44: icmp_seq=1 ttl=150 time=3.7 ms
64 bytes from 192.168.1.44: icmp_seq=2 ttl=150 time=3.7 ms

10.无线上网:
要进行无线上网,需要在上面的基础上添加网关配置:
# route add default gw 192.168.1.1
并且需要增加DNS域名解析地址:
~ # cd /tmp/
/var/tmp # vi resolv.conf
//在resolv.conf文件中增加你的DNS地址,格式 nameserver xxx.xxx.xxx
nameserver 202.96.134.133
保存退出
然后可以进入QT界面,在Applications栏中打开konquer浏览器,键入网址即可畅游


转载地址:
阅读(356) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~