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 <naseefkm@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24398
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
This commit is contained in:
Ahmed Naseef 2026-07-24 07:52:07 +04:00 committed by Jonas Jelonek
parent 5c2dfad5f8
commit 6ca3332676
No known key found for this signature in database
7 changed files with 53 additions and 10 deletions

View 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"
;;

View 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>;
};

View 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>;
};

View file

@ -102,6 +102,22 @@
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 {
@ -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 {

View 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

View 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))

View 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