[openwrt/openwrt] ramips: fix Ethernet random MAC address for HILINK HLK-7628N

LEDE Commits lede-commits at lists.infradead.org
Sat Jun 12 02:02:22 PDT 2021


adrian pushed a commit to openwrt/openwrt.git, branch openwrt-21.02:
https://git.openwrt.org/e422a3af6987f3b1d1955a432d344eb65f6152ba

commit e422a3af6987f3b1d1955a432d344eb65f6152ba
Author: Liu Yu <f78fk at live.com>
AuthorDate: Tue Jun 8 09:50:02 2021 +0800

    ramips: fix Ethernet random MAC address for HILINK HLK-7628N
    
    Set the ethernet address from flash.
    
    MAC addresses as verified by OEM firmware:
    
      use   interface  source
      2g    wlan0      factory 0x04 (label)
      LAN   eth0.1     factory 0x28 (label+1)
      WAN   eth0.2     factory 0x2e (label+2)
    
    Fixes: 671c9d16e382 ("ramips: add support for HILINK HLK-7628N")
    
    Signed-off-by: Liu Yu <f78fk at live.com>
    [drop old MAC address setup from 02_network, cut out state_default
    changes, face-lift commit message, add Fixes:]
    Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
    (cherry picked from commit ae9c5cd37bf5c08452f314b54afa963a00bdde30)
---
 target/linux/ramips/dts/mt7628an_hilink_hlk-7628n.dts        | 4 ++++
 target/linux/ramips/mt76x8/base-files/etc/board.d/02_network | 5 +----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/target/linux/ramips/dts/mt7628an_hilink_hlk-7628n.dts b/target/linux/ramips/dts/mt7628an_hilink_hlk-7628n.dts
index 69987b3566..f5106a5080 100644
--- a/target/linux/ramips/dts/mt7628an_hilink_hlk-7628n.dts
+++ b/target/linux/ramips/dts/mt7628an_hilink_hlk-7628n.dts
@@ -80,6 +80,10 @@
 	};
 };
 
+&ethernet {
+	mtd-mac-address = <&factory 0x28>;
+};
+
 &wmac {
 	status = "okay";
 };
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 b741b4f9b4..c55733ad53 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
@@ -168,6 +168,7 @@ ramips_setup_macs()
 		lan_mac=$wan_mac
 		;;
 	cudy,wr1000|\
+	hilink,hlk-7628n|\
 	hilink,hlk-7688a|\
 	wavlink,wl-wn577a2)
 		wan_mac=$(mtd_get_mac_binary factory 0x2e)
@@ -186,10 +187,6 @@ ramips_setup_macs()
 		wan_mac=$(mtd_get_mac_binary factory 0x22)
 		label_mac=$wan_mac
 		;;
-	hilink,hlk-7628n)
-		lan_mac=$(macaddr_setbit_la "$(cat /sys/class/net/eth0/address)")
-		wan_mac=$(macaddr_add "$lan_mac" 1)
-		;;
 	hiwifi,hc5661a|\
 	hiwifi,hc5761a|\
 	hiwifi,hc5861b)



More information about the lede-commits mailing list