Ethernet MAC address

From ArmadeusWiki
Revision as of 11:24, 4 March 2009 by JulienC (Talk | contribs) (Ethernet MAC address details and how to change it on APF9328)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

If, for any reasons, you want to change your board Ethernet MAC address, here is the procedure.

Introduction

Every network card has a MAC address to identify itself on the network. The MAC address first three octets are known as the Organizationally Unique Identifier. Armadeus OUI is 00:1E:AC [1]

Hardware

Armadeus APF9328 board has a separate MAC controller, the DM9000 chip from Davicom [2]. The APF schematic, page 10, shows the implementation of the chip with an EEPROM chip to store its parameters, including MAC address.

U-boot

U-boot has a parameter containing the Ethernet address. This parameter is independent from the hardware address. The parameter is ethaddr.

BIOS> printenv ethaddr
00:1E:AC:XX:XX:XX

XX:XX:XX being the board specific address.


Change MAC address

It can happen that the MAC address is wrong (e.g.: 00:00:0E:00:00:00 in my case), empty or that you want to change it.

Empty MAC address

If the board MAC address is empty, the procedure is simplified.

In U-boot, simply set the correct value in the parameter ethaddr, ping any address and save the environment.

BIOS> setenv ethaddr 00:1e:ac:XX:XX:XX
BIOS> ping 1 
MAC: 00:1e:ac:XX:XX:XX                
operating at 100M full duplex mode    
 [Ctrl-C]
Abort
ping failed; host 1 is not alive
BIOS> saveenv

FIXME: The above message are made-up, don't know if reprogramming message is displayed or not...

Wrong MAC address

If the MAC address is already set but wrong, changing the U-boot parameter ethaddr will not automatically reprogram the EEPROM. It is necessary to indicate to U-boot to reprogram the EEPROM.

This is made possible by a specific patch to U-boot by Armadeus for the DM9000 chip [3] line 68 and following. Thanks to this patch, setting the ethaddr parameter to ff:ff:ff:ff:ff:ff and ping any IP will provoke the MAC address reprogramming. Then simply set ethaddr parameter again to the correct MAC address and ping any IP address, as shown below.

BIOS> setenv ethaddr ff:ff:ff:ff:ff:ff
BIOS> ping 1                          
Warning: MAC addresses reprogramming..
MAC: ff:ff:ff:ff:ff:ff                
operating at 100M full duplex mode    
 [Ctrl-C]
Abort
ping failed; host 1 is not alive
BIOS> setenv ethaddr 00:1e:ac:XX:XX:XX
BIOS> ping 1                          
Warning: MAC addresses reprogramming..
MAC: 00:1e:ac:XX:XX:XX                
operating at 100M full duplex mode    
 [Ctrl-C]
Abort
ping failed; host 1 is not alive
BIOS> 


Check your MAC address in Linux

Linux kernel and U-boot do not use the same source to get the board MAC address. As mentioned before, U-boot trusts its parameter ethaddr. Instead, Linux kernel, which uses the DM9000 driver, reads the MAC address from the EEPROM. During Linux boot, the driver prints the MAC address.

[...]
dm9000 Ethernet Driver, V1.31                                                                                             
eth0: dm9000e at c1854000,c1856002 IRQ 110 MAC: 00:1e:ac:xx:xx:xx (eeprom)
[...]

When logged on Linux, the tool ifconfig also displays information about the Ethernet MAC address.

# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:1E:AC:XX:XX:XX
          inet addr:192.168.0.10  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::21e:acxx:xxxx:xx/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:468 (468.0 B)
          Interrupt:110 Base address:0x4000

The field HWaddr corresponds to the MAC address read by dm9000 driver and used during communication.