Personal tools

Setting MAC address on VisionSOM-8Mmini

From SomLabs Wiki

Jump to: navigation, search

Setting MAC address on VisionSOM-8Mmini


This article describes a couple of methods to set the board MAC address and avoid the assignment its random value after device reboot.

Setting MAC address in systemd-networkd service files

The systemd-networkd interface configuration is stored in the *.network files within the /etc/systemd/network directory. To assign a MAC address to the chosen interface a new configuration file should be created (if it does not exist already). For the eth0 interface a file named 25-eth.network may be created with the following content:

[Match]
Name=eth0

[Link]
MACAddress=fe:51:11:6c:62:e8

[Network]
DHCP=ipv4

This file will assign the given address to the eth0 interface and enable the DHCP client for IPv4 address setting. More information may be found on the systemd-networkd service documentation.

U-Boot env variable

The default U-Boot configuration for VisionSOM boards generates a random MAC address for the ETH interface. This behaviour may be changed by adding a new env variable to the U-Boot. For VisionSOM-8Mmini, the environment variables are stored in include/configs/visionsom_8mm.h file. A new MAC address may be set by adding the following variable:

ethaddr=fe:51:11:6c:62:e8

Linux device tree file

A MAC address may be defined in the dtb file used by the Linux kernel. The address definition should be added in the device tree source in the following section:

&fec1 {
    local-mac-address = [ 70 b3 d5 1a 70 06 ];
}

This code configures given MAC address for the fec1 interface.

To prevent overwriting this value by u-boot, a random address generation should be disabled in the bootloader defconfig configs/visionsom_8mm_defconfig:

CONFIG_NET_RANDOM_ETHADDR=n

Processor OTP memory

NOTE! The described operation may be performed only once and cannot be reversed!

The iMX8MM processor has an OTP memory area that is used by default to store the permanent MAC address. The registers responsible for this are described in the Reference Manual:

  • OTP Bank9 Word0 (MAC Address) (OCOTP_HW_OCOTP_MAC_ADDR0)
  • OTP Bank9 Word1 (MAC Address) (OCOTP_HW_OCOTP_MAC_ADDR1)
  • OTP Bank9 Word2 (MAC Address) (OCOTP_HW_OCOTP_MAC_ADDR2)

This area may be written from the U-Boot console by executing the following commands. In this example the fe:51:11:6c:62:e8 address is stored in OTP:

fuse prog 9 0 0x116c62e8
fuse prog 9 1 0xfe51
NXP Partner ST Partner Renesas Partner