Files
eternalwrt-mt798x/target/linux/gemini/patches-6.12/303-gemini-augment-DTS-with-botched-partitions.patch
T
Linus Walleij 387752dc76 gemini: override IB-4220-B partitions for firmware
To optimize the flash usage and to make firmware upgrades
simpler, catenate the three firmware partitions "Kern",
"Ramdisk" and "Application" into one, and use all of this
for the combined MTD-splitted kernel+rootfs.

This works fine as long as the kernel is placed in the
beginning of this firmware partition and we leave the
RedBoot partition as is, so the boot loader still can load
the kernel from the first two RedBoot partitions.

Using the RedBoot partitions "as is" can be considered
harmful, because when you flash to a RedBoot partition the
file size is used for downsizing of the partition and make
firmware upgrades fail if they are larger than the RedBoot
partition size after flashing, despite there is actually
flash there. So overriding with fixed partitions is just
generally a good idea.

Link: https://github.com/openwrt/openwrt/pull/21820
Signed-off-by: Linus Walleij <linusw@kernel.org>
2026-02-03 13:33:12 +01:00

81 lines
2.3 KiB
Diff

From 1b5c6be7b6dc6c096e1fd55ce10809d350e3afab Mon Sep 17 00:00:00 2001
From: Linus Walleij <linusw@kernel.org>
Date: Mon, 26 Jan 2026 08:09:04 +0100
Subject: [PATCH] gemini: augment DTS with botched partitions
We override the RedBoot FIS partition table with a custom one
using fixed-partitions.
Mostly this is a 1-to-1 copy, but the three partitions called
"Kern", "Ramdisk" and "Application" are combined into one
called "firmware" which is optimal for OpenWrt.
The RedBoot bootloader still sees the three partitions and will
load the first two into memory to boot the system, which
is fine: the kernel will still be there.
To avoid confusing the MTD partition splitter we also need to
remove any command line root partition arguments.
Signed-off-by: Linus Walleij <linusw@kernel.org>
---
arch/arm/boot/dts/gemini/gemini-nas4220b.dts | 39 ++++++++++++++++++--
1 file changed, 35 insertions(+), 4 deletions(-)
--- a/arch/arm/boot/dts/gemini/gemini-nas4220b.dts
+++ b/arch/arm/boot/dts/gemini/gemini-nas4220b.dts
@@ -20,7 +20,7 @@
};
chosen {
- bootargs = "console=ttyS0,19200n8 root=/dev/mtdblock3 rw rootfstype=squashfs,jffs2 rootwait";
+ bootargs = "console=ttyS0,19200n8";
stdout-path = &uart0;
};
@@ -82,10 +82,41 @@
/* 16MB of flash */
reg = <0x30000000 0x01000000>;
+ /*
+ * Override the RedBoot partition table with fixed partitions
+ * in order to create a coherent "firmware" partition so that
+ * we can have optimal flash usage with OpenWrt in a big
+ * MTD-splitted "firmware" partition.
+ */
partitions {
- compatible = "redboot-fis";
- /* Eraseblock at 0xfe0000 */
- fis-index-block = <0x7f>;
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ partition@0 {
+ label = "BOOT";
+ reg = <0x00000000 0x00020000>;
+ read-only;
+ };
+ partition@1 {
+ compatible = "openwrt,executable-prolog";
+ label = "firmware";
+ reg = <0x00020000 0x00f00000>;
+ };
+ partition@2 {
+ label = "VCTL";
+ reg = <0x00f20000 0x00020000>;
+ read-only;
+ };
+ partition@3 {
+ label = "CurConf";
+ reg = <0x00f40000 0x000a0000>;
+ read-only;
+ };
+ partition@4 {
+ label = "FIS directory";
+ reg = <0x00fe0000 0x00020000>;
+ read-only;
+ };
};
};