]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
econet: en7528: add UBI support to DASAN H660GM-A 24398/head
authorAhmed Naseef <naseefkm@gmail.com>
Fri, 24 Jul 2026 03:52:07 +0000 (07:52 +0400)
committerJonas Jelonek <jelonek.jonas@gmail.com>
Sun, 2 Aug 2026 13:08:46 +0000 (15:08 +0200)
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 <naseefkm@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24398
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
target/linux/econet/base-files/lib/upgrade/platform.sh
target/linux/econet/dts/en7528_dasan_h660gm-a-airtel.dts
target/linux/econet/dts/en7528_dasan_h660gm-a-generic.dts
target/linux/econet/dts/en7528_dasan_h660gm-a.dtsi
target/linux/econet/en7528/config-6.18
target/linux/econet/image/Makefile
target/linux/econet/image/en7528.mk

index f84786504ccb3f3e7c1a758d57e4643b982da841..e1f91a9aa9ac8c03d720169772135ccf974edc83 100644 (file)
@@ -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"
                ;;
index cb30326add34e6268e4f5e1a14d4444fea81d0f7..d522648ca8c13795616e9dc079b039b12a724754 100644 (file)
@@ -45,7 +45,8 @@
 };
 
 &partitions {
-       partition@60c0000 {
+       /* Concatenated with tclinux_rootfs to form the UBI volume */
+       root1: partition@60c0000 {
                label = "unknown";
                reg = <0x60c0000 0x7d00000>;
        };
index 8e536383a4c75cfc11d74f9a4d1f846f233cd08d..7f03b73028b0e1d19ac91a4ed900c2adb98b3d5b 100644 (file)
@@ -83,7 +83,8 @@
 };
 
 &partitions {
-       partition@60c0000 {
+       /* Concatenated with tclinux_rootfs to form the UBI volume */
+       root1: partition@60c0000 {
                label = "unknown";
                reg = <0x60c0000 0xd00000>;
        };
index ed547b7c5b2a5e066a498fd56554fabeb15dc30c..d529e30b06753a21081d2e584e5f5ca2a6acab82 100644 (file)
                        linux,code = <KEY_WPS_BUTTON>;
                };
        };
+
+       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 {
                        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 {
index 6446055d962a6b4be3f89038a911468578cfa4b2..0cb32d7fd01227749e1785c6f671b712d10ebb03 100644 (file)
@@ -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
index d819673ff19b52e6f47e7034215e9b97c99b4e44..f33c2eb0d8558e351db16647a0ec5b23b9dd39fb 100644 (file)
@@ -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))
index 9f68905af602df7d9b76d151f5ac716ca5729d72..1022f1b4c8d9905898163275cbeb4a89ca1ea100 100644 (file)
@@ -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