Updating Ethernet MAC Address in U-Boot

The MAC address is stored within the U-Boot BOOTENV partition in FLASH memory as an environment variable 'ethaddr' . This variable is unique as such that once it is set, it is locked and cannot be cleared or reset by the user via the U-Boot command prompt.

This MAC address is communicated to the Linux kernel via the kernel command line.

This section describes the process of changing the ethernet MAC address, after U-Boot has been configured.

Setting the MAC Address

Use the PetaLinux System Configuration Menu to specify the new MAC address.

Rebuild U-boot and the images within PetaLinux:

  [petalinux/software/petalinux-dist]$ make u-boot image

The new MAC address has now been written into the ub.config.img file.

Due to U-Boot explicitly locking the MAC address variable, it is not possible to simply re-execute the ub.config script. Instead, the U-Boot environment must be erased, and recreated.

Erasing the U-Boot environment

The U-Boot environment can be erase using one of 2 ways. One is the automatic erase method which uses a predefined script to erase the U-Boot's bootenv partition from Flash. The other is the manual erase method, which requires the user to provide Flash sector information.

Refer to the Erase U-Boot Environment Settings Section of the User Guide for more information on erasing U-Boot's environment sector in Flash.

Restart and configure U-Boot

When you restart the board, U-Boot will use the default (empty) environment. You can now repeat the U-Boot configuration process? and the ub.config script to set the new MAC address.