MAC Address
Factory MAC Address
Each board leaves the factory with a unique Ethernet MAC address stored in the
U-Boot environment as the ethaddr variable.
Flashing an image overwrites the U-Boot environment, so the factory MAC address is lost. After flashing, the board uses the MAC address programmed in the SoC OTP memory. If the OTP memory is blank, a random MAC address is generated at every boot.
Before flashing the board for the first time, write down the factory MAC address. Use one of the following methods:
-
In the U-Boot console (stop autoboot over the Serial Connection):
U-Boot consoleprintenv ethaddr -
In Linux:
Linux shell on the boardcat /sys/class/net/eth0/address
Program the MAC Address to OTP
To keep the same MAC address regardless of the flashed image, program it to the SoC OTP (one-time programmable) memory. U-Boot reads it from OTP at every boot and passes it to Linux in the device tree.
Programming OTP memory is irreversible. The MAC address can be programmed only once and cannot be changed or erased afterwards. Double-check the address before burning it.
Use the factory MAC address recorded earlier, an address from an OUI range
assigned to your organization, or a locally administered address (second
least significant bit of the first byte set, e.g. 02:xx:xx:xx:xx:xx).
To open the U-Boot console, connect to the board as described in the Serial Connection section and press any key during boot to stop autoboot.
On the SL1680, the MAC address is stored in a secure OTP field. It is
programmed with an OTP layout blob generated on the host by the Synaptics
gen_genx_otp_layout_v1 tool and written with the U-Boot otp write command.
Generate the OTP Blob
The tool is available in the Synaptics factory repository and runs on an x86_64 Linux host:
git clone --depth 1 -b scarthgap_6.12_v2.6.1 https://github.com/synaptics-astra/factory.git
cd factory/scripts/platypus/factory/tools
The -M option takes a file containing the 6 raw MAC address bytes, not a text
string. Generate the blob for your MAC address:
MAC=02:11:22:33:44:55
echo -n "$MAC" | tr -d ':' | xxd -r -p > mac.bin
./gen_genx_otp_layout_v1 -M mac.bin -s device_prov_pub.pem -o otp_mac.bin
Check that the blob is 1280 bytes (0x500) long and note its CRC32 checksum:
ls -l otp_mac.bin
crc32 otp_mac.bin
The blob only sets the MAC address field. No other OTP fields are modified.
Load the Blob
Load otp_mac.bin to address 0x10000000 in the U-Boot RAM. For example, copy
the file to a FAT-formatted USB flash drive and run:
usb start
fatload usb 0:1 0x10000000 otp_mac.bin
Alternatively, start the YMODEM receiver in U-Boot to transfer the file over the serial console.
loady 0x10000000
When U-Boot reports that it is ready to receive, close the serial terminal to
free the port. From the directory containing otp_mac.bin, set serial_port
to your UART device and send the file:
serial_port=/dev/ttyUSB0
stty -F "$serial_port" 115200 raw -echo cs8 -parenb -cstopb -crtscts clocal
sb --ymodem --binary otp_mac.bin < "$serial_port" > "$serial_port"
Reopen the serial terminal when the transfer completes.
Verify that the checksum matches the one calculated on the host:
crc32 0x10000000 0x500
Burn the MAC Address
otp write 0x10000000 0x500
reset
Expected output of the otp write command:
otp operation succeed
Verify the MAC Address
The MAC address OTP field is accessible only from the secure world, so it cannot be read back before a reset. After the board reboots into Linux, verify that the interface uses the programmed address:
cat /sys/class/net/eth0/address
The address stays the same after every reboot and after flashing a new image.