本節(jié)介紹如何使ELF?1開發(fā)板增加USB轉(zhuǎn)網(wǎng)絡(luò)的支持,使用USB轉(zhuǎn)百兆網(wǎng)模塊進(jìn)行測試,該模塊使用ASIX的USB 2.0 to 10/100M網(wǎng)絡(luò)控制器芯片AX88772B方案實現(xiàn),在Linux內(nèi)核源碼drivers/net/usb/中已經(jīng)存在支持該芯片的驅(qū)動,所以只需在內(nèi)核配置中增加此驅(qū)動編譯即可。
內(nèi)核配置
使用make menuconfig打開圖形配置界面,添加以下配置:
Device Drivers
->Network device support ->USB Network Adapters |
通過make menuconfig修改的內(nèi)容寫入到了.config文件,當(dāng)使用make imx6ull_elf1_defconfig配置內(nèi)核源碼時,.config文件會被覆蓋,因此,需要替換原有的imx6ull_elf1_defconfig。
elf@ubuntu:~/work/linux-imx-imx_4.1.15_2.0.0_ga$?cp .config arch/arm/configs/imx6ull_elf1_defconfig |
編譯測試
編譯內(nèi)核并拷貝到開發(fā)板:
elf@ubuntu:~/work/linux-imx-imx_4.1.15_2.0.0_ga$?./build.sh
elf@ubuntu:~/work/linux-imx-imx_4.1.15_2.0.0_ga$ scp arch/arm/boot/zImage ??root@172.16.0.175:/run/media/mmcblk1p1/ |
進(jìn)行sync操作后重啟開發(fā)板:
使用USB連接線連接ELF?1開發(fā)板和USB轉(zhuǎn)百兆網(wǎng)模塊:
啟動打印信息顯示如下信息,表示模塊加載成功。
asix 1-1.3:1.0 eth2: register 'asix' at usb-ci_hdrc.1-1.3, ASIX AX88772B USB 2.0 Ethernet, 00:0e:c6:87:72:01 |
系統(tǒng)啟動之后,使用如下命令查看是否生成網(wǎng)卡設(shè)備:
root@ELF1:~# ifconfig -a |
測試結(jié)果如下:
eth1 ?Link encap : Ethernet HWaddr ee:bb:dd:ee:ff:bb
inet addr :192.168.58.101 Bcast :192.168.58.255Mask:255.255.255.0 UP BROADCAST MULTICASTMTU :1500Metric: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 ) eth2 ?Link encap : Ethernet HWaddr 00:0e:c6:87:72:01 BROADCAST MULTICASTMTU :1500Metric: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 ) lo ??Link encap : Local Loopback inet addr :127.0.0.1Mask:255.0.0.0 inet6 addr :::1/128 Scope : Host |
可看到生成網(wǎng)卡eth2成功,然后使用網(wǎng)線連接模塊與PC機:
現(xiàn)在使用ifconfig命令設(shè)置此網(wǎng)卡IP:
root@ELF1:~# ifconfig eth2 up
root@ELF1:~# ifconfig eth2 192.168.3.232 |
使用ping命令ping PC機測試(這里設(shè)置PC機IP為192.168.3.102):
root@ELF1:~# ping 192.168.3.102
PING 192.168.3.102(192.168.3.102)56(84) bytes of data. 64 bytes from 192.168.3.102: icmp seq =1 ttl =64 time =2.08 ms 64 bytes from 192.168.3.102: icmp seq =2 ttl =64 time =0.470 ms 64 bytes from 192.168.3.102: icmp seq =3 ttl =64 time =0.850 ms 64 bytes from 192.168.3.102: icmp seq =4 ttl =64 time=0.671 ms 64 bytes from 192.168.3.102: icmp seq =5 ttl =64 time =0.418 ms 64 bytes from 192.168.3.102: icmp seq =6 ttl =64 time =0.792 ms |