最近做視頻電話項目,用mx515 CPU,以前編譯的kernel啟動從來問題,
可進來發現,啟動之後ifconfig 發現沒有eth0,執行以下命令:
#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:3 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:280 (280.0 B) TX bytes:280 (280.0 B)
# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
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)
Base address:0xc000
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:5 errors:0 dropped:0 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:455 (455.0 B) TX bytes:455 (455.0 B)
很是鬱悶,回頭看看fec啟動log資訊,發現:
FEC ENET Version 0.2
fec: PHY @ 0x2, ID 0x0007c0f1 -- LAN8710
eth0: ethernet 00:00:00:00:00:00
原來是MAC地址為0所致,解決方案可以在kernel下用命令:
方法1:
# ifconfig eth0 hw ether 00:04:9f:00:ea:09
# 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:21 errors:0 dropped:0 overruns:0 frame:0
TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1855 (1.8 KiB) TX bytes:1855 (1.8 KiB)
# ifconfig eth0 up
# ifconfig
eth0 Link encap:Ethernet HWaddr 00:04:9F:00:EA:09
UP BROADCAST RUNNING 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)
Base address:0xc000
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:23 errors:0 dropped:0 overruns:0 frame:0
TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2030 (1.9 KiB) TX bytes:2030 (1.9 KiB)
#
已經可以了。
方法2:
在uboot啟動時設定mac 地址,下面是針對FEC的MAC地址,
vdphone U-Boot > set fec_addr 00:04:9f:00:ea:09
vdphone U-Boot > save