openwrt/target/linux/generic/files
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
..
arch/mips/fw/myloader
Documentation dt-bindings: mtd: partitions: add OpenWrt defined U-Boot Image 2021-01-22 21:03:11 +01:00
drivers kernel: mtdsplit: create executable prolog splitter 2026-02-03 13:33:12 +01:00
include kernel: rtl836x: remove legacy platform_data support 2025-12-15 09:31:20 +01:00