在LINUX 3.0.8 目录下运行make xconfig, 如下图所示选上Ralink rt27xx/rt28xx/rt30xx (USB) support
这样就添加上了支持 RT3070 USB Wifi的驱动,保存并退出xconfig,然后make,得到新内核zImage。更新内核,接上usb wifi,将会看到
usb 1-1.3: new full speed USB device number 4 using s3c2410-ohci
usb 1-1.3: New USB device found, idVendor=148f, idProduct=3070
usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1.3: Product: 802.11 n WLAN
usb 1-1.3: Manufacturer: Ralink
usb 1-1.3: SerialNumber: 1.0
在终端里运行ifconfig
eth0 Link encap:Ethernet HWaddr 00:22:12:34:56:90
inet addr:192.168.1.20 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:108 Base address:0xe000
lo Link encap:Local Loopback
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)
wlan0 Link encap:Ethernet HWaddr 00:2E:66:1C:16:B4
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)
其中wlan0就是无线网卡的相关信息,执行ifconfig wlan0 up,得到信息:
phy0 -> rt2x00lib_request_firmware: Error - Failed to request Firmware.
ifconfig: SIOCSIFFLAGS: No such file or directory
找不到固件,为了确认固件的名称,在源代码linux-3.0.8driversnetwirelessrt2x00rt2x00firmware.c的rt2x00lib_request_firmware函数里
fw_name = rt2x00dev->ops->lib->get_firmware_name(rt2x00dev);
if (!fw_name) {
ERROR(rt2x00dev,
'Invalid firmware filename.n'
'Please file bug report to %s.n', DRV_PROJECT);
return -EINVAL;
}
之后加上:
ERROR (rt2x00dev, 'Loading firmware file '%s'.n', fw_name);
//之所以是ERROR是为了保证这个信息一定会输出来
重新make,更新zImage后,再次执行ifconfig wlan0 up可得到:
Loading firmware file 'rt2870.bin'
这就是说缺少了rt2870.bin firmware,通过google得到:
通常情况下,load firmware的动作是通过用户空间的hotplug handler,也就是
/proc/sys/kernel/hotplug里设定的执行档,来完成。root_qtopia默认会在/etc/init.d/rcS
里将/proc/sys/kernel/hotplug设定为/sbin/mdev,即busybox的mdev模块。它在收到来自内核
的请求加载rt73.bin这个firmware消息后,会从/lib/firmware目录下去找rt73.bin,如果能找到
就加载。
解决方法:
文件系统的/etc/init.d/rcS加:
echo /sbin/mdev > /proc/sys/kernel/hotplug
这样一句。
通过查看,发现rcS里已经加了echo /sbin/mdev > /proc/sys/kernel/hotplug,只是lib目录下并没有
firmware目录,更没有rt2870.bin,所以重新制作qtopia.tar.gz,在lib/firmware目录下加上rt2870.bin.重新
烧写qtopia.tar.gz,再次执行ifconfig wlan0 up,不再报错,执行iwlist wlan0 sanning 就可得到当前环境
下wifi AP的信息:
wlan0 Scan completed :
Cell 01 - Address: 40:16:9F:59:24:D0
Channel:6
Frequency:2.437 GHz (Channel 6)
Quality=55/70 Signal level=-55 dBm
Encryption key:on
ESSID:'wandakeji'
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s
Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
Mode:Master
Extra:tsf=000000076f2fb271
Extra: Last beacon: 2040ms ago
IE: Unknown: 000977616E64616B656A69
IE: Unknown: 010882848B960C121824
IE: Unknown: 030106
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
IE: WPA Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
IE: Unknown: 2A0100
IE: Unknown: 32043048606C
IE: Unknown: DD180050F2020101860003A4000027A4000042435E0062322F00
IE: Unknown: DD1E00904C334E101BFFFF000000000000000000000000000000000000000000
IE: Unknown: 2D1A4E101BFFFF000000000000000000000000000000000000000000
IE: Unknown: DD1A00904C3406071B00000000000000000000000000000000000000
IE: Unknown: 3D1606071B00000000000000000000000000000000000000
IE: Unknown: DD0900037F01010000FF7F
IE: Unknown: DD0A00037F04010000004000
IE: Unknown: DD810050F204104A0001101044000102103B000103104700100000000000001000000040
169F5924D01021000754502D4C494E4B10230009544C2D57523834314E10240003372E301042000
3312E301054000800060050F204000110110019576972656C65737320526F7574657220544C2D575