1 # Copyright (C) 2018 OpenWrt.org
3 RECOVERY_PART=/dev/mmcblk0p1
5 preinit_set_mac_address() {
9 . /lib/functions/system.sh
12 unielec,u7623-02-emmc-512m)
13 if [ -b $RECOVERY_PART ]; then
18 mkdir -p /tmp/recovery
19 mount -o rw,noatime $RECOVERY_PART /tmp/recovery
21 if [ -f "/tmp/recovery/mac_addr" ];
23 mac=$(cat /tmp/recovery/mac_addr)
25 mac=$(cat /sys/class/net/eth0/address)
26 echo "$mac" > /tmp/recovery/mac_addr
34 ip link set dev wan address $mac 2> /dev/null
36 mac=$(macaddr_add $mac 1)
38 ip link set dev lan0 address $mac 2>/dev/null
39 ip link set dev lan1 address $mac 2>/dev/null
40 ip link set dev lan2 address $mac 2>/dev/null
41 ip link set dev lan3 address $mac 2>/dev/null
46 boot_hook_add preinit_main preinit_set_mac_address