armadillo500でrt73

うーん。/lib/firmwareにrt73.binをおいても

[   54.520000] usb 1-1: new high speed USB device using fsl-ehci and address 2
[   54.830000] usb 1-1: Product: 802.11 bg WLAN
[   54.840000] usb 1-1: Manufacturer: Abocom
[   54.840000] usb 1-1: configuration #1 chosen from 1 choice
[   52.880000] idVendor = 0x2019, idProduct = 0xab50
[   51.890000] rt73: Failed to request_firmware. Check your firmware file location
[   52.890000] rt73: probe of 1-1:1.0 failed with error -2

のエラーが出てくる。linkstationを使ってる人とかはhotplugで対応しているらしいけど、
armadillo500だとudevが入ってるからhotplugっていらないんじゃなかったっけ。
一応今armadilloのメーリングリストを見てたら合った。
[Armadillo:02213] Re: Armadillo-220 USB無線LAN接続
/etc/Wireless/RT73STAを作って、その中にファームウェアとrt73sta.dat(設定ファイル)をおいてやるみたい。
rt73sta.datを置かずにinsmodしてつないでみたらエラーが少し変わった。

[   54.990000] usb 2-1: new high speed USB device using fsl-ehci and address 2
[   54.300000] usb 2-1: Product: 802.11 bg WLAN
[   54.310000] usb 2-1: Manufacturer: Abocom
[   54.320000] usb 2-1: configuration #1 chosen from 1 choice
[   52.360000] idVendor = 0x2019, idProduct = 0xab50
[   52.360000] register_netdev failed err=-17
[   52.360000] rt73: probe of 2-1:1.0 failed with error -17

とりあえず
http://www.ralinktech.com/ralink/Home/Support/Linux.html
から最新(2008_0506_RT73_Linux_STA_Drv1.1.0.1.tar.bz2 )を落としてやって見ることにする。

wget http://www.ralinktech.com.tw/data/drivers/2008_0506_RT73_Linux_STA_Drv1.1.0.1.tar.bz2
bzip2 -dc 2008_0506_RT73_Linux_STA_Drv1.1.0.1.tar.bz2 | tar xvf -

ついでにdos2unixもダウンロード

wget http://hany.sk/~hany/_data/hd2u/hd2u-1.0.3.tgz
tar xvzf hd2u-1.0.3.tgz

dos2unixをインストール

./configure
make
make install

do2unixを./configureするときにlibpopt(libpopt0,libpopt-dev)が必要。

とりあえずREADMEを読んでみる

=======================================================================
Build Instructions:
====================
1> $tar -xvzf RT73_Linux_STA_Drv_x.x.x.x.tar.gz
    go to "./RT73_Linux_STA_Drv_x.x.x.x/Module" directory.

2> $cp Makefile.4  ./Makefile       # [kernel 2.4]
    or
   $cp Makefile.6  ./Makefile       # [kernel 2.6]

3> [kernel 2.4]
    $chmod 755 Configure
    $make config         # config build linux os version

4> $make all            # compile driver source code
4.1> $make install

5> $cp rt73.bin /etc/Wireless/RT73STA/      # copy firmware

6>  $dos2unix rt73sta.dat
    $cp rt73sta.dat  /etc/Wireless/RT73STA/rt73sta.dat
    # !!!check if it is a binary file before loading !!!

7> $load
    #[kernel 2.4]
    #    $/sbin/insmod rt73.o
    #    $/sbin/ifconfig rausb0 inet YOUR_IP up

    #[kernel 2.6]
    #    $/sbin/insmod rt73.ko
    #    $/sbin/ifconfig rausb0 inet YOUR_IP up

とりあえずrtmp_def.hに

