By default, the Ethernet driver reads the burned-in MAC address. If no MAC address exists in the hardware, the MAC reads all zeros, which makes MAC malfunction. If this occurs, the kernel will read uboot args to fix the MAC address, if there are no uboot args, the kernel will generate one random MAC address, so we can add the MAC address in the U-Boot command line for the kernel, such as add early parameter "fec.macaddr=1e:ed:19:27:1a:b4" in bootargs. Or you also can burn it in hardware, because this cannot be burned later. You can only burn it one time. if you burned it twice, the result is unknown.

Example(Add MAC address: 1e:ed:19:27:1a:b4 ):

1. First Option: Add parameter "fec.macaddr=1e:ed:19:27:1a:b4" in bootargs (affect the system MAC address preferentially) 

1.1 Connect your board with the serial console. Please refer to “How to Connect Board by Serial.pdf” if you want to know how to connect the board via serial.

1.2 Find your kernel command line at the beginning of the kernel log message.

1.3 Press any key on the board to enter uboot, then append the fec.macaddr=0x1e,0xed,0x19,0x27,0-x1a,0xb4 to the bootargs.

Use setenv bootargs ‘ fec.macaddr=0x1e,0xed,0x19,0x27,0-x1a,0xb4’.

1.4 boot.

1.5 test

2. Second Option: burn the MAC address in OTP Hardware. 

Attention: this way of setting it up will fuse the OTP hardware. You can do it only once. If you write it a second time, the result is unknown. But you also can change it from uboot (first option), this only affects the system, it doesn’t affect the OTP hardware. 

You can use the "echo" command in the console to flash the MAC address in OTP hardware.

MAC Address: 1e:ed:19:27:1a:b5

# echo 0x1eed > /sys/fsl_otp/HW_OCOTP_MAC1 // high 16 bits of MAC address

# echo 0x19271ab5 > /sys/fsl_otp/HW_OCOTP_MAC0 // low 32 bits of MAC address

When you’re done, reboot your board. If you didn’t use the first option, you will find your MAC address is 1e:ed:19:27:1a:b5. If you used the first option, it will affect the system MAC address preferentially.

If you used the first option, don't worry, do the following to restore the bootargs in uboot.

Refer to 1.3 to enter uboot, use follow to reset the bootargs to default.

Then you can use the MAC address from hardware.