............................................................................................................
PC机系统:ubuntu 11.10
Linux kerner : 2.6.39
............................................................................................................
RT3070驱动编译过程不在多说,如果觉得改的什么问题也没有,且内核也进行了相应的配置,在编译时还是出现很多错误。对于这种情况建议从网上从新找个驱动源代码进行编译。我试过个了,对两个不同版本的3070驱动进行编译,一样的改的,一个可以编译成功,另一个却不行。
驱动编译好了之后,下载到板子,
>[root@mcuzone /home]#insmod rt3070sta.ko
rt3070sta: Unknown symbol __bswapsi2 (err 0)
insmod: can't insert 'rt3070sta.ko': unknown symbol in module or invalid parameter
显示__bswapsi2没有定义。因为板子内核是自带的,考虑是不是内核没有加相应东西,于是在PC上编译内核,使用SAM-BA烧写的板子上,重新启动,出现:
NAND read: device 0 offset 0x200000, size 0x300000
atmel_nand : multiple errors detected. Unable to correct.
NAND read from offset 200000 failed -1
88064 bytes read: ERROR
Wrong Image Format for bootm command
ERROR: can't get kernel image!
U-Boot>
仔细阅读开发资料,发现厂家只建议采用所提供的bat烧写方式,于是连接上J-link,将文件中的内核替换成自己编译的,烧写完毕启动,发现终端只打印
roomboot
经过几次测试,发现个小细节,用bat烧写方式,完毕后要先关闭板子,拔出J-link,之后再才能重启。
期间为了烧写方便,自己弄了个NFS文件系统,挂载时出现
ending DHCP requests .....
eth0: link up (100/Full)
., OK
IP-Config: Got DHCP answer from 0.0.0.0, my address is 192.168.1.102
IP-Config: Complete:
device=eth0, addr=192.168.1.102, mask=255.255.255.0, gw=192.168.1.1,
host=192.168.1.102, domain=, nis-domain=(none),
bootserver=0.0.0.0, rootserver=0.0.0.0, rootpath=, mtu=576
VFS: Cannot open root device "nfs" or unknown-block(0,255)
Please append a correct "root=" boot option; here are the available partitions:
1f00 65536 mtdblock0 (driver?)
1f01 196608 mtdblock1 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,255)[<c0036b10>] (unwind_backtrace+0x0/0xe0) from [<c0358050>] (panic+0x50/0x170)
[<c0358050>] (panic+0x50/0x170) from [<c0008d20>] (mount_block_root+0x234/0x284)[<c0008d20>] (mount_block_root+0x234/0x284) from [<c000902c>] (prepare_namespace
+0x164/0x1b8)
[<c000902c>] (prepare_namespace+0x164/0x1b8) from [<c00089ac>] (kernel_init+0x10
0/0x13c)
[<c00089ac>] (kernel_init+0x100/0x13c) from [<c0032b14>] (kernel_thread_exit+0x0
/0x8)
类似错误信息,查看后发现原来是没mount上,mout格式如下:
>setenv bootargs mem=128M console=ttyS0,115200 root=/dev/nfs rw nfsroot=192.168.1.108:/mcuzone/nfsroot/my_rootfs ip=dhcp
当内核替换之后以为驱动可以加载上了,试了之后发现还是会打印—bswapsi2没定义。自此排除原因为内核导致。上网搜了相关资料,有说是GCC的bug,于是考虑替换gcc。
原来gcc版本为arm-2011.03-41-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 解压,用版本arm-2007q1-10-arm-none-linux-gnueabi.tar.bz2 解压后,采用新的gcc对驱动进行编译,完了之后下载到板子,出现
>rt3070sta: version magic '2.6.39 mod_unload ARMv5 p2v8 ' should be '2.6.39 mod_unload ARMv5 '
>insmod: can't insert 'rt3070sta.ko': invalid module format出现内核版本不匹配,突然想起编译uImage时是采用2011.03.-41版本的gcc,而驱动是采用2007q1-10版本的gcc。于是用2007-q1-10版本的gcc先对内核进行编译,并make install,在对驱动代码进行编译。注意这个前后顺序不能改变,不然内核虽然改过来了。驱动却还是用之前编译的内核,加载驱动就会出现
>rt3070sta: version magic'2.6.39 mod_unload ARMv5 ' should be'2.6.39 mod_unload ARMv5 p2v8 '
>insmod: can't insert 'rt3070sta.ko': invalid module format
到现在驱动能加载了
[root@mcuzone /home]#chmod 777 rt3070sta.ko
[root@mcuzone /home]#insmod rt3070sta.ko
rtusb init --->
usbcore: registered new interface driver rt2870