#define RT73_USB_DEVICES { \
 {USB_DEVICE(0x148f,0x2573)}, /* Ralink */      \
 {USB_DEVICE(0x148f,0x2671)}, /* Ralink */      \
 {USB_DEVICE(0x7392,0x7318)}, /* Edimax*/       \
 {USB_DEVICE(0x7392,0x7618)}, /* Edimax */      \
 {USB_DEVICE(0x050d,0x905b)}, /* Belkin */      \
 {USB_DEVICE(0x14B2,0x3C10)}, /* AL Tech */     \
 {USB_DEVICE(0x18e8,0x6196)}, /* Qcom */        \
 {USB_DEVICE(0x18e8,0x6229)}, /* Qcom */        \
 {USB_DEVICE(0x18e8,0x6238)}, /* Qcom */        \
 {USB_DEVICE(0x1044,0x8008)}, /* Gigabyte */    \
 {USB_DEVICE(0x14b2,0x3c22)}, /* Conceptronic */    \
 {USB_DEVICE(0x0db0,0x6877)}, /* MSI */         \
 {USB_DEVICE(0x0db0,0xa874)}, /* MSI */         \
 {USB_DEVICE(0x0db0,0xa861)}, /* MSI */         \
 {USB_DEVICE(0x07b8,0xb21d)}, /* AboCom */      \
 {USB_DEVICE(0x0769,0x31f3)}, /* Surecom */     \
 {USB_DEVICE(0x1472,0x0009)}, /* Huawei-3Com */     \
 {USB_DEVICE(0x1371,0x9022)}, /* CNet */        \
 {USB_DEVICE(0x1371,0x9032)}, /* CNet */        \
 {USB_DEVICE(0x1631,0xc019)}, /* Billionton */  \
 {USB_DEVICE(0x1044,0x800a)}, /* Gigabyte */    \
 {USB_DEVICE(0x1690,0x0722)}, /* Askey */       \
 {USB_DEVICE(0x0df6,0x9712)}, /* Sitecom WL-113 v1 002 */   \
 {USB_DEVICE(0x0df6,0x90ac)}, /* Sitecom */  \
 {USB_DEVICE(0x148f,0x9021)}, /* Amigo */   \
 {USB_DEVICE(0x0eb0,0x9021)}, /* Amigo */   \
 {USB_DEVICE(0x0411,0x00D8)}, /* BUFFALO WLI-U2-SG54HP */   \
 {USB_DEVICE(0x0586,0x3415)}, /* ZyXEL */   \
 {USB_DEVICE(0x0b05,0x1723)}, /* ASUS */  \
 {USB_DEVICE(0x0b05,0x1724)}, /* ASUS */    \
 {USB_DEVICE(0x050d,0x705a)}, /* Belkin */  \
 {USB_DEVICE(0x07d1,0x3c03)}, /* D-Link */  \
 {USB_DEVICE(0x13b1,0x0023)}, /* Linksys */  \
 {USB_DEVICE(0x13b1,0x0020)}, /* Linksys WUS54GC */ \
 {USB_DEVICE(0x2019,0xab50)}, /* Planex GW-US54Mini2*/ \ /*この行を追加*/
 {}} /* end marker */

にしてMakifileを次の用にした

######################################################################
#   Module Name: Makefile
#   Abstract: Makefile for rt73 linux driver on kernel series 2.6
######################################################################
#PLATFORM=PC
#PLATFORM=CMPC
PLATFORM = A500
CC = arm-linux-gcc

#Enable for wpa_supplicant's spcific driver "driver_ralink.c", default enabled.
HAS_RALINK_WPA_SUPPLICANT_SUPPORT=y

#Enable for wpa_supplicant's generic driver "driver_wext.c", used for NetworkManager
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n

#Support Block Net-If during TxSw queue full.
HAS_BLOCK_NET_IF=y


WFLAGS := -Wall -Wstrict-prototypes -Wno-trigraphs

ifeq ($(HAS_RALINK_WPA_SUPPLICANT_SUPPORT),y)
WFLAGS += -DRALINK_WPA_SUPPLICANT_SUPPORT
endif

ifeq ($(HAS_NATIVE_WPA_SUPPLICANT_SUPPORT),y)
WFLAGS += -DNATIVE_WPA_SUPPLICANT_SUPPORT
endif

ifeq ($(HAS_BLOCK_NET_IF),y)
WFLAGS += -DBLOCK_NET_IF
endif

## Comment/uncomment the following line to enable/disable debugging
#EXTRA_CFLAGS += -DDBG

EXTRA_CFLAGS += $(WFLAGS)

ifeq ($(PLATFORM),PC)
LINUX_SRC =/lib/modules/$(shell uname -r)/build
endif
ifeq ($(PLATFORM),CMPC)
LINUX_SRC = /home/fonchi/vendor/kernel-default-2.6.21/linux-2.6.21
endif
ifeq ($(PLATFORM),A500)
LINUX_SRC = //atmark-distまでのパス
endif

#以下略

とりあえずこれでビルドしてrt73.koができるまでは確認。
次にatmark-distのromfsからユーザーランド編集。
rt73.koは適当なところに、rt73.binとrt73sta.datはromfs/etc/Wireless/RT73STAに置く。
それでビルドして書き込み

とりあえず。dmesg

[   55.800000] usb usb1: uevent
[   55.800000] usb 1-0:1.0: uevent
[   55.810000] usb usb2: uevent
[   55.810000] usb 2-0:1.0: uevent
[   54.850000] usbcore: registered new driver rt73
[   55.490000] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002
[   55.490000] fsl-ehci fsl-ehci.0: GetStatus port 1 status 80001803 POWER sig=j CSC CONNECT
[   55.490000] hub 1-0:1.0: port 1, status 0101, change 0001, 12 Mb/s
[   55.650000] hub 1-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x101
[   54.770000] usb 1-1: new high speed USB device using fsl-ehci and address 2
[   55.850000] fsl-ehci fsl-ehci.0: port 1 high speed
[   55.850000] fsl-ehci fsl-ehci.0: GetStatus port 1 status 88001205 POWER sig=se0 PE CONNECT
[   55.030000] usb 1-1: default language 0x0409
[   55.080000] usb 1-1: new device strings: Mfr=1, Product=2, SerialNumber=0
[   54.080000] usb 1-1: Product: 802.11 bg WLAN
[   54.090000] usb 1-1: Manufacturer: Abocom
[   55.090000] usb 1-1: uevent
[   54.090000] usb 1-1: configuration #1 chosen from 1 choice
[   55.120000] usb 1-1: adding 1-1:1.0 (config #1, interface 0)
[   55.120000] usb 1-1:1.0: uevent
[   55.120000] usbserial_generic 1-1:1.0: usb_probe_interface
[   55.120000] usbserial_generic 1-1:1.0: usb_probe_interface - got id
[   55.120000] rt73 1-1:1.0: usb_probe_interface
[   55.120000] rt73 1-1:1.0: usb_probe_interface - got id
[   52.120000] idVendor = 0x2019, idProduct = 0xab50
[   55.460000] drivers/usb/core/inode.c: creating file '002'
[   52.910000] => usb_rtusb_open
[   55.740000] rausb0 (WE) : Driver using old /proc/net/wireless support, please fix driver !
[   52.060000] => usb_rtusb_open

うーんとりあえずはいったのか?

しばらく、ほっといたらカーネルパニックで死んだ

[   49.480000] Unable to handle kernel NULL pointer dereference at virtual address 00000008
[   49.480000] pgd = c0004000
[   49.480000] [00000008] *pgd=00000000
[   52.480000] Internal error: Oops: 817 [#1]
[   52.480000] Modules linked in: rt73
[   52.480000] CPU: 0
[   52.480000] PC is at mxc_iomux_set_gpr+0x3c/0x6c
[   52.480000] LR is at arch_idle+0x20/0x28
[   52.480000] pc : [<c002cf30>]    lr : [<c002ceec>]    Not tainted
[   52.480000] sp : c0345f8c  ip : c0345f9c  fp : c0345f98
[   52.480000] r10: 800202d8  r9 : 4107b364  r8 : 8002030c
[   52.480000] r7 : c03f8c64  r6 : c034a8a4  r5 : c0025058  r4 : c0344000
[   52.480000] r3 : 00000000  r2 : 00000000  r1 : c0343fe0  r0 : c077ffbc
[   52.480000] Flags: NzCv  IRQs off  FIQs on  Mode SVC_32  Segment kernel
[   52.480000] Control: C5387F  Table: 874C0000  DAC: 00000017
[   52.480000] Process swapper (pid: 0, stack limit = 0xc0344248)
[   52.480000] Stack: (0xc0345f8c to 0xc0346000)
[   52.480000] 5f80:                            c0345fa8 c0345f9c c0025094 c002ced8 c0345fc0
[   52.480000] 5fa0: c0345fac c0024d80 c0025064 c0344000 c03d87dc c0345fd4 c0345fc4 c00232dc
[   52.480000] 5fc0: c0024d5c c03e297c c0345ff4 c0345fd8 c0008890 c00232a0 c0008398 c03d8d28
[   52.480000] 5fe0: 00c5387d c03d8cac 00000000 c0345ff8 80008030 c00086a8 00000000 00000000
[   52.480000] Backtrace:
[   52.480000] [<c002cecc>] (arch_idle+0x0/0x28) from [<c0025094>] (default_idle+0x3c/0x48)
[   52.480000] [<c0025058>] (default_idle+0x0/0x48) from [<c0024d80>] (cpu_idle+0x30/0x64)
[   52.480000] [<c0024d50>] (cpu_idle+0x0/0x64) from [<c00232dc>] (rest_init+0x48/0x50)
[   52.480000]  r5 = C03D87DC  r4 = C0344000
[   52.480000] [<c0023294>] (rest_init+0x0/0x50) from [<c0008890>] (start_kernel+0x1f4/0x254)
[   52.480000]  r4 = C03E297C
[   52.480000] [<c000869c>] (start_kernel+0x0/0x254) from [<80008030>] (0x80008030)
[   52.480000] Code: e5930008 e59f3030 1180000c 01c0000c (e5830008)
[   52.480000]  <0>Kernel panic - not syncing: Attempted to kill the idle task!
[   52.660000]

あらー、やっぱ駄目?
カーネルパニックした後に再びつなげたら

[   54.270000] usb 1-1: new high speed USB device using fsl-ehci and address 10
[   51.390000] usb 1-1: device descriptor read/64, error -71
[   51.620000] usb 1-1: device descriptor read/64, error -71
[   54.850000] usb 1-1: new high speed USB device using fsl-ehci and address 11
[   51.970000] usb 1-1: device descriptor read/64, error -71
[   51.200000] usb 1-1: device descriptor read/64, error -71
[   54.430000] usb 1-1: new high speed USB device using fsl-ehci and address 12
[   51.850000] usb 1-1: device not accepting address 12, error -71
[   54.970000] usb 1-1: new high speed USB device using fsl-ehci and address 13
[   51.390000] usb 1-1: device not accepting address 13, error -71

とりあえず目一回再起動したら復活。
しかしiwconfigでしばらく設定してたらいきなり

[   52.440000] e440: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   52.440000] e460: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   52.440000] e480: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   52.440000] e4a0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   52.440000] e4c0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   52.440000] e4e0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   52.440000] e500: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   52.440000] e520: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   52.440000] e540: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   52.440000] e560: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   52.440000] e580: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   52.440000] e5a0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   52.440000] e5c0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   52.440000] e5e0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

やっぱドライバがだめか?
最新じゃない方がよかったかなぁ。

でもとりあえずつながってるpingしたら分かった。
つながってるっぽいけど、よくわからん。
とりあえず以下の手順でSSHログインまで確認

[root@armadillo500 (ttymxc0) ~]# ifconfig rausb0
rausb0    Link encap:Ethernet  HWaddr 00:90:CC:F7:F9:84
          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)

[root@armadillo500 (ttymxc0) ~]# ifconfig rausb0 up
[   52.910000] => usb_rtusb_open
[root@armadillo500 (ttymxc0) ~]# iwconfig rausb0 essid xxxxxx
[root@armadillo500 (ttymxc0) ~]# iwconfig rausb0 enc xxxxxxxxx
[root@armadillo500 (ttymxc0) ~]# iwconfig
lo        no wireless extensions.

tunl0     no wireless extensions.

Warning: Driver for device rausb0 has been compiled with version 20
of Wireless Extension, while this program supports up to version 17.
Some things may be broken...

rausb0    RT73 WLAN  ESSID:"ESSID"
          Mode:Managed  Frequency=2.442 GHz  Access Point: xx:xx:xx:xx:xx:xx
          Bit Rate=54 Mb/s
          RTS thr:off   Fragment thr:off
          Encryption key:5246-AF17-A9   Security mode:open
          Link Quality=63/100  Signal level:-66 dBm  Noise level:-99 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

[root@armadillo500 (ttymxc0) ~]# ifconfig rausb0 [任意のIP]
[root@armadillo500 (ttymxc0) ~]# ifconfig
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)

rausb0    Link encap:Ethernet  HWaddr 00:90:CC:F7:F9:84
          inet addr:xxx.xxx.xxx.xxx  Bcast:xxx.xxx.xxx.xxx  Mask:xxx.xxx.xxx.xxx
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:404 errors:0 dropped:0 overruns:0 frame:0
          TX packets:148 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:31554 (30.8 KiB)  TX bytes:10194 (9.9 KiB)

[root@armadillo500 (ttymxc0) ~]#

これでコンソールからIPを打ってSSHログインが無事できた。