You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
972 B
Plaintext
47 lines
972 B
Plaintext
6 years ago
|
# Copyright (C) 2018 OpenWrt.org
|
||
|
|
||
|
RECOVERY_PART=/dev/mmcblk0p1
|
||
|
|
||
|
preinit_set_mac_address() {
|
||
|
local mac
|
||
|
|
||
|
. /lib/functions.sh
|
||
|
. /lib/functions/system.sh
|
||
|
|
||
|
case $(board_name) in
|
||
5 years ago
|
unielec,u7623-02-emmc-512m)
|
||
6 years ago
|
if [ -b $RECOVERY_PART ]; then
|
||
|
insmod nls_cp437
|
||
|
insmod nls_iso8859-1
|
||
|
insmod fat
|
||
|
insmod vfat
|
||
|
mkdir -p /tmp/recovery
|
||
|
mount -o rw,noatime $RECOVERY_PART /tmp/recovery
|
||
|
|
||
|
if [ -f "/tmp/recovery/mac_addr" ];
|
||
|
then
|
||
|
mac=$(cat /tmp/recovery/mac_addr)
|
||
|
else
|
||
|
mac=$(cat /sys/class/net/eth0/address)
|
||
|
echo "$mac" > /tmp/recovery/mac_addr
|
||
|
fi
|
||
|
|
||
|
sync
|
||
|
umount /tmp/recovery
|
||
|
rm -rf /tmp/recovery
|
||
|
fi
|
||
|
|
||
|
ip link set dev wan address $mac 2> /dev/null
|
||
|
|
||
|
mac=$(macaddr_add $mac 1)
|
||
|
|
||
|
ip link set dev lan0 address $mac 2>/dev/null
|
||
|
ip link set dev lan1 address $mac 2>/dev/null
|
||
|
ip link set dev lan2 address $mac 2>/dev/null
|
||
|
ip link set dev lan3 address $mac 2>/dev/null
|
||
|
;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
|
boot_hook_add preinit_main preinit_set_mac_address
|