ipq40xx: use correct wired MAC-addresses for RUTX50
authorDavid Bauer <mail@david-bauer.net>
Mon, 13 Jan 2025 14:18:31 +0000 (15:18 +0100)
committerDavid Bauer <mail@david-bauer.net>
Mon, 13 Jan 2025 14:18:31 +0000 (15:18 +0100)
The Teltonika RUTX50 mac-addresses on its wired interfaces are currently
random on every boot.

Setting the mac-addresses from device-tree using nvmem does not work, as
the vendor bootloader mangles the mtd partitions, removing the
nvmem-cells property.

To remedy the random mac-addresse, set the correct ones in preinit.

Signed-off-by: David Bauer <mail@david-bauer.net>
target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh

index 1ede544aacc3b0fb294295f65b6b361b42cfd6c9..092f9da4407b21cabaac1bd86f087a9b5dc1f6f2 100644 (file)
@@ -43,6 +43,17 @@ preinit_set_mac_address() {
                ip link set dev sw-eth1 address "$base_mac"
                ip link set dev sw-eth2 address $(macaddr_add "$base_mac" 1)
                ;;
+       teltonika,rutx50)
+               # Vendor Bootloader removes nvmem-cells from partition,
+               # so this needs to be done here.
+               base_mac="$(mtd_get_mac_binary 0:CONFIG 0x0)"
+               ip link set dev eth0 address "$base_mac"
+               ip link set dev lan1 address "$base_mac"
+               ip link set dev lan2 address "$base_mac"
+               ip link set dev lan3 address "$base_mac"
+               ip link set dev lan4 address "$base_mac"
+               ip link set dev wan address "$(macaddr_add "$base_mac" 1)"
+               ;;
        zyxel,nbg6617)
                base_mac=$(cat /sys/class/net/eth0/address)
                ip link set dev eth0 address $(macaddr_add "$base_mac" 2)