ipq806x: move ASRock G10 fix mac preinit script to generic board.d script
authorChristian Marangi <ansuelsmth@gmail.com>
Tue, 20 Jun 2023 07:57:07 +0000 (09:57 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Sat, 30 Sep 2023 11:51:19 +0000 (13:51 +0200)
Drop and move ASRock G10 preinit script to fix mac address to generic
board.d script and rework for consistency with other devices following a
similar implementation.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
target/linux/ipq806x/base-files/etc/board.d/02_network
target/linux/ipq806x/base-files/lib/preinit/05_set_iface_mac_ipq806x.sh [deleted file]

index d64805b8f5e4319f694d526116f888b4a78a19d0..3ba3ff79e9e2b7faa8a39b4308e06b627060d1d0 100644 (file)
@@ -83,6 +83,12 @@ ipq806x_setup_macs()
                        ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 2)"
                        ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 3)"
                ;;
+               asrock,g10)
+                       hw_mac_addr=$(mtd_get_mac_ascii hwconfig HW.LAN.MAC.Address)
+                       ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
+                       hw_mac_addr=$(mtd_get_mac_ascii hwconfig HW.WAN.MAC.Address)
+                       ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
+               ;;
        esac
 }
 
diff --git a/target/linux/ipq806x/base-files/lib/preinit/05_set_iface_mac_ipq806x.sh b/target/linux/ipq806x/base-files/lib/preinit/05_set_iface_mac_ipq806x.sh
deleted file mode 100644 (file)
index ca8d0b1..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-. /lib/functions.sh
-
-preinit_set_mac_address() {
-       case $(board_name) in
-       asrock,g10)
-               lan_mac=$(mtd_get_mac_ascii hwconfig HW.LAN.MAC.Address)
-               wan_mac=$(mtd_get_mac_ascii hwconfig HW.WAN.MAC.Address)
-               ip link set dev eth0 address "${lan_mac}"
-               ip link set dev eth1 address "${wan_mac}"
-               ;;
-       esac
-}
-
-boot_hook_add preinit_main preinit_set_mac_address