From: Adrian Schmutzler Date: Sun, 8 Dec 2019 13:26:34 +0000 (+0100) Subject: ramips: mt76x8: use flash location for wan_mac in 02_network X-Git-Tag: v21.02.0-rc1~4386 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=fef18108972d270b8202ad4d010e229900a1a38e;p=openwrt%2Fopenwrt.git ramips: mt76x8: use flash location for wan_mac in 02_network This uses the flash locations instead of eth0 MAC address to calculate MAC address increments for WAN. The change will make the MAC address setup of a particular device more obvious and removes the dependency of 02_network on the eth0 initialization. While at it, change the partition label for zyxel,keenetic-extra-ii to factory to be consistent with node label and all the other devices. Signed-off-by: Adrian Schmutzler --- diff --git a/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts b/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts index 8b069d4370..f4d678e38e 100644 --- a/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts +++ b/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts @@ -107,7 +107,7 @@ }; factory: partition@40000 { - label = "rf-eeprom"; + label = "factory"; reg = <0x40000 0x10000>; read-only; }; diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index f76af66f27..aeaf296984 100755 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -138,27 +138,10 @@ ramips_setup_macs() ;; duzun,dm06|\ netgear,r6120|\ - rakwireless,rak633|\ - tplink,archer-c20-v4|\ - tplink,archer-c50-v3|\ - tplink,archer-c50-v4|\ - tplink,tl-mr3420-v5|\ - tplink,tl-wr840n-v4|\ - tplink,tl-wr840n-v5|\ - tplink,tl-wr841n-v13|\ - tplink,tl-wr841n-v14|\ - tplink,tl-wr842n-v5|\ - unielec,u7628-01-16m|\ - wavlink,wl-wn570ha1|\ - wavlink,wl-wn575a3|\ - wiznet,wizfi630s|\ wrtnode,wrtnode2p|\ wrtnode,wrtnode2r|\ - xiaomi,mir4a-100m|\ - xiaomi,miwifi-nano|\ - zbtlink,zbt-we1226|\ zyxel,keenetic-extra-ii) - wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1) ;; hilink,hlk-7628n) lan_mac=$(macaddr_setbit_la "$(cat /sys/class/net/eth0/address)") @@ -185,14 +168,41 @@ ramips_setup_macs() mercury,mac1200r-v2) wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory_info 0xd)" 1) ;; + rakwireless,rak633|\ + unielec,u7628-01-16m|\ + wavlink,wl-wn575a3|\ + wiznet,wizfi630s|\ + xiaomi,miwifi-nano) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x28)" 1) + ;; skylab,skw92a|\ totolink,lr1200) wan_mac=$(mtd_get_mac_binary factory 0x2e) ;; + tplink,archer-c20-v4|\ + tplink,archer-c50-v3|\ + tplink,tl-mr3420-v5|\ + tplink,tl-wr840n-v4|\ + tplink,tl-wr840n-v5|\ + tplink,tl-wr841n-v13|\ + tplink,tl-wr841n-v14|\ + tplink,tl-wr842n-v5) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0xf100)" 1) + ;; + tplink,archer-c50-v4) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary rom 0xf100)" 1) + ;; vocore,vocore2|\ vocore,vocore2-lite) label_mac=$(mtd_get_mac_binary factory 0x8) ;; + wavlink,wl-wn570ha1|\ + zbtlink,zbt-we1226) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x2e)" 1) + ;; + xiaomi,mir4a-100m) + wan_mac=$(mtd_get_mac_binary factory 0x4) + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac