[PATCH 2/2] mediatek: filogic: add Tenbay WR3000K (OpenWrt U-Boot layout) support
sinigal1099 at gmail.com
sinigal1099 at gmail.com
Fri Oct 9 05:15:43 PDT 2026
From: Павел Буев <sinigal1099 at gmail.com>
Add a ubootmod variant of the Tenbay WR3000K which replaces the vendor
boot chain with OpenWrt U-Boot, in the same way as done for the Xiaomi
Mi Router AX3000T:
- split the board DTS into a shared dtsi keeping the BL2, u-boot-env,
Factory (caldata/MAC) and FIP partitions, while the stock variant
adds NMBM and the vendor ubi/ubi1/Product/Custom partitions
- the ubootmod variant uses a single ubi partition at 0x580000
spanning the rest of the flash (0x7a80000) holding the fit (kernel),
recovery and rootfs_data UBI volumes; U-Boot environment lives in
redundant UBI volumes
- install/upgrade via initramfs-recovery.itb and sysupgrade.itb with
kernel and rootfs packed in one FIT image
The vendor layout stays available as the existing tenbay,wr3000k
(-stock) device.
Signed-off-by: Павел Буев <sinigal1099 at gmail.com>
---
.../dts/mt7981b-tenbay-wr3000k-ubootmod.dts | 42 +++
.../mediatek/dts/mt7981b-tenbay-wr3000k.dts | 247 ++----------------
.../mediatek/dts/mt7981b-tenbay-wr3000k.dtsi | 220 ++++++++++++++++
.../filogic/base-files/etc/board.d/02_network | 1 +
.../base-files/lib/upgrade/platform.sh | 2 +
target/linux/mediatek/image/filogic.mk | 30 +++
6 files changed, 314 insertions(+), 228 deletions(-)
create mode 100644 target/linux/mediatek/dts/mt7981b-tenbay-wr3000k-ubootmod.dts
create mode 100644 target/linux/mediatek/dts/mt7981b-tenbay-wr3000k.dtsi
diff --git a/target/linux/mediatek/dts/mt7981b-tenbay-wr3000k-ubootmod.dts b/target/linux/mediatek/dts/mt7981b-tenbay-wr3000k-ubootmod.dts
new file mode 100644
index 00000000..45c3b973
--- /dev/null
+++ b/target/linux/mediatek/dts/mt7981b-tenbay-wr3000k-ubootmod.dts
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+/dts-v1/;
+#include "mt7981b-tenbay-wr3000k.dtsi"
+
+/ {
+ model = "Tenbay WR3000K (OpenWrt U-Boot layout)";
+ compatible = "tenbay,wr3000k-ubootmod", "mediatek,mt7981";
+
+ chosen {
+ bootargs-append = " root=/dev/fit0 rootwait";
+ rootdisk = <&ubi_rootdisk>;
+ };
+};
+
+&partitions {
+ partition at 580000 {
+ label = "ubi";
+ reg = <0x580000 0x7a80000>;
+ compatible = "linux,ubi";
+
+ volumes {
+ ubi_rootdisk: ubi-volume-fit {
+ volname = "fit";
+ };
+
+ ubi-volume-ubootenv {
+ volname = "ubootenv";
+ nvmem-layout {
+ compatible = "u-boot,env-redundant-bool";
+ };
+ };
+
+ ubi-volume-ubootenv2 {
+ volname = "ubootenv2";
+ nvmem-layout {
+ compatible = "u-boot,env-redundant-bool";
+ };
+ };
+ };
+ };
+};
diff --git a/target/linux/mediatek/dts/mt7981b-tenbay-wr3000k.dts b/target/linux/mediatek/dts/mt7981b-tenbay-wr3000k.dts
index 1d6ac14e..1b719c0b 100644
--- a/target/linux/mediatek/dts/mt7981b-tenbay-wr3000k.dts
+++ b/target/linux/mediatek/dts/mt7981b-tenbay-wr3000k.dts
@@ -1,247 +1,38 @@
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
/dts-v1/;
-#include "mt7981b.dtsi"
+#include "mt7981b-tenbay-wr3000k.dtsi"
/ {
model = "Tenbay WR3000K";
compatible = "tenbay,wr3000k", "mediatek,mt7981";
-
- aliases {
- led-boot = &led_run;
- led-failsafe = &led_blue;
- led-running = &led_green;
- led-upgrade = &led_blue;
- serial0 = &uart0;
- label-mac-device = &wan;
- };
-
- chosen {
- stdout-path = "serial0:115200n8";
- };
-
- gpio-keys {
- compatible = "gpio-keys";
-
- reset {
- label = "reset";
- linux,code = <KEY_RESTART>;
- gpios = <&pio 1 GPIO_ACTIVE_LOW>;
- };
-
- wps {
- label = "wps";
- linux,code = <KEY_WPS_BUTTON>;
- gpios = <&pio 0 GPIO_ACTIVE_LOW>;
- };
- };
-
- leds {
- compatible = "gpio-leds";
-
- led_run: led-0 {
- color = <LED_COLOR_ID_RED>;
- function = LED_FUNCTION_STATUS;
- gpios = <&pio 10 GPIO_ACTIVE_LOW>;
- };
-
- led_green: led-1 {
- color = <LED_COLOR_ID_GREEN>;
- function = LED_FUNCTION_STATUS;
- gpios = <&pio 11 GPIO_ACTIVE_LOW>;
- };
-
- led_blue: led-2 {
- color = <LED_COLOR_ID_BLUE>;
- function = LED_FUNCTION_STATUS;
- gpios = <&pio 12 GPIO_ACTIVE_LOW>;
- };
- };
-};
-
-&uart0 {
- status = "okay";
};
-&watchdog {
- status = "okay";
+&spi_nand {
+ mediatek,nmbm;
+ mediatek,bmt-max-ratio = <1>;
+ mediatek,bmt-max-reserved-blocks = <64>;
};
-ð {
- pinctrl-names = "default";
- pinctrl-0 = <&mdio_pins>;
- status = "okay";
-
- gmac0: mac at 0 {
- compatible = "mediatek,eth-mac";
- reg = <0>;
- phy-mode = "2500base-x";
- nvmem-cells = <&macaddr_factory_4 (-1)>;
- nvmem-cell-names = "mac-address";
-
- fixed-link {
- speed = <2500>;
- full-duplex;
- pause;
- };
+&partitions {
+ partition at 580000 {
+ label = "ubi";
+ compatible = "linux,ubi";
+ reg = <0x580000 0x3000000>;
};
-};
-
-&mdio_bus {
- switch: switch at 1f {
- compatible = "mediatek,mt7531";
- reg = <31>;
- reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>;
- interrupt-controller;
- #interrupt-cells = <1>;
- interrupt-parent = <&pio>;
- interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
- };
-};
-
-&switch {
- ports {
- #address-cells = <1>;
- #size-cells = <0>;
-
- port at 0 {
- reg = <0>;
- label = "lan1";
- };
- port at 1 {
- reg = <1>;
- label = "lan2";
- };
-
- port at 2 {
- reg = <2>;
- label = "lan3";
- };
-
- wan: port at 3 {
- reg = <3>;
- label = "wan";
- nvmem-cells = <&macaddr_factory_4 (-2)>;
- nvmem-cell-names = "mac-address";
- };
-
- port at 6 {
- reg = <6>;
- ethernet = <&gmac0>;
- phy-mode = "2500base-x";
-
- fixed-link {
- speed = <2500>;
- full-duplex;
- pause;
- };
- };
+ partition at 3580000 {
+ label = "ubi1";
+ reg = <0x3580000 0x3000000>;
};
-};
-
-&spi0 {
- pinctrl-names = "default";
- pinctrl-0 = <&spi0_flash_pins>;
- status = "okay";
-
- flash at 0 {
- compatible = "spi-nand";
- reg = <0>;
- spi-max-frequency = <52000000>;
-
- spi-cal-enable;
- spi-cal-mode = "read-data";
- spi-cal-datalen = <7>;
- spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>;
- spi-cal-addrlen = <5>;
- spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>;
-
- spi-tx-bus-width = <4>;
- spi-rx-bus-width = <4>;
- mediatek,nmbm;
- mediatek,bmt-max-ratio = <1>;
- mediatek,bmt-max-reserved-blocks = <64>;
-
- partitions {
- compatible = "fixed-partitions";
- #address-cells = <1>;
- #size-cells = <1>;
-
- partition at 0 {
- label = "BL2";
- reg = <0x00000 0x0100000>;
- read-only;
- };
-
- partition at 100000 {
- label = "u-boot-env";
- reg = <0x0100000 0x0080000>;
- };
- partition at 180000 {
- label = "Factory";
- reg = <0x180000 0x0200000>;
- read-only;
-
- nvmem-layout {
- compatible = "fixed-layout";
- #address-cells = <1>;
- #size-cells = <1>;
-
- eeprom_factory_0: eeprom at 0 {
- reg = <0x0 0x1000>;
- };
-
- macaddr_factory_4: macaddr at 4 {
- compatible = "mac-base";
- reg = <0x4 0x6>;
- #nvmem-cell-cells = <1>;
- };
- };
- };
-
- partition at 380000 {
- label = "FIP";
- reg = <0x380000 0x0200000>;
- read-only;
- };
-
- partition at 580000 {
- label = "ubi";
- compatible = "linux,ubi";
- reg = <0x580000 0x3000000>;
- };
-
- partition at 3580000 {
- label = "ubi1";
- reg = <0x3580000 0x3000000>;
- };
-
- partition at 6580000 {
- label = "Product";
- reg = <0x6580000 0x0020000>; // 128 KB
- };
-
- partition at 65a0000 {
- label = "Custom";
- reg = <0x65a0000 0x1000000>; // 16 MB
- };
- };
+ partition at 6580000 {
+ label = "Product";
+ reg = <0x6580000 0x0020000>;
};
-};
-&pio {
- spi0_flash_pins: spi0-pins {
- mux {
- function = "spi";
- groups = "spi0", "spi0_wp_hold";
- };
+ partition at 65a0000 {
+ label = "Custom";
+ reg = <0x65a0000 0x1000000>;
};
};
-
-&wifi {
- nvmem-cells = <&eeprom_factory_0>;
- nvmem-cell-names = "eeprom";
- status = "okay";
-};
diff --git a/target/linux/mediatek/dts/mt7981b-tenbay-wr3000k.dtsi b/target/linux/mediatek/dts/mt7981b-tenbay-wr3000k.dtsi
new file mode 100644
index 00000000..0d44cb84
--- /dev/null
+++ b/target/linux/mediatek/dts/mt7981b-tenbay-wr3000k.dtsi
@@ -0,0 +1,220 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+/dts-v1/;
+#include "mt7981b.dtsi"
+
+/ {
+ aliases {
+ led-boot = &led_run;
+ led-failsafe = &led_blue;
+ led-running = &led_green;
+ led-upgrade = &led_blue;
+ serial0 = &uart0;
+ label-mac-device = &wan;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ gpio-keys {
+ compatible = "gpio-keys";
+
+ reset {
+ label = "reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&pio 1 GPIO_ACTIVE_LOW>;
+ };
+
+ wps {
+ label = "wps";
+ linux,code = <KEY_WPS_BUTTON>;
+ gpios = <&pio 0 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led_run: led-0 {
+ color = <LED_COLOR_ID_RED>;
+ function = LED_FUNCTION_STATUS;
+ gpios = <&pio 10 GPIO_ACTIVE_LOW>;
+ };
+
+ led_green: led-1 {
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_STATUS;
+ gpios = <&pio 11 GPIO_ACTIVE_LOW>;
+ };
+
+ led_blue: led-2 {
+ color = <LED_COLOR_ID_BLUE>;
+ function = LED_FUNCTION_STATUS;
+ gpios = <&pio 12 GPIO_ACTIVE_LOW>;
+ };
+ };
+};
+
+&uart0 {
+ status = "okay";
+};
+
+&watchdog {
+ status = "okay";
+};
+
+ð {
+ pinctrl-names = "default";
+ pinctrl-0 = <&mdio_pins>;
+ status = "okay";
+
+ gmac0: mac at 0 {
+ compatible = "mediatek,eth-mac";
+ reg = <0>;
+ phy-mode = "2500base-x";
+ nvmem-cells = <&macaddr_factory_4 (-1)>;
+ nvmem-cell-names = "mac-address";
+
+ fixed-link {
+ speed = <2500>;
+ full-duplex;
+ pause;
+ };
+ };
+};
+
+&mdio_bus {
+ switch: switch at 1f {
+ compatible = "mediatek,mt7531";
+ reg = <31>;
+ reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ interrupt-parent = <&pio>;
+ interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
+ };
+};
+
+&switch {
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port at 0 {
+ reg = <0>;
+ label = "lan1";
+ };
+
+ port at 1 {
+ reg = <1>;
+ label = "lan2";
+ };
+
+ port at 2 {
+ reg = <2>;
+ label = "lan3";
+ };
+
+ wan: port at 3 {
+ reg = <3>;
+ label = "wan";
+ nvmem-cells = <&macaddr_factory_4 (-2)>;
+ nvmem-cell-names = "mac-address";
+ };
+
+ port at 6 {
+ reg = <6>;
+ ethernet = <&gmac0>;
+ phy-mode = "2500base-x";
+
+ fixed-link {
+ speed = <2500>;
+ full-duplex;
+ pause;
+ };
+ };
+ };
+};
+
+&spi0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi0_flash_pins>;
+ status = "okay";
+
+ spi_nand: flash at 0 {
+ compatible = "spi-nand";
+ reg = <0>;
+ spi-max-frequency = <52000000>;
+
+ spi-cal-enable;
+ spi-cal-mode = "read-data";
+ spi-cal-datalen = <7>;
+ spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>;
+ spi-cal-addrlen = <5>;
+ spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>;
+
+ spi-tx-bus-width = <4>;
+ spi-rx-bus-width = <4>;
+
+ partitions: partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition at 0 {
+ label = "BL2";
+ reg = <0x00000 0x0100000>;
+ read-only;
+ };
+
+ partition at 100000 {
+ label = "u-boot-env";
+ reg = <0x0100000 0x0080000>;
+ };
+
+ partition at 180000 {
+ label = "Factory";
+ reg = <0x180000 0x0200000>;
+ read-only;
+
+ nvmem-layout {
+ compatible = "fixed-layout";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ eeprom_factory_0: eeprom at 0 {
+ reg = <0x0 0x1000>;
+ };
+
+ macaddr_factory_4: macaddr at 4 {
+ compatible = "mac-base";
+ reg = <0x4 0x6>;
+ #nvmem-cell-cells = <1>;
+ };
+ };
+ };
+
+ partition at 380000 {
+ label = "FIP";
+ reg = <0x380000 0x0200000>;
+ read-only;
+ };
+ };
+ };
+};
+
+&pio {
+ spi0_flash_pins: spi0-pins {
+ mux {
+ function = "spi";
+ groups = "spi0", "spi0_wp_hold";
+ };
+ };
+};
+
+&wifi {
+ nvmem-cells = <&eeprom_factory_0>;
+ nvmem-cell-names = "eeprom";
+ status = "okay";
+};
diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
index 73d929f6..da294acd 100644
--- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
+++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
@@ -78,6 +78,7 @@ mediatek_setup_interfaces()
routerich,ax3000-ubootmod|\
routerich,be7200|\
tenbay,wr3000k|\
+ tenbay,wr3000k-ubootmod|\
teralink,tl3020-256mb)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan
;;
diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
index cd29adb2..841eabde 100644
--- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
@@ -210,6 +210,7 @@ platform_do_upgrade() {
routerich,ax3000-ubootmod|\
routerich,be7200|\
snr,snr-cpe-ax2|\
+ tenbay,wr3000k-ubootmod|\
teralink,tl3020-256mb|\
tplink,be450-ubi|\
tplink,tl-7dr7230*|\
@@ -461,6 +462,7 @@ platform_check_image() {
qihoo,360t7|\
qihoo,360t7-ubi|\
routerich,ax3000-ubootmod|\
+ tenbay,wr3000k-ubootmod|\
teralink,tl3020-256mb|\
tplink,be450-ubi|\
tplink,tl-7dr7230*|\
diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
index c1ff617b..fe9f46de 100644
--- a/target/linux/mediatek/image/filogic.mk
+++ b/target/linux/mediatek/image/filogic.mk
@@ -3632,6 +3632,36 @@ define Device/tenda_be12-pro
endef
TARGET_DEVICES += tenda_be12-pro
+define Device/tenbay_wr3000k-ubootmod
+ DEVICE_VENDOR := Tenbay
+ DEVICE_MODEL := WR3000K (OpenWrt U-Boot layout)
+ DEVICE_DTS := mt7981b-tenbay-wr3000k-ubootmod
+ DEVICE_DTS_DIR := ../dts
+ UBINIZE_OPTS := -E 5
+ BLOCKSIZE := 128k
+ PAGESIZE := 2048
+ DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware
+ KERNEL_IN_UBI := 1
+ UBOOTENV_IN_UBI := 1
+ IMAGES := sysupgrade.itb
+ KERNEL_INITRAMFS_SUFFIX := -recovery.itb
+ KERNEL := kernel-bin | libdeflate-gzip
+ KERNEL_INITRAMFS := kernel-bin | lzma | \
+ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
+ IMAGE/sysupgrade.itb := append-kernel | \
+ fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata
+ ARTIFACTS := preloader.bin bl31-uboot.fip
+ ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3
+ ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot tenbay_wr3000k
+ifeq ($(IB),)
+ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
+ ARTIFACTS += initramfs-factory.ubi
+ ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel
+endif
+endif
+endef
+TARGET_DEVICES += tenbay_wr3000k-ubootmod
+
define Device/teralink_tl3020-256mb
DEVICE_VENDOR := Teralink
DEVICE_MODEL := TL3020
--
2.56.0
More information about the openwrt-devel
mailing list