From: Ahmed Naseef Date: Fri, 24 Jul 2026 03:52:07 +0000 (+0400) Subject: econet: en7528: add UBI support to DASAN H660GM-A X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F24398%2Fhead;p=thirdparty%2Fopenwrt.git econet: en7528: add UBI support to DASAN H660GM-A Move the DASAN H660GM-A root filesystem from a raw squashfs in the tclinux partition to UBI, following the layout already used by the en751221 ChinaMobile GS3101. tclinux is split into an explicit 4MB tclinux_kernel partition holding the raw LZMA kernel and a tclinux_rootfs partition covering the remainder. The latter is concatenated with the unused "unknown" partition into a single UBI volume, giving 153MB on the Airtel variant and 41MB on the Generic one. The two regions are not adjacent, so this needs mtd virtual concat, which is enabled for the subtarget. The TRX plus UBI image recipe is identical to the one the GS3101 uses, so factor it out into a Device/tclinux-ubi template instead of duplicating it. The .trx is written linearly into tclinux by the vendor installer, so an oversized image would run past its end into tclinux_slave and destroy the vendor firmware in the alternate slot. FACTORY_SIZE guards against this and is set to the size of the partition the .trx is written into. Existing installations have to be reflashed with the .trx rather than sysupgraded, since the ubi MTD only appears once the new device tree is running. Signed-off-by: Ahmed Naseef Link: https://github.com/openwrt/openwrt/pull/24398 Signed-off-by: Jonas Jelonek --- diff --git a/target/linux/econet/base-files/lib/upgrade/platform.sh b/target/linux/econet/base-files/lib/upgrade/platform.sh index f84786504cc..e1f91a9aa9a 100644 --- a/target/linux/econet/base-files/lib/upgrade/platform.sh +++ b/target/linux/econet/base-files/lib/upgrade/platform.sh @@ -2,7 +2,9 @@ platform_check_image() { local board=$(board_name) case "$board" in - chinamobile,gs3101) + chinamobile,gs3101|\ + dasan,h660gm-a-airtel|\ + dasan,h660gm-a-generic) return 0 ;; esac @@ -14,7 +16,9 @@ platform_do_upgrade() { local board=$(board_name) case "$board" in - chinamobile,gs3101) + chinamobile,gs3101|\ + dasan,h660gm-a-airtel|\ + dasan,h660gm-a-generic) CI_KERNPART="tclinux_kernel" nand_do_upgrade "$1" ;; diff --git a/target/linux/econet/dts/en7528_dasan_h660gm-a-airtel.dts b/target/linux/econet/dts/en7528_dasan_h660gm-a-airtel.dts index cb30326add3..d522648ca8c 100644 --- a/target/linux/econet/dts/en7528_dasan_h660gm-a-airtel.dts +++ b/target/linux/econet/dts/en7528_dasan_h660gm-a-airtel.dts @@ -45,7 +45,8 @@ }; &partitions { - partition@60c0000 { + /* Concatenated with tclinux_rootfs to form the UBI volume */ + root1: partition@60c0000 { label = "unknown"; reg = <0x60c0000 0x7d00000>; }; diff --git a/target/linux/econet/dts/en7528_dasan_h660gm-a-generic.dts b/target/linux/econet/dts/en7528_dasan_h660gm-a-generic.dts index 8e536383a4c..7f03b73028b 100644 --- a/target/linux/econet/dts/en7528_dasan_h660gm-a-generic.dts +++ b/target/linux/econet/dts/en7528_dasan_h660gm-a-generic.dts @@ -83,7 +83,8 @@ }; &partitions { - partition@60c0000 { + /* Concatenated with tclinux_rootfs to form the UBI volume */ + root1: partition@60c0000 { label = "unknown"; reg = <0x60c0000 0xd00000>; }; diff --git a/target/linux/econet/dts/en7528_dasan_h660gm-a.dtsi b/target/linux/econet/dts/en7528_dasan_h660gm-a.dtsi index ed547b7c5b2..d529e30b067 100644 --- a/target/linux/econet/dts/en7528_dasan_h660gm-a.dtsi +++ b/target/linux/econet/dts/en7528_dasan_h660gm-a.dtsi @@ -102,6 +102,22 @@ linux,code = ; }; }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&rootA &root1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ubi"; + reg = <0x0 0x0>; + }; + }; + }; }; &usb { @@ -210,10 +226,17 @@ econet,enable-remap; }; - partition@480000 { - label = "rootfs"; + /* Nested inside of tclinux */ + partition1@80000 { + label = "tclinux_kernel"; + reg = <0x80000 0x400000>; + econet,enable-remap; + }; + + /* Concatenated with "unknown" to form the UBI volume */ + rootA: partition1@480000 { + label = "tclinux_rootfs"; reg = <0x480000 0x1c00000>; - linux,rootfs; }; partition@2080000 { diff --git a/target/linux/econet/en7528/config-6.18 b/target/linux/econet/en7528/config-6.18 index 6446055d962..0cb32d7fd01 100644 --- a/target/linux/econet/en7528/config-6.18 +++ b/target/linux/econet/en7528/config-6.18 @@ -138,6 +138,7 @@ CONFIG_MTD_UBI=y CONFIG_MTD_UBI_BEB_LIMIT=13 CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 +CONFIG_MTD_VIRT_CONCAT=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_SRCU_NMI_SAFE=y CONFIG_NET_DEVLINK=y diff --git a/target/linux/econet/image/Makefile b/target/linux/econet/image/Makefile index d819673ff19..f33c2eb0d85 100644 --- a/target/linux/econet/image/Makefile +++ b/target/linux/econet/image/Makefile @@ -52,6 +52,19 @@ define Device/Default UBINIZE_OPTS := -E 5 endef +# Kernel in a raw TRX partition, root squashfs in UBI. FACTORY_SIZE must be the +# size of the partition the .trx is written into; that write is linear, so an +# oversized image overruns it into the next partition. +define Device/tclinux-ubi + KERNEL_SIZE := 4096k + KERNEL := kernel-bin | append-dtb | lzma | kernel-trx + KERNEL_INITRAMFS := kernel-bin | append-dtb + IMAGES := tclinux.trx sysupgrade.bin + IMAGE/tclinux.trx := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \ + check-size $$$$(FACTORY_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef + include $(SUBTARGET).mk $(eval $(call BuildImage)) diff --git a/target/linux/econet/image/en7528.mk b/target/linux/econet/image/en7528.mk index 9f68905af60..1022f1b4c8d 100644 --- a/target/linux/econet/image/en7528.mk +++ b/target/linux/econet/image/en7528.mk @@ -8,12 +8,12 @@ endef TARGET_DEVICES += en7528_generic define Device/dasan_h660gm-a + $(call Device/tclinux-ubi) DEVICE_VENDOR := DASAN DEVICE_MODEL := H660GM-A - DEVICE_PACKAGES := kmod-usb2 kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap + FACTORY_SIZE := 32m TRX_MODEL := Dewberry - IMAGES := tclinux.trx - IMAGE/tclinux.trx := append-kernel | lzma | tclinux-trx + DEVICE_PACKAGES := kmod-usb2 kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap endef define Device/dasan_h660gm-a-airtel