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 is 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 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 another time. You can only burn it once. If you burned it twice, the result is unknown.
Example(Add MAC addr: 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 you board with the serial console. Please refer to “How to Connect Board by Serial.pdf” if you want to know how to connect board by serial.
1.2 We use macaddr variable to add parameter of fec.macaddr.
1.3 Press any key on the board to enter uboot.
1.5 test 2. Second Option: burn the MAC address in OTP Hardware. Attention: this setting up option 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 " macaddr " variable in uboot.
refer to 1.3 to enter uboot, use follow to reset the " macaddr " variable to default.
Then you can use the MAC address from the hardware.