kernel 启动后没有eth0

来源:互联网 发布:中昌数据股票千股千评 编辑:程序博客网 时间:2024/05/16 17:57

       最近做视频电话项目,用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

 

原创粉丝点击