2015-09-23 41 views

回答

4

u-boot可以支持多個以太網端口嗎?

是的,在最近版本的U-Boot(至少回到2012.10)。
凸代碼是eth_current_changed()eth_set_current()淨/ eth.c

u-boot僅支持單個以太網端口是否存在固有限制?

不,最新版本的U-Boot可以在板上支持多個以太網端口。

當多於一個以太網接口是可用的(如報導通過在啓動時「淨」設備列表,例如「網:macb0,gmac0,usb_ether」),環境變量ethact用於定義所選擇的以太網活動的界面。
使用printenv ethact命令查看當前選擇。
使用setenv ethact <port name>更改活動以太網端口。

U-Boot的網絡命令,如tftpboot的,將使用由ethact變量定義的以太網端口。這保留了舊版U-Boot的命令語法,無論可用端口的數量如何(例如,腳本不更改),語法都是一致的。

每個以太網端口分配自己的MAC地址,使用下面的環境變量:

ethaddr: Ethernet MAC address for first/only ethernet interface (= eth0 in Linux). 
     This variable can be set only once (usually during manufacturing of the board). U-Boot refuses to delete or overwrite this variable once it has been set. 

eth1addr: Ethernet MAC address for second ethernet interface (= eth1 in Linux). 

eth2addr: Ethernet MAC address for third ethernet interface (= eth2 in Linux). 

顯然,你只能(容易)訪問一個端口的時間。
也只有一個靜態IP地址分配,即ipaddr環境變量。
(我不知道用一個端口通過DHCP獲得IP地址發生了什麼,然後主動端口被更改。)

U-Boot> printenv ethact 
ethact=macb0 
U-Boot> setenv ethact gmac0 
U-Boot> ping 192.168.1.1 
gmac0: PHY present at 7 
gmac0: Starting autonegotiation... 
gmac0: Autonegotiation complete 
gmac0: link up, 1000Mbps full-duplex (lpa: 0x2800) 
Using gmac0 device 
host 192.168.1.1 is alive 
U-Boot> 

注意,也有一個輪值方案自動更改活動端口當端口關閉時:

U-Boot> printenv ethact 
ethact=gmac0 
U-Boot> ping 192.168.1.1 
gmac0: PHY present at 7 
gmac0: Starting autonegotiation... 
gmac0: Autonegotiation timed out (status=0x7949) 
gmac0: link down (status: 0x7949) 
ERROR: Need valid 'usbnet_devaddr' to be set 
at drivers/usb/gadget/ether.c:2362/usb_eth_init() 
macb0: PHY present at 0 
macb0:0 is connected to macb0. Reconnecting to macb0 
macb0: Starting autonegotiation... 
macb0: Autonegotiation timed out (status=0x7849) 
macb0: link up, 100Mbps full-duplex (lpa: 0x41e1) 
Using macb0 device 
ping failed; host 192.168.1.1 is not alive 
U-Boot> printenv ethact 
ethact=macb0 
U-Boot> 
+0

你可以顯示你正在使用的u-boot版本嗎?恐怕我正在處理更陳舊的事情。 – tarabyte

+0

@tarabyte - U-Boot 2014.04。 – sawdust

相關問題