From 5509ae287ee738e75b57eeb46b617f3d99517b18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= Date: Mon, 12 Jul 2021 15:26:10 +0200 Subject: [PATCH] Add support for Xiaomi Mi Router 4A (100m) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This currently includes a patch to add the label-mac alias in the devices DTS file, which is also submitted upstream. Signed-off-by: Fabian Bläse Reviewed-by: Christian Dresel Tested-by: Fabian Bläse --- bsp/ramips-mt76x8.bsp | 1 + bsp/ramips-mt76x8/.config | 2 ++ ...issing-label-mac-device-mi-router-4a.patch | 25 +++++++++++++++++++ .../files/lib/functions/fff/cpuport | 3 ++- .../files/lib/functions/fff/portorder | 3 +++ .../mipsel/network.xiaomi,mi-router-4a-100m | 7 ++++++ 6 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 build_patches/openwrt/0010-ramips-add-missing-label-mac-device-mi-router-4a.patch create mode 100644 src/packages/fff/fff-network/mipsel/network.xiaomi,mi-router-4a-100m diff --git a/bsp/ramips-mt76x8.bsp b/bsp/ramips-mt76x8.bsp index b4fe204..682f8fd 100644 --- a/bsp/ramips-mt76x8.bsp +++ b/bsp/ramips-mt76x8.bsp @@ -3,4 +3,5 @@ subtarget=mt76x8 images=("openwrt-${chipset}-${subtarget}-tplink_archer-c50-v3-squashfs-*" "openwrt-${chipset}-${subtarget}-tplink_archer-c50-v4-squashfs-*" "openwrt-${chipset}-${subtarget}-tplink_tl-wr841n-v13-squashfs-*" + "openwrt-${chipset}-${subtarget}-xiaomi_mi-router-4a-100m-squashfs-*" ) diff --git a/bsp/ramips-mt76x8/.config b/bsp/ramips-mt76x8/.config index cf0cc1c..59ec0a4 100644 --- a/bsp/ramips-mt76x8/.config +++ b/bsp/ramips-mt76x8/.config @@ -10,6 +10,8 @@ CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_archer-c50-v4=y CONFIG_TARGET_DEVICE_PACKAGES_ramips_mt76x8_DEVICE_tplink_archer-c50-v4="" CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_tl-wr841n-v13=y CONFIG_TARGET_DEVICE_PACKAGES_ramips_mt76x8_DEVICE_tplink_tl-wr841n-v13="" +CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_xiaomi_mi-router-4a-100m=y +CONFIG_TARGET_DEVICE_PACKAGES_ramips_mt76x8_DEVICE_xiaomi_mi-router-4a-100m="" CONFIG_BUSYBOX_CUSTOM=y CONFIG_TARGET_PER_DEVICE_ROOTFS=y # CONFIG_BUSYBOX_CONFIG_BRCTL is not set diff --git a/build_patches/openwrt/0010-ramips-add-missing-label-mac-device-mi-router-4a.patch b/build_patches/openwrt/0010-ramips-add-missing-label-mac-device-mi-router-4a.patch new file mode 100644 index 0000000..00e8086 --- /dev/null +++ b/build_patches/openwrt/0010-ramips-add-missing-label-mac-device-mi-router-4a.patch @@ -0,0 +1,25 @@ +From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= +Date: Mon, 19 Jul 2021 21:54:29 +0200 +Subject: [PATCH] ramips: add missing label-mac-device for Xiaomi Mi Router 4A + (100M) + +As both the Mi Router 4A (100M) and the Mi Router 4C use the same +label-mac-device, the alias can be moved to the shared dtsi. + +Signed-off-by: Fabian Bläse +--- + target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4.dtsi | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4.dtsi b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4.dtsi +index 0f5897f5c593..d3f5e33be732 100644 +--- a/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4.dtsi ++++ b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4.dtsi +@@ -11,6 +11,7 @@ + led-failsafe = &led_power_yellow; + led-running = &led_power_blue; + led-upgrade = &led_power_yellow; ++ label-mac-device = ðernet; + }; + + chosen { diff --git a/src/packages/fff/fff-network/files/lib/functions/fff/cpuport b/src/packages/fff/fff-network/files/lib/functions/fff/cpuport index 5a15f1c..7ae37c2 100644 --- a/src/packages/fff/fff-network/files/lib/functions/fff/cpuport +++ b/src/packages/fff/fff-network/files/lib/functions/fff/cpuport @@ -11,7 +11,8 @@ get_cpu_port() { tplink,archer-c50-v4|\ tplink,tl-wr1043nd-v2|\ tplink,tl-wr1043nd-v3|\ - tplink,tl-wr841n-v13) + tplink,tl-wr841n-v13|\ + xiaomi,mi-router-4a-100m) CPUPORT="6t" ;; netgear,r6220|\ diff --git a/src/packages/fff/fff-network/files/lib/functions/fff/portorder b/src/packages/fff/fff-network/files/lib/functions/fff/portorder index ff70405..45f094f 100644 --- a/src/packages/fff/fff-network/files/lib/functions/fff/portorder +++ b/src/packages/fff/fff-network/files/lib/functions/fff/portorder @@ -42,6 +42,9 @@ get_port_order() { tplink,tl-wr841-v8) PORTORDER="2 3 4 1" ;; + xiaomi,mi-router-4a-100m) + PORTORDER="0 2 4" + ;; esac echo "$PORTORDER" diff --git a/src/packages/fff/fff-network/mipsel/network.xiaomi,mi-router-4a-100m b/src/packages/fff/fff-network/mipsel/network.xiaomi,mi-router-4a-100m new file mode 100644 index 0000000..54240e6 --- /dev/null +++ b/src/packages/fff/fff-network/mipsel/network.xiaomi,mi-router-4a-100m @@ -0,0 +1,7 @@ +. /lib/functions/fff/network + +WANDEV=eth0 +SWITCHDEV=eth0 +CLIENT_PORTS="6t 4" +WAN_PORTS="6t 0" +BATMAN_PORTS="6t 2"