mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2026-02-04 10:06:19 -05:00
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>