詳解USB無線網(wǎng)卡的Linux驅(qū)動(dòng)移植
#KVER:= 2.6.24.7_$(ARCH)
本文引用地址:http://m.butianyuan.cn/article/201808/385301.htm修改第96行,指定2.6.12內(nèi)核路徑:
KSRC:= /test/yle2440_2.6.12
修改完畢后,直接make即可在目錄下生成8712u.ko。下載8712u.ko驅(qū)動(dòng)到目標(biāo)板。
2.5 安裝wirelesstools[3]
無線網(wǎng)卡配置需要使用一些無線網(wǎng)絡(luò)管理工具,如wpa_supplicant、wirelesstools等。本項(xiàng)目使用wirelesstools來實(shí)現(xiàn)。首先下載wireless_tools.29.tar.gz,然后解壓、編譯、安裝。 下面介紹具體步驟。
① 解壓。
tar zxvf wireless_tools.29.tar.gz
② 修改Makefile。
修改第8行,設(shè)置可執(zhí)行文件安裝路徑:
l; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(68,68,68); WORD-SPACING: 0px; PADDING-TOP: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px>PREFIX=/usr/local/wireless
修改第12行,設(shè)置gcc交叉編譯器:
CC=/usr/local/arm/3.4.1/bin/armlinuxgcc
修改第15行,設(shè)置ar交叉編譯器:
AR=/usr/local/arm/3.4.1/bin/armlinuxar
修改第16行,設(shè)置ranlib交叉編譯器:
RANLIB=/usr/local/arm/3.4.1/bin/armlinuxranlib
③ 運(yùn)行make命令。
④ 運(yùn)行make install命令。可執(zhí)行文件安裝于/usr/local/wireless目錄下。
⑤ 拷貝兩個(gè)庫(kù)libiw.so和libiw.so.29到文件系統(tǒng)/test/rootfs/lib目錄下,運(yùn)行chmod 777命令后重新生成壓縮根文件rootfs.cramfs,并下載到ARM板。
⑥ 將安裝目錄下的iwconfig、iwlist等下載到目標(biāo)板。主要使用的命令及功能:
◆ iwconfig,回車,查看所有無線網(wǎng)卡;
◆ iwconfig wlan0,查看wlan0;
◆ iwconfig wlan0 essid xx,配置網(wǎng)卡SSID為xx;
◆ iwlist wlan0 scan|grep ESSID,搜索周邊所有無線網(wǎng)卡的ESSID。
2.6 無線網(wǎng)卡測(cè)試
(1) 插入無線網(wǎng)卡,自動(dòng)安裝USB host驅(qū)動(dòng)
[root@(none) tmp]# uname a
Linux(none) 2.6.12h1940 #59 Tue May 3 13:12:53 CST 2011 armv4tl unknown
[root@(none) tmp]# usb 11:new full speed USB device using s3c2410ohci and address 4
usb 11: Product: RTL8188S WLAN Adapter
usb 11: Manufacturer: Manufacturer Realtek
R-SPACING: normal; COLOR: rgb(68,68,68); WORD-SPACING: 0px; PADDING-TOP: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px>usb 11: SerialNumber: 00e04c000001
(2) 加載模塊8712u.ko
insmod 8712u.ko
(3) 喚醒USB無線網(wǎng)卡驅(qū)動(dòng)
ifconfig wlan0 up
(4) 搜索周邊無線網(wǎng)絡(luò)
[root@(none) tmp]# iwlist wlan0 scan | grep ESSID
fwdbg: get survey cmd
fwdbg: survey done (00000005, 00000000)
ESSID: TPLINK_WSW
ESSID: TPLINK_717E24
ESSID: dlink
ESSID: newnav
ESSID: dgdz
(5) 配置wlan0的SSID
iwconfig wlan essid TPLINK_717E24
配置成功后利用iwconfig回顯:
[root@(none) tmp]# uname a
Linux (none) 2.6.12h1940 #59 Tue May 3 13:12:53 CST 2011 armv4tl unknown
[root@(none) tmp]# iwconfig wlan0
wlan0IEEE 802.11bg ESSID:TPLINK_717E24
Mode: Managed Frequency: 2.437 GHz Access Point: 00:25:86:71:7E:24
Bit Rate: 54 Mb/s
Encryption key:off
Power Management: off
Link Quality=52/100 Signal level=52/100 Noise level=0/100
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
(6) IP動(dòng)態(tài)分配
自動(dòng)申請(qǐng)動(dòng)態(tài)IP:
udhcpc i wlan0
顯示如下信息:
[root@(none) tmp]# uname a
Linux (none) 2.6.12h1940 #59 Tue May 3 13:12:53 CST 2011 armv4tl unknown
[root@(none) tmp]# udhcpc i wlan0
udhcpc (v0.9.9pre) started
udhcpc[490]: udhcpc (v0.9.9pre) started
Sending discover...
udhcpc[490]: Sending discover...
Sending select for 172.16.51.9...
udhcpc[490]: Sending select for 172.16.51.9...
Lease of 172.16.51.9 obtained, lease time 691200
udhcpc[490]: Lease of 172.16.51.9 obtained, lease time 691200
deleting routers
route: SIOC[ADD|DEL]RT: No such process
adding dns 61.153.216.99
adding dns 61.153.216.104
px; WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 2em; MARGIN: 10px 25px 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; FONT: 14px/22px 宋體, Georgia, verdana, serif; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(68,68,68); WORD-SPACING: 0px; PADDING-TOP: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px>運(yùn)行ifconfig命令后,顯示最終配置:
[root@(none) tmp]# uname a
Linux (none) 2.6.12h1940 #59 Tue May 3 13:12:53 CST 2011 armv4tl unknown
[root@(none) tmp]# ifconfig wlan0
wlan0 Line encap: Ethernet HWaddr 00:0F:10:54:0E:1B
inet addr: 172.16.51.9 Bcast:172.16.255.255 Mask: 255.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:618 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
評(píng)論