1#! /vendor/bin/sh 2# Set eth0 mac address. 3# 4# Get the unique board serial number from /proc/cmdline or 5# /proc/bootconfig, prepend '0's to the serial number to 6# fill 5 LSBs of the MAC address and prepend "02" as MSB to 7# prepare a 6 byte locally administered unicast MAC address. 8# 9# Format the output in xx:xx:xx:xx:xx:xx format for the "ip" 10# set address command to work. 11 12ETHADDR=`/vendor/bin/cat /proc/cmdline | /vendor/bin/grep -o serialno.* |\ 13 /vendor/bin/cut -f2 -d'=' | /vendor/bin/awk '{printf("02%010s\n", $1)}' |\ 14 /vendor/bin/sed 's/\(..\)/\1:/g' | /vendor/bin/sed '$s/:$//'` 15if [ -z "${ETHADDR}" ] 16then 17 ETHADDR=`/vendor/bin/cat /proc/bootconfig | /vendor/bin/grep -o serialno.* |\ 18 /vendor/bin/cut -f2 -d'=' | /vendor/bin/cut -c 3-10 |\ 19 /vendor/bin/awk '{printf("02%010s\n", $1)}' |\ 20 /vendor/bin/sed 's/\(..\)/\1:/g' | /vendor/bin/sed '$s/:$//'` 21fi 22 23/vendor/bin/ifconfig eth0 down 24/vendor/bin/ifconfig eth0 hw ether "${ETHADDR}" 25/vendor/bin/ifconfig eth0 up 26