跳至主要内容

【转】发一篇无线网卡移植的文档

发一篇无线网卡移植的文档 
2007-01-11 22:44

1、准备好hostap、pcmcia-cs及wireless_tools驱动
hostap驱动可从http://hostap.epitest.fi/下载最新版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驱动可从http://pcmcia-cs.sourceforge.net下载最新的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、从http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html#links
下载Wireless Extensions v18的补丁文件,保存为WE.v18.patch
进入linux-2.6.9内核目录,运行patch �p1 <../WE.v18.patch
重新编译内核make zImage。

4、从http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html#links
下载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浏览器,键入网址即可畅游

评论

此博客中的热门博文

【转】VxWorks中的地址映射

在运用嵌入式系统VxWorks和MPC860进行通信系统设计开发时,会遇到一个映射地址不能访问的问题。 缺省情况下,VxWorks系统已经进行了如下地址的映射:   memory地址、bcsr(Board Control and Status)地址、PC_BASE_ADRS(PCMCIA)地址、Internal Memory地址、rom(Flach memory)地址等,但是当你的硬件开发中要加上别的外设时,如(falsh、dsp、FPGA等),对这些外设的访问也是通过地址形式进行读写,如果你没有加相应的地址映射,那么是无法访问这些外设的。   和VxWorks缺省地址映射类似,你也可以进行相应的地址映射。   如下是地址映射原理及实现:   1、 地址映射结构 在Tornado\target\h\vmLib.h文件中 typedef struct phys_mem_desc { void *virtualAddr; void *physicalAddr; UINT len; UINT initialStateMask; /* mask parameter to vmStateSet */ UINT initialState; /* state parameter to vmStateSet */ } PHYS_MEM_DESC; virtualAddr:你要映射的虚拟地址 physicalAddr:硬件设计时定义的实际物理地址 len;要进行映射的地址长度 initialStateMask:可以初始化的地址状态: 有如下状态: #define VM_STATE_MASK_VALID 0x03 #define VM_STATE_MASK_WRITABLE 0x0c #define VM_STATE_MASK_CACHEABLE 0x30 #define VM_STATE_MASK_MEM_COHERENCY 0x40 #define VM_STATE_MASK_GUARDED 0x80 不同的CPU芯片类型还有其特殊状态 initialState:实际初始化的地址状态: 有如下状态: #define VM_STATE_VALID 0x01 #define VM_STATE_VALID_NOT 0x00 #define VM_STATE_WRITA

【转】多迷人Gtkmm啊

前边已经说过用glade设计界面然后动态装载,接下来再来看看怎么改变程序的皮肤(主题)     首先从 http://art.gnome.org/themes/gtk2 下载喜欢的主题,从压缩包里提取gtk-2.0文件夹让它和我们下边代码生成的可执行文件放在同一个目录下,这里我下载的的 http://art.gnome.org/download/themes/gtk2/1317/GTK2-CillopMidnite.tar.gz     然后用glade设计界面,命名为main.glade,一会让它和我们下边代码生成的可执行程序放在同一个目录下边     然后开始写代码如下: //main.cc #include <gtkmm.h> #include <libglademm/xml.h> int main(int argc, char *argv[]) {     Gtk::Main kit(argc,argv);         Gtk::Window *pWnd;        gtk_rc_parse("E:\\theme-viewer\\themes\\gtk-2.0\\gtkrc");       Glib::RefPtr<Gnome::Glade::Xml> refXml;     try     {         refXml = Gnome::Glade::Xml::create("main.glade");     }     catch(const Gnome::Glade::XmlError& ex)     {         Gtk::MessageDialog dialog("Load glade file failed!", false,       \                                   Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK);         dialog.run();               return 1;     }         refXml->get_widget("main", pWnd);     if(pW

【转】https客户端的实现(libcurl)

一、              概念 1.         为什么要使用libcurl 1)        作为http的客户端,可以直接用socket连接服务器,然后对到的数据进行http解析,但要分析协议头,实现代理…这样太麻烦了。 2)        libcurl是一个开源的客户端url传输库,支持FTP,FTPS,TFTP,HTTP,HTTPS,GOPHER,TELNET,DICT,FILE和LDAP,支持Windows,Unix,Linux等平台,简单易用,且库文件占用空间不到200K 2.         get和post方式 客户端在http连接时向服务提交数据的方式分为get和post两种 1)        Get方式将所要传输的数据附在网址后面,然后一起送达服务器,它的优点是效率比较高;缺点是安全性差、数据不超过1024个字符、必须是7位的ASCII编码;查询时经常用此方法。 2)        Post通过Http post处理发送数据,它的优点是安全性较强、支持数据量大、支持字符多;缺点是效率相对低;编辑修改时多使用此方法。 3.         cookie与session 1)        cookie cookie是发送到客户浏览器的文本串句柄,并保存在客户机硬盘上,可以用来在某个Web站点会话之间持久地保持数据。cookie在客户端。 2)        session session是访问者从到达某个特定主页到离开为止的那段时间。每一访问者都会单独获得一个session,实现站点多个用户之间在所有页面中共享信息。session在服务器上。 3)        libcurl中使用cookie 保存cookie, 使之后的链接与此链接使用相同的cookie a)         在关闭链接的时候把cookie写入指定的文件 curl_easy_setopt(curl, CURLOPT_COOKIEJAR, "/tmp/cookie.txt"); b)        取用现在有的cookie,而不重新得到cookie curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "/tmp/cookie.txt"); b)        ht