openwrt/target/linux/generic
Linus Walleij 5ac8f14ccb kernel: mtdsplit: create executable prolog splitter
The problem is the following: we have three fixed partitions
in a RedBoot partition for kernel, initrd and rootfs. On the
surface this looks good.

But we have little flash and want to use it efficiently. We want
to use the OpenWrt "firmware" partition scheme where the kernel,
initramfs and sqashfs+jffs2 rootfs is appended, leaving maximum
space for a writeable rootfs.

To do this we will override the existing RedBoot partition table
with one that merges the three separate partitions into one
"firmware" partition.

RedBoot is still booting the system. It still needs to read the
first two parts "as if" these were the kernel and initrd. This
works fine, because the kernel still comes first.

We already have hacks in place to merge the two kernel and initrd
into one binary image and execute it. This is done by prepending
a "prolog" to the kernel that does the necessary copying in
memory and then jumps to execute the kernel.

Since this "prolog" copying routine is just 92 bytes but has 512
bytes allocated, we can trivially create a firmware format that
can be used for splitting the image into kernel and rootfs
using a tagging scheme that can be done directly by scripting
so we don't need any special binary programs.

This splitter implements that idea.

This will be used on the Gemini platform and was tested on the
Raidsonic IB-4220-B.

Link: https://github.com/openwrt/openwrt/pull/21820
Signed-off-by: Linus Walleij <linusw@kernel.org>
2026-02-03 13:33:12 +01:00
..
backport-6.12 kernel: mtd: backport upstream physmap OF partition order 2026-01-31 23:13:46 +01:00
files kernel: mtdsplit: create executable prolog splitter 2026-02-03 13:33:12 +01:00
hack-6.12 kernel: bump 6.12 to 6.12.68 2026-02-01 19:03:59 +01:00
image treewide: strip trailing whitespace 2025-05-20 00:47:37 +02:00
other-files initramfs: switch to tmpfs to fix ujail 2020-11-27 01:23:43 +00:00
pending-6.12 kernel: bump 6.12 to 6.12.68 2026-02-01 19:03:59 +01:00
config-6.12 kernel: add missing kernel config option 2026-01-26 23:57:25 +01:00
config-filter generic: filter out more rust related symbols 2026-01-18 11:22:15 +01:00
kernel-6.12 kernel: bump 6.12 to 6.12.68 2026-02-01 19:03:59 +01:00
PATCHES.md generic: improve patches documentation 2025-06-11 15:09:46 +02:00