[openwrt/openwrt] gemini: create a copy-kernel for 3072k kernels

LEDE Commits lede-commits at lists.infradead.org
Tue Feb 10 23:48:17 PST 2026


linusw pushed a commit to openwrt/openwrt.git, branch openwrt-25.12:
https://git.openwrt.org/1bd010f83b201ac379152d3756d370a696af6800

commit 1bd010f83b201ac379152d3756d370a696af6800
Author: Linus Walleij <linusw at kernel.org>
AuthorDate: Sat Jan 24 18:13:24 2026 +0100

    gemini: create a copy-kernel for 3072k kernels
    
    The Raidsonic devices do not use a 2048k kernel "Kern"
    partition like the Storlink reference designs. Instead
    it uses a 3072k partition to fit a slightly
    larger kernel.
    
    Sadly the current OpenWrt Gemini kernel is still bigger
    than 3072k so we need to make use of the Ramdisk
    partition as well.
    
    Create a special "copy-kernel" version that can deal
    with the Raidsonic 3072k kernels. Tested on the
    Raidsonic IB-4220-B booting kernel v6.12.66.
    
    Fix a copy/paste error in the image generation makefile
    while we are at it.
    
    Link: https://github.com/openwrt/openwrt/pull/21686
    (cherry picked from commit 691aa70e1693542eee795df4bed2b46f6af26e63)
    Link: https://github.com/openwrt/openwrt/pull/21973
    Signed-off-by: Linus Walleij <linusw at kernel.org>
---
 target/linux/gemini/image/Makefile                      | 17 ++++++++---------
 target/linux/gemini/image/copy-kernel/Makefile          |  5 +++--
 .../copy-kernel/{copy-kernel.S => copy-kernel-2048k.S}  |  0
 .../copy-kernel/{copy-kernel.S => copy-kernel-3072k.S}  |  8 ++++----
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/target/linux/gemini/image/Makefile b/target/linux/gemini/image/Makefile
index ba32d1c64f..7e208ed981 100644
--- a/target/linux/gemini/image/Makefile
+++ b/target/linux/gemini/image/Makefile
@@ -94,14 +94,13 @@ define CreateStorlinkTarfile
 
 	# "Application" partition is the rootfs
 	mv $@ $@.tmp/hddapp.tgz
-	# 256 bytes copy routine
-	# TODO fix for IB-4220-B
-	dd if=$(KDIR)/copy-kernel.bin of=$@.tmp/zImage
+	# 512 bytes copy routine
+	dd if=$(KDIR)/copy-kernel-$(2).bin of=$@.tmp/zImage
 	$(call Image/pad-to,$@.tmp/zImage,512)
 	# Copy first part of the kernel into zImage
-	dd if=$(IMAGE_KERNEL) of=$@.tmp/zImage bs=1 seek=512 count=$(2)
+	dd if=$(IMAGE_KERNEL) of=$@.tmp/zImage bs=1 seek=512 count=$(3)
 	# Put the rest of the kernel into the "ramdisk"
-	dd if=$(IMAGE_KERNEL) of=$@.tmp/rd.gz bs=1 skip=$(2) count=6144k conv=sync
+	dd if=$(IMAGE_KERNEL) of=$@.tmp/rd.gz bs=1 skip=$(3) count=6144k conv=sync
 	cp ./ImageInfo-$(1) $@.tmp/ImageInfo
 
 	sed -i -e "s/DATESTR/`date +%Y%m%d $(if $(SOURCE_DATE_EPOCH),--date "@$(SOURCE_DATE_EPOCH)")`/g" $@.tmp/ImageInfo
@@ -115,12 +114,12 @@ endef
 
 # 2048k "Kern" partition
 define Build/storlink-default-image
-	$(call CreateStorlinkTarfile,$(1),2096640)
+	$(call CreateStorlinkTarfile,$(1),2048k,2096640)
 endef
 
-# 3032k "Kern" partition
+# 3072k "Kern" partition
 define Build/raidsonic-ib-4220-b-image
-	$(call CreateStorlinkTarfile,$(1),3145216)
+	$(call CreateStorlinkTarfile,$(1),3072k,3145216)
 endef
 
 # WBD-111 and WBD-222:
@@ -228,7 +227,7 @@ define Device/raidsonic_ib-4220-b
 	# Application  6144k       | = 15360k
 	IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 6144k | \
 		raidsonic-ib-4220-b-image $(1)
-	IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 6144k | \
+	IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 6144k | \
 		raidsonic-ib-4220-b-image $(1) | append-metadata
 endef
 TARGET_DEVICES += raidsonic_ib-4220-b
diff --git a/target/linux/gemini/image/copy-kernel/Makefile b/target/linux/gemini/image/copy-kernel/Makefile
index 9ba283bb01..befac6912a 100644
--- a/target/linux/gemini/image/copy-kernel/Makefile
+++ b/target/linux/gemini/image/copy-kernel/Makefile
@@ -16,7 +16,7 @@ BIN_FLAGS	:= -O binary -S
 SRC_DIR		:= $(CURDIR)/
 OUT_DIR		:= $(if $(O),$(if $(patsubst %/,,$(O)),$(O)/,$(O)),$(SRC_DIR))
 
-all: $(OUT_DIR)copy-kernel.bin
+all: $(OUT_DIR)copy-kernel-2048k.bin $(OUT_DIR)copy-kernel-3072k.bin
 
 # Don't build dependencies, this may die if $(CC) isn't gcc
 dep:
@@ -35,4 +35,5 @@ $(OUT_DIR)%.bin: $(OUT_DIR)%.o
 mrproper: clean
 
 clean:
-	rm -f $(OUT_DIR)copy-kernel.bin $(OUT_DIR)copy-kernel.o
+	rm -f $(OUT_DIR)copy-kernel-2048k.bin $(OUT_DIR)copy-kernel-2048k.o
+	rm -f $(OUT_DIR)copy-kernel-3072k.bin $(OUT_DIR)copy-kernel-3072k.o
diff --git a/target/linux/gemini/image/copy-kernel/copy-kernel.S b/target/linux/gemini/image/copy-kernel/copy-kernel-2048k.S
similarity index 100%
copy from target/linux/gemini/image/copy-kernel/copy-kernel.S
copy to target/linux/gemini/image/copy-kernel/copy-kernel-2048k.S
diff --git a/target/linux/gemini/image/copy-kernel/copy-kernel.S b/target/linux/gemini/image/copy-kernel/copy-kernel-3072k.S
similarity index 81%
rename from target/linux/gemini/image/copy-kernel/copy-kernel.S
rename to target/linux/gemini/image/copy-kernel/copy-kernel-3072k.S
index a287e40def..e6b53f2bd2 100644
--- a/target/linux/gemini/image/copy-kernel/copy-kernel.S
+++ b/target/linux/gemini/image/copy-kernel/copy-kernel-3072k.S
@@ -1,4 +1,4 @@
-	// Arm assembly to copy the Gemini kernel on Storlink reference
+	// Arm assembly to copy the Gemini kernel on Raidsonic
 	// designs and derived devices with the same flash layout and
 	// boot loader.
 	//
@@ -9,8 +9,8 @@
 	// image of up to 8 MB except for these 512 bytes used for
 	// this bootstrap.
 	//
-	// 0x01600200 .. 0x017fffff -> 0x00400000 .. 0x005ffdff
-	// 0x00800000 .. 0x00dfffff -> 0x005ffe00 .. 0x00bffdff
+	// 0x01600200 .. 0x018fffff -> 0x00400000 .. 0x006ffdff
+	// 0x00800000 .. 0x00dfffff -> 0x006ffe00 .. 0x00cffdff
 
 	// Memory used for this bootstrap
 	.equ BOOT_HEADROOM,	0x200
@@ -19,7 +19,7 @@
 _start:
 	mov r1, #0x01600000
 	mov r2, #0x00400000
-	mov r3, #0x00200000
+	mov r3, #0x00300000
 	add r1, r1, #BOOT_HEADROOM
 	sub r3, r3, #BOOT_HEADROOM
 copyloop1:




More information about the lede-commits mailing list