summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrii Kuiukoff2026-06-18 10:56:23 +0000
committerJonas Jelonek2026-06-26 09:59:30 +0000
commiteb8cd69f9121196a3c43acdf9af3c372a4a50c93 (patch)
tree3eb25314381c31a35661adce31f7676c495a93c4
parent82d7ed7fbca23f16e361fc6c0b5088c39bcd8fb5 (diff)
downloadopenwrt-eb8cd69f9121196a3c43acdf9af3c372a4a50c93.tar.gz
mediatek: creatlentem clt-r30b1: add all-in-UBI layout
This commit introduces OpenWrt U-Boot all-in-ubi layout support for the CreatLentem CLT-R30B1, enabling: - Fully-featured U-Boot - Effective recovery mechanisms - Prolonged device lifetime by allocating most of the flash to UBI (which takes care of wear-leveling) - Maximum available storage space for OpenWrt - Unified firmware across different device variants OpenWrt U-Boot UBI flash instructions ------------------------------------- Using the installer image ------------------------- To simplify the installation process, this method uses a fork of Daniel Golle's (@dangowrt) UBI Installer https://github.com/dangowrt/owrt-ubi-installer 1. Ensure your router is running the latest generic OpenWrt firmware. Upgrade it if necessary. 2. Obtain the installer image: Build the installer from source https://github.com/andros-ua/owrt-ubi-installer/tree/clt-r30b1 or download a prebuilt image from the https://github.com/andros-ua/owrt-ubi-installer/releases 3. Flash the openwrt*creatlentem_clt-r30b1-ubi-initramfs-recovery-installer.itb image using sysupgrade. 4. Wait for installation: the green status LED will blink rapidly, indicating that the all-in-UBI installer is running. 5. Once the installation finishes, the status LED will turn solid white (lime) for 5 seconds. 6. After the device reboots, perform a final sysupgrade using the openwrt*creatlentem_clt-r30b1-ubi-squashfs-sysupgrade.itb image. Return to stock layout ---------------------- 1. Flash openwrt*creatlentem_clt-r30b1(-112m)-initramfs-kernel.bin via sysupgrade 2. Copy files to /tmp on the device via SCP: BL2.bin u-boot-env.bin Factory.bin FIP.bin openwrt*creatlentem_clt-r30b1(-112m)-squashfs-sysupgrade.bin 3. Restore stock MTD partitions: apk add kmod-mtd-rw insmod mtd-rw i_want_a_brick=1 mtd write /tmp/BL2.bin BL2 mtd write /tmp/u-boot-env.bin u-boot-env mtd write /tmp/Factory.bin Factory mtd write /tmp/FIP.bin FIP 4. Install the system: sysupgrade /tmp/*sysupgrade.bin Recovery -------- Use mtk_uartboot to recover corrupted BL2 or FIP via UART: https://github.com/981213/mtk_uartboot Stock layout ---------------------------------------- | dev: size erasesize name | | mtd0: 00100000 00020000 "BL2" | | mtd1: 00080000 00020000 "u-boot-env" | | mtd2: 00200000 00020000 "Factory" | | mtd3: 00200000 00020000 "FIP" | | mtd4: 07000000 00020000 "ubi" | ---------------------------------------- OpenWrt U-Boot UBI layout ---------------------------------- | dev: size erasesize name | | mtd0: 00100000 00020000 "bl2" | | mtd1: 07f00000 00020000 "ubi" | ---------------------------------- Signed-off-by: Andrii Kuiukoff <andros.ua@gmail.com> Link: #20666 (cherry picked from commit e414ca4) Signed-off-by: Andrii Kuiukoff <andros.ua@gmail.com> Link: https://github.com/openwrt/openwrt/pull/23862 Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
-rw-r--r--package/boot/uboot-mediatek/Makefile13
-rw-r--r--package/boot/uboot-mediatek/patches/473-add-creatlentem_clt-r30b1-ubi.patch311
-rw-r--r--package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic1
-rw-r--r--target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1-112m.dts13
-rw-r--r--target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1-common.dtsi12
-rw-r--r--target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1-ubi.dts89
-rw-r--r--target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1.dts13
-rw-r--r--target/linux/mediatek/filogic/base-files/etc/board.d/02_network1
-rw-r--r--target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh2
-rw-r--r--target/linux/mediatek/image/filogic.mk24
10 files changed, 463 insertions, 16 deletions
diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile
index ffd95daaa4..8a4f1fb61b 100644
--- a/package/boot/uboot-mediatek/Makefile
+++ b/package/boot/uboot-mediatek/Makefile
@@ -315,6 +315,18 @@ define U-Boot/mt7981_comfast_cf-wr632ax
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3-1866
endef
+define U-Boot/mt7981_creatlentem_clt-r30b1-ubi
+ NAME:=CreatLentem CLT-R30B1 (UBI)
+ BUILD_SUBTARGET:=filogic
+ BUILD_DEVICES:=creatlentem_clt-r30b1-ubi
+ UBOOT_CONFIG:=mt7981_creatlentem_clt-r30b1-ubi
+ UBOOT_IMAGE:=u-boot.fip
+ BL2_BOOTDEV:=spim-nand-ubi
+ BL2_SOC:=mt7981
+ BL2_DDRTYPE:=ddr3-1866
+ DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ubi-ddr3-1866
+endef
+
define U-Boot/mt7981_cudy_tr3000-v1
NAME:=Cudy TR3000 v1
BUILD_SUBTARGET:=filogic
@@ -1221,6 +1233,7 @@ UBOOT_TARGETS := \
mt7981_cmcc_rax3000m-nand-ddr3 \
mt7981_cmcc_rax3000m-nand-ddr4 \
mt7981_comfast_cf-wr632ax \
+ mt7981_creatlentem_clt-r30b1-ubi \
mt7981_cudy_tr3000-v1 \
mt7981_cudy_wbr3000uax-v1 \
mt7981_cudy_wr3000e-v1 \
diff --git a/package/boot/uboot-mediatek/patches/473-add-creatlentem_clt-r30b1-ubi.patch b/package/boot/uboot-mediatek/patches/473-add-creatlentem_clt-r30b1-ubi.patch
new file mode 100644
index 0000000000..98c6dd74e7
--- /dev/null
+++ b/package/boot/uboot-mediatek/patches/473-add-creatlentem_clt-r30b1-ubi.patch
@@ -0,0 +1,311 @@
+--- /dev/null
++++ b/configs/mt7981_creatlentem_clt-r30b1-ubi_defconfig
+@@ -0,0 +1,108 @@
++CONFIG_ARM=y
++CONFIG_SYS_HAS_NONCACHED_MEMORY=y
++CONFIG_POSITION_INDEPENDENT=y
++CONFIG_ARCH_MEDIATEK=y
++CONFIG_TEXT_BASE=0x41e00000
++CONFIG_SYS_MALLOC_F_LEN=0x4000
++CONFIG_NR_DRAM_BANKS=1
++CONFIG_DEFAULT_DEVICE_TREE="mt7981-creatlentem-clt-r30b1-ubi"
++CONFIG_OF_LIBFDT_OVERLAY=y
++CONFIG_TARGET_MT7981=y
++CONFIG_SYS_LOAD_ADDR=0x46000000
++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
++CONFIG_DEBUG_UART_BASE=0x11002000
++CONFIG_DEBUG_UART_CLOCK=40000000
++CONFIG_DEBUG_UART=y
++CONFIG_FIT=y
++CONFIG_BOOTDELAY=30
++CONFIG_AUTOBOOT_KEYED=y
++CONFIG_AUTOBOOT_MENU_SHOW=y
++CONFIG_USE_PREBOOT=y
++CONFIG_DEFAULT_FDT_FILE="mt7981-creatlentem-clt-r30b1-ubi"
++CONFIG_LOGLEVEL=7
++CONFIG_PRE_CONSOLE_BUFFER=y
++CONFIG_LOG=y
++# CONFIG_BOARD_INIT is not set
++CONFIG_BOARD_LATE_INIT=y
++CONFIG_HUSH_PARSER=y
++CONFIG_SYS_PROMPT="MT7981> "
++CONFIG_CMD_CPU=y
++CONFIG_CMD_LICENSE=y
++CONFIG_CMD_BOOTMENU=y
++CONFIG_CMD_ASKENV=y
++CONFIG_CMD_ERASEENV=y
++CONFIG_CMD_ENV_FLAGS=y
++CONFIG_CMD_STRINGS=y
++CONFIG_CMD_DM=y
++CONFIG_CMD_GPIO=y
++CONFIG_CMD_GPT=y
++CONFIG_CMD_MTD=y
++CONFIG_CMD_PART=y
++CONFIG_CMD_TFTPSRV=y
++CONFIG_CMD_RARP=y
++CONFIG_CMD_CDP=y
++CONFIG_CMD_SNTP=y
++CONFIG_CMD_LINK_LOCAL=y
++CONFIG_CMD_DHCP=y
++CONFIG_CMD_DNS=y
++CONFIG_CMD_PING=y
++CONFIG_CMD_PXE=y
++CONFIG_CMD_CACHE=y
++CONFIG_CMD_PSTORE=y
++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
++CONFIG_CMD_UUID=y
++CONFIG_CMD_HASH=y
++CONFIG_CMD_SMC=y
++CONFIG_CMD_UBI=y
++CONFIG_CMD_UBI_RENAME=y
++CONFIG_OF_EMBED=y
++CONFIG_ENV_OVERWRITE=y
++CONFIG_ENV_IS_IN_UBI=y
++CONFIG_ENV_REDUNDANT=y
++CONFIG_ENV_UBI_PART="ubi"
++CONFIG_ENV_UBI_VOLUME="ubootenv"
++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
++CONFIG_ENV_RELOC_GD_ENV_ADDR=y
++CONFIG_ENV_USE_DEFAULT_ENV_TEXT_FILE=y
++CONFIG_ENV_DEFAULT_ENV_TEXT_FILE="defenvs/creatlentem_clt-r30b1-ubi_env"
++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
++CONFIG_VERSION_VARIABLE=y
++CONFIG_NETCONSOLE=y
++CONFIG_USE_IPADDR=y
++CONFIG_IPADDR="192.168.1.1"
++CONFIG_USE_SERVERIP=y
++CONFIG_SERVERIP="192.168.1.254"
++CONFIG_NET_RANDOM_ETHADDR=y
++CONFIG_REGMAP=y
++CONFIG_SYSCON=y
++CONFIG_BUTTON=y
++CONFIG_BUTTON_GPIO=y
++CONFIG_CLK=y
++CONFIG_GPIO_HOG=y
++CONFIG_LED=y
++CONFIG_LED_BLINK=y
++CONFIG_LED_GPIO=y
++# CONFIG_MMC is not set
++CONFIG_MTD=y
++CONFIG_DM_MTD=y
++CONFIG_MTD_SPI_NAND=y
++CONFIG_MTD_UBI_FASTMAP=y
++CONFIG_PHY_FIXED=y
++CONFIG_MEDIATEK_ETH=y
++CONFIG_PHY=y
++CONFIG_PINCTRL=y
++CONFIG_PINCONF=y
++CONFIG_PINCTRL_MT7981=y
++CONFIG_POWER_DOMAIN=y
++CONFIG_MTK_POWER_DOMAIN=y
++CONFIG_DM_REGULATOR=y
++CONFIG_DM_REGULATOR_FIXED=y
++CONFIG_DM_REGULATOR_GPIO=y
++CONFIG_RAM=y
++CONFIG_DM_SERIAL=y
++CONFIG_MTK_SERIAL=y
++CONFIG_SPI=y
++CONFIG_DM_SPI=y
++CONFIG_MTK_SPIM=y
++CONFIG_ZSTD=y
++CONFIG_HEXDUMP=y
+--- /dev/null
++++ b/defenvs/creatlentem_clt-r30b1-ubi_env
+@@ -0,0 +1,54 @@
++ipaddr=192.168.1.1
++serverip=192.168.1.254
++loadaddr=0x46000000
++console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
++bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
++bootconf=config-1
++bootdelay=0
++bootfile=openwrt-mediatek-filogic-creatlentem_clt-r30b1-ubi-initramfs-recovery.itb
++bootfile_bl2=openwrt-mediatek-filogic-creatlentem_clt-r30b1-ubi-preloader.bin
++bootfile_fip=openwrt-mediatek-filogic-creatlentem_clt-r30b1-ubi-bl31-uboot.fip
++bootfile_upg=openwrt-mediatek-filogic-creatlentem_clt-r30b1-ubi-squashfs-sysupgrade.itb
++bootled_pwr=red:status
++bootled_rec=green:status
++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
++bootmenu_default=0
++bootmenu_delay=0
++bootmenu_title= ( ( ( OpenWrt ) ) )
++bootmenu_0=Initialize environment.=run _firstboot
++bootmenu_0d=Run default boot command.=run boot_default
++bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
++bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
++bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
++bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
++bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
++bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to NAND.=run boot_tftp_write_fip ; run bootmenu_confirm_return
++bootmenu_7=Load BL2 preloader via TFTP then write to NAND.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
++bootmenu_8=Reboot.=reset
++bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
++boot_first=if button reset ; then led $bootled_pwr off ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
++boot_production=led $bootled_rec off ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
++boot_recovery=led $bootled_pwr off ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
++boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
++boot_tftp_forever=led $bootled_pwr off ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
++boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
++boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run ubi_write_fip && run reset_factory
++boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
++preboot=led $bootled_pwr on ; led $bootled_rec on
++reset_factory=mw $loadaddr 0xff 0x1f000 ; ubi write $loadaddr ubootenv 0x1f000 ; ubi write $loadaddr ubootenv2 0x1f000 ; ubi remove rootfs_data
++mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
++ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x1f000 dynamic ; ubi check ubootenv2 || ubi create ubootenv2 0x1f000 dynamic
++ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi
++ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs
++ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery
++ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
++ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000
++ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
++ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
++_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
++_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first
++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title
++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver"
+--- /dev/null
++++ b/arch/arm/dts/mt7981-creatlentem-clt-r30b1-ubi.dts
+@@ -0,0 +1,140 @@
++// SPDX-License-Identifier: GPL-2.0-or-later
++
++/dts-v1/;
++#include "mt7981.dtsi"
++#include <dt-bindings/gpio/gpio.h>
++#include <dt-bindings/input/linux-event-codes.h>
++
++/ {
++ model = "CreatLentem CLT-R30B1 (UBI)";
++ compatible = "creatlentem,clt-r30b1-ubi", "mediatek,mt7981";
++
++ chosen {
++ stdout-path = &uart0;
++ tick-timer = &timer0;
++ };
++
++ memory@40000000 {
++ device_type = "memory";
++ reg = <0x40000000 0x10000000>;
++ };
++
++ gpio-keys {
++ compatible = "gpio-keys";
++
++ button-reset {
++ label = "reset";
++ linux,code = <KEY_RESTART>;
++ gpios = <&pio 1 GPIO_ACTIVE_LOW>;
++ };
++
++ button-wps {
++ label = "wps";
++ linux,code = <KEY_WPS_BUTTON>;
++ gpios = <&pio 0 GPIO_ACTIVE_LOW>;
++ };
++ };
++
++ gpio-leds {
++ compatible = "gpio-leds";
++
++ led_status_green: led-0 {
++ label = "green:status";
++ gpios = <&pio 11 GPIO_ACTIVE_LOW>;
++ };
++
++ led_status_red: led-1 {
++ label = "red:status";
++ gpios = <&pio 12 GPIO_ACTIVE_LOW>;
++ default-state = "on";
++ };
++ };
++};
++
++&eth {
++ status = "okay";
++ mediatek,gmac-id = <0>;
++ phy-mode = "2500base-x";
++ mediatek,switch = "mt7531";
++ reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>;
++
++ fixed-link {
++ speed = <2500>;
++ full-duplex;
++ };
++};
++
++&pio {
++ spi_flash_pins: spi0-pins-func-1 {
++ mux {
++ function = "flash";
++ groups = "spi0", "spi0_wp_hold";
++ };
++
++ conf-pu {
++ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
++ drive-strength = <MTK_DRIVE_4mA>;
++ bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
++ };
++
++ conf-pd {
++ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
++ drive-strength = <MTK_DRIVE_4mA>;
++ bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
++ };
++ };
++
++ line_8-hog {
++ gpio-hog;
++ gpios = <8 GPIO_ACTIVE_HIGH>;
++ output-low;
++ line-name = "LEDs power";
++ };
++};
++
++&spi0 {
++ #address-cells = <1>;
++ #size-cells = <0>;
++ pinctrl-names = "default";
++ pinctrl-0 = <&spi_flash_pins>;
++ status = "okay";
++ must_tx;
++ enhance_timing;
++ dma_ext;
++ ipm_design;
++ support_quad;
++ tick_dly = <2>;
++ sample_sel = <0>;
++
++ spi_nand@0 {
++ compatible = "spi-nand";
++ reg = <0>;
++ spi-max-frequency = <52000000>;
++
++ partitions {
++ compatible = "fixed-partitions";
++ #address-cells = <1>;
++ #size-cells = <1>;
++
++ partition@0 {
++ label = "bl2";
++ reg = <0x0 0x100000>;
++ };
++
++ partition@100000 {
++ label = "ubi";
++ reg = <0x100000 0x7f00000>;
++ compatible = "linux,ubi";
++ };
++ };
++ };
++};
++
++&uart0 {
++ mediatek,force-highspeed;
++ status = "okay";
++};
++
++&watchdog {
++ status = "disabled";
++};
diff --git a/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic
index e02d786022..aa4b15a5b4 100644
--- a/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic
+++ b/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic
@@ -27,6 +27,7 @@ acer,predator-w6x-ubootmod|\
asus,zenwifi-bt8-ubootmod|\
cmcc,a10-ubootmod|\
comfast,cf-wr632ax-ubootmod|\
+creatlentem,clt-r30b1-ubi|\
cudy,tr3000-v1-ubootmod|\
cudy,wbr3000uax-v1-ubootmod|\
cudy,wr3000e-v1-ubootmod|\
diff --git a/target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1-112m.dts b/target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1-112m.dts
index 36351565eb..c987c76fad 100644
--- a/target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1-112m.dts
+++ b/target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1-112m.dts
@@ -7,9 +7,12 @@
compatible = "creatlentem,clt-r30b1-112m", "mediatek,mt7981";
};
-&partitions {
- partition@580000 {
- label = "ubi";
- reg = <0x0580000 0x7000000>;
- };
+&spi_nand {
+ mediatek,nmbm;
+ mediatek,bmt-max-ratio = <1>;
+ mediatek,bmt-max-reserved-blocks = <64>;
+};
+
+&ubi {
+ reg = <0x0580000 0x7000000>;
};
diff --git a/target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1-common.dtsi b/target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1-common.dtsi
index 6958c174a0..ff55eb3f9f 100644
--- a/target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1-common.dtsi
+++ b/target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1-common.dtsi
@@ -17,7 +17,7 @@
serial0 = &uart0;
};
- chosen {
+ chosen: chosen {
stdout-path = "serial0:115200n8";
};
@@ -109,7 +109,7 @@
pinctrl-0 = <&spi0_flash_pins>;
status = "okay";
- spi_nand@0 {
+ spi_nand: spi-nand@0 {
compatible = "spi-nand";
reg = <0>;
@@ -124,10 +124,6 @@
spi-cal-addrlen = <5>;
spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>;
- mediatek,nmbm;
- mediatek,bmt-max-ratio = <1>;
- mediatek,bmt-max-reserved-blocks = <64>;
-
partitions: partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
@@ -183,6 +179,10 @@
reg = <0x380000 0x200000>;
read-only;
};
+
+ ubi: partition@580000 {
+ label = "ubi";
+ };
};
};
};
diff --git a/target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1-ubi.dts b/target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1-ubi.dts
new file mode 100644
index 0000000000..b4cd51e101
--- /dev/null
+++ b/target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1-ubi.dts
@@ -0,0 +1,89 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "mt7981b-creatlentem-clt-r30b1-common.dtsi"
+
+/ {
+ model = "CreatLentem CLT-R30B1 (UBI)";
+ compatible = "creatlentem,clt-r30b1-ubi", "mediatek,mt7981";
+};
+
+&chosen {
+ bootargs = "root=/dev/fit0 rootwait";
+ rootdisk = <&ubi_rootdisk>;
+};
+
+/delete-node/ &partitions;
+
+&spi_nand {
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "bl2";
+ reg = <0x0 0x100000>;
+ read-only;
+ };
+
+ partition@100000 {
+ label = "ubi";
+ reg = <0x100000 0x7f00000>;
+ compatible = "linux,ubi";
+
+ volumes {
+ ubi_factory: ubi-volume-factory {
+ volname = "factory";
+ };
+
+ 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";
+ };
+ };
+ };
+ };
+ };
+};
+
+&ubi_factory {
+ nvmem-layout {
+ compatible = "fixed-layout";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ eeprom_factory_0: eeprom@0 {
+ reg = <0x0 0x1000>;
+ };
+
+ macaddr_factory_4: macaddr@4 {
+ reg = <0x4 0x6>;
+ compatible = "mac-base";
+ #nvmem-cell-cells = <1>;
+ };
+
+ macaddr_factory_24: macaddr@24 {
+ compatible = "mac-base";
+ reg = <0x24 0x6>;
+ #nvmem-cell-cells = <1>;
+ };
+
+ macaddr_factory_2a: macaddr@2a {
+ compatible = "mac-base";
+ reg = <0x2a 0x6>;
+ #nvmem-cell-cells = <1>;
+ };
+ };
+};
diff --git a/target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1.dts b/target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1.dts
index 941d0c3435..9b38fd8cc2 100644
--- a/target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1.dts
+++ b/target/linux/mediatek/dts/mt7981b-creatlentem-clt-r30b1.dts
@@ -8,13 +8,18 @@
};
&partitions {
- partition@580000 {
- label = "ubi";
- reg = <0x0580000 0x4000000>;
- };
partition@4580000 {
label = "data";
reg = <0x4580000 0x2000000>;
};
+};
+
+&spi_nand {
+ mediatek,nmbm;
+ mediatek,bmt-max-ratio = <1>;
+ mediatek,bmt-max-reserved-blocks = <64>;
+};
+&ubi {
+ reg = <0x0580000 0x4000000>;
};
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 5a13c4f5a7..65a4fcecba 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
@@ -51,6 +51,7 @@ mediatek_setup_interfaces()
confiabits,mt7981|\
creatlentem,clt-r30b1|\
creatlentem,clt-r30b1-112m|\
+ creatlentem,clt-r30b1-ubi|\
cudy,wr3000-v1|\
huasifei,wh3000r-nand|\
jcg,q30-pro|\
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 49562a0def..24412b905f 100644
--- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
@@ -91,6 +91,7 @@ platform_do_upgrade() {
cmcc,a10-ubootmod|\
cmcc,rax3000m|\
comfast,cf-wr632ax-ubootmod|\
+ creatlentem,clt-r30b1-ubi|\
cudy,tr3000-v1-ubootmod|\
cudy,wbr3000uax-v1-ubootmod|\
cudy,wr3000e-v1-ubootmod|\
@@ -295,6 +296,7 @@ platform_check_image() {
cmcc,a10-ubootmod|\
cmcc,rax3000m|\
comfast,cf-wr632ax-ubootmod|\
+ creatlentem,clt-r30b1-ubi|\
cudy,tr3000-v1-ubootmod|\
cudy,wbr3000uax-v1-ubootmod|\
cudy,wr3000e-v1-ubootmod|\
diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
index 0571316257..45deff7b42 100644
--- a/target/linux/mediatek/image/filogic.mk
+++ b/target/linux/mediatek/image/filogic.mk
@@ -1028,7 +1028,6 @@ define Device/creatlentem_clt-r30b1-common
BLOCKSIZE := 128k
PAGESIZE := 2048
KERNEL_IN_UBI := 1
- IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
define Device/creatlentem_clt-r30b1-112m
@@ -1039,6 +1038,7 @@ define Device/creatlentem_clt-r30b1-112m
DEVICE_DTS := mt7981b-creatlentem-clt-r30b1-112m
SUPPORTED_DEVICES += clt,r30b1 clt,r30b1-112m
IMAGE_SIZE := 114688k
+ IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
$(call Device/creatlentem_clt-r30b1-common)
endef
TARGET_DEVICES += creatlentem_clt-r30b1-112m
@@ -1047,10 +1047,32 @@ define Device/creatlentem_clt-r30b1
DEVICE_DTS := mt7981b-creatlentem-clt-r30b1
SUPPORTED_DEVICES += mediatek,mt7981-spim-snand-rfb
IMAGE_SIZE := 65536k
+ IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
$(call Device/creatlentem_clt-r30b1-common)
endef
TARGET_DEVICES += creatlentem_clt-r30b1
+define Device/creatlentem_clt-r30b1-ubi
+ DEVICE_VARIANT := (UBI)
+ DEVICE_ALT0_VARIANT := (UBI)
+ DEVICE_ALT1_VARIANT := (UBI)
+ DEVICE_ALT2_VARIANT := (UBI)
+ DEVICE_DTS := mt7981b-creatlentem-clt-r30b1-ubi
+ UBOOTENV_IN_UBI := 1
+ IMAGES := sysupgrade.itb
+ KERNEL_INITRAMFS_SUFFIX := -recovery.itb
+ KERNEL := kernel-bin | 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-ubi-ddr3-1866
+ ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot creatlentem_clt-r30b1-ubi
+ $(call Device/creatlentem_clt-r30b1-common)
+endef
+TARGET_DEVICES += creatlentem_clt-r30b1-ubi
+
define Device/cudy_ap3000outdoor-v1
DEVICE_VENDOR := Cudy
DEVICE_MODEL := AP3000 Outdoor