diff options
author | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2019-11-11 16:27:50 +0100 |
---|---|---|
committer | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2020-01-14 13:34:34 +0100 |
commit | e845c094d5c9d6afbb1ab3f0815d6ed546b9d429 (patch) | |
tree | eb78d9d5f7c998bdf855b78b30d68fee37715a01 /target/linux/mediatek/mt7623/base-files/lib/preinit/07_set_iface_mac | |
parent | c6e972c8772a628a1a2f2e5590d7c6f4acef9ab0 (diff) | |
download | upstream-e845c094d5c9d6afbb1ab3f0815d6ed546b9d429.tar.gz upstream-e845c094d5c9d6afbb1ab3f0815d6ed546b9d429.tar.bz2 upstream-e845c094d5c9d6afbb1ab3f0815d6ed546b9d429.zip |
mediatek: split base-files into subtargets
This splits some base-files across subtargets, as done previously
on ath79 and ramips and also introduced for mt7629 subtarget here
already. Most of the existing base-files content is specific to
mt7623.
While at it, apply the following fixes:
- Remove lots of trailing whitespaces
- Remove wildcard on unielec,u7623-02-emmc-512m
- Remove inconsistent quotation marks in cases
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Acked-by: John Crispin <john@phrozen.org>
Diffstat (limited to 'target/linux/mediatek/mt7623/base-files/lib/preinit/07_set_iface_mac')
-rw-r--r-- | target/linux/mediatek/mt7623/base-files/lib/preinit/07_set_iface_mac | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/target/linux/mediatek/mt7623/base-files/lib/preinit/07_set_iface_mac b/target/linux/mediatek/mt7623/base-files/lib/preinit/07_set_iface_mac new file mode 100644 index 0000000000..7a73a2d84d --- /dev/null +++ b/target/linux/mediatek/mt7623/base-files/lib/preinit/07_set_iface_mac @@ -0,0 +1,47 @@ +#!/bin/sh +# 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 + unielec,u7623-02-emmc-512m) + 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 |