From f9bdfcb5533710b4b4c2e2468a92b435f36f2c4a Mon Sep 17 00:00:00 2001 From: Jonas Jelonek Date: Tue, 28 Apr 2026 21:00:24 +0000 Subject: [PATCH] realtek: fix Zyxel XMG1915-10E partition layout When support for this device was added, the partition layout was defined in a way that doesn't use space as intended and wastes quite a lot of it. (1) firmware partition starts at offset 0x1260000. This is the second partition/B partition in the A/B scheme used by Zyxel. While the commit mentions the image is written to A, the firmware partition is defined in the B space. (2) firmware partition only ~16MB in size. The device has a total of 32MB of flash. The vendor uses an A/B scheme but OpenWrt doesn't use it. Thus, OpenWrt can make use of the full available space. (3) loader partition too big. Other devices using rt-loader explicitly in a partition use a size of 0x10000. This is more than enough already. The device here uses 0x30000 which is mostly wasted. Those issues are fixed accordingly. While at it, move partitions 'loader' and 'firmware' into a parent partition 'factory'. This is a preparation for adding web upgrade support for this device. Fixes: 94607d6285cc ("realtek: add support for Zyxel XMG1915-10E") Signed-off-by: Jonas Jelonek Link: https://github.com/openwrt/openwrt/pull/23218 Signed-off-by: Robert Marko --- .../realtek/dts/rtl9302_zyxel_xmg1915-10e.dts | 26 ++++++++++++------- target/linux/realtek/image/rtl930x.mk | 4 +-- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/target/linux/realtek/dts/rtl9302_zyxel_xmg1915-10e.dts b/target/linux/realtek/dts/rtl9302_zyxel_xmg1915-10e.dts index 25a73e1ec7..9d646ea1a6 100644 --- a/target/linux/realtek/dts/rtl9302_zyxel_xmg1915-10e.dts +++ b/target/linux/realtek/dts/rtl9302_zyxel_xmg1915-10e.dts @@ -161,19 +161,27 @@ partition@80000 { label = "reserved"; - reg = <0x80000 0xf80000>; + reg = <0x80000 0x1e0000>; read-only; }; - partition@1260000 { - label = "loader"; - reg = <0x1260000 0x30000>; - }; + partition@260000 { + label = "factory"; + reg = <0x260000 0x1da0000>; - partition@1290000 { - label = "firmware"; - reg = <0x1290000 0xd70000>; - compatible = "openwrt,uimage", "denx,uimage"; + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "loader"; + reg = <0x0 0x10000>; + }; + partition@10000 { + label = "firmware"; + reg = <0x10000 0x1d90000>; + compatible = "openwrt,uimage", "denx,uimage"; + }; }; }; }; diff --git a/target/linux/realtek/image/rtl930x.mk b/target/linux/realtek/image/rtl930x.mk index 20f96c3ae4..df5c16c6e3 100644 --- a/target/linux/realtek/image/rtl930x.mk +++ b/target/linux/realtek/image/rtl930x.mk @@ -231,7 +231,7 @@ define Device/zyxel_xmg1915-10e ZYXEL_VERS := ABWE DEVICE_VENDOR := Zyxel DEVICE_MODEL := XMG1915-10E - FLASH_ADDR := 0xb5290000 + FLASH_ADDR := 0xb4270000 ifeq ($(IB),) ARTIFACTS := loader.bin ARTIFACT/loader.bin := \ @@ -239,6 +239,6 @@ ifeq ($(IB),) zynsig endif $(Device/rt-loader-bootbase) - IMAGE_SIZE := 13760k + IMAGE_SIZE := 30336k endef TARGET_DEVICES += zyxel_xmg1915-10e