From c579e1d04c35dc767964901b384d7bf42f672668 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Sun, 1 Feb 2026 10:26:59 +0100 Subject: [PATCH] gemini: sl93512r: override SL93512R partitions for firmware This is patch is identical in form and purpose as the IB-4220-B patch. We switch over to a single "firmware" partition. All reference design-based machines are now converted and we can drop the legacy set-up code. It turns out that the reference design also uses the flash layout with a 3072KB kernel so augment the sysupgrade to do the right thing also here. Link: https://github.com/openwrt/openwrt/pull/21820 Signed-off-by: Linus Walleij --- .../gemini/base-files/lib/upgrade/platform.sh | 27 ++------ target/linux/gemini/image/Makefile | 40 +---------- ...SL93512R-DTS-with-botched-partitions.patch | 68 +++++++++++++++++++ 3 files changed, 75 insertions(+), 60 deletions(-) create mode 100644 target/linux/gemini/patches-6.12/305-gemini-augment-SL93512R-DTS-with-botched-partitions.patch diff --git a/target/linux/gemini/base-files/lib/upgrade/platform.sh b/target/linux/gemini/base-files/lib/upgrade/platform.sh index 19a6488f312..1553bdd55ac 100644 --- a/target/linux/gemini/base-files/lib/upgrade/platform.sh +++ b/target/linux/gemini/base-files/lib/upgrade/platform.sh @@ -56,24 +56,6 @@ gemini_check_redboot_parts() { fi } -gemini_do_redboot_upgrade() { - echo "Extract the three firmware parts from tarfile" - echo 3 > /proc/sys/vm/drop_caches - echo "COMMENCING UPGRADE. BE PATIENT, THIS IS NOT FAST!" - KFSZ=$(tar xfz "$1" zImage -O | wc -c) - echo "Upgrade Kern partition (kernel part 1, size ${KFSZ})" - tar xfz "$1" zImage -O | mtd write - Kern - [ $? -ne 0 ] && exit 1 - RFSZ=$(tar xfz "$1" rd.gz -O | wc -c) - echo "Upgrade Ramdisk partition (kernel part 2, size ${RFSZ})" - tar xfz "$1" rd.gz -O | mtd write - Ramdisk - [ $? -ne 0 ] && exit 1 - AFSZ=$(tar xfz "$1" hddapp.tgz -O | wc -c) - echo "Upgrade Application partition (rootfs, size ${AFSZ})" - tar xfz "$1" hddapp.tgz -O | mtd write - Application - [ $? -ne 0 ] && exit 1 -} - # This converts the old RedBoot partitioning to the new shared # "firmware" partition. gemini_do_flat_redboot_upgrade() { @@ -129,13 +111,12 @@ platform_do_upgrade() { PART_NAME=firmware default_do_upgrade "$1" ;; - raidsonic,ib-4220-b) + raidsonic,ib-4220-b|\ + storlink,gemini324) gemini_do_combined_upgrade "$1" 24 48 48 ;; - itian,sq201|\ - storlink,gemini324) - gemini_check_redboot_parts "$1" 16 48 48 - gemini_do_redboot_upgrade "$1" + itian,sq201) + gemini_do_combined_upgrade "$1" 16 48 48 ;; esac } diff --git a/target/linux/gemini/image/Makefile b/target/linux/gemini/image/Makefile index 0e672077158..51191faad6d 100644 --- a/target/linux/gemini/image/Makefile +++ b/target/linux/gemini/image/Makefile @@ -99,30 +99,6 @@ define CreateStorlinkProlog $(call Image/pad-to,$(1),512) endef -define CreateStorlinkTarfile - mkdir -p $@.tmp - - # "Application" partition is the rootfs - mv $@ $@.tmp/hddapp.tgz - $(STAGING_DIR_HOST)/bin/padjffs2 $(IMAGE_ROOTFS) -c 128 >>$@.tmp/hddapp.tgz - $(call CreateStorlinkProlog,$@.tmp/zImage,$(2)) - # Copy first part of the kernel into zImage - dd if=$(IMAGE_KERNEL) of=$@.tmp/zImage bs=1 seek=512 count=$(3) - $(call Image/pad-to,$@.tmp/zImage,128k) - # Put the rest of the kernel into the "ramdisk" - dd if=$(IMAGE_KERNEL) of=$@.tmp/rd.gz bs=1 skip=$(3) count=6144k conv=sync - $(call Image/pad-to,$@.tmp/rd.gz,128k) - 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 - - (cd $@.tmp; tar --sort=name --owner=0 --group=0 --numeric-owner -czf $@ * \ - $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)")) - - rm -rf $@.tmp - exit 0 -endef - define CreateStorlinkFactoryfile mkdir -p $@.tmp $(call CreateStorlinkProlog,$@.tmp/zImage,$(2)) @@ -162,10 +138,6 @@ define CreateStorlinkSysupgradefile endef # 2048k "Kern" partition -define Build/storlink-2048k-default-image - $(call CreateStorlinkTarfile,$(1),2048k,2096640) -endef - define Build/storlink-2048k-factory-image $(call CreateStorlinkFactoryfile,$(1),2048k,2096640) endef @@ -256,15 +228,6 @@ define Device/storlink-reference COMPILE/copy-kernel-$(1).bin := copy-kernel.bin IMAGES := factory.bin sysupgrade.bin FILESYSTEMS := squashfs - # Flash layout: - # Kern 512 bytes copy-kernel - # 2096640 bytes zImage - # Ramdisk 6144k remaining zImage - # Application 6144k - IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 128k | \ - storlink-2048k-default-image $(1) - IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | \ - storlink-2048k-default-image $(1) | append-metadata DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) endef @@ -300,6 +263,9 @@ define Device/storlink_sl93512r DEVICE_VENDOR := StorLink DEVICE_MODEL := SL93512r DEVICE_DTS := gemini-sl93512r + IMAGE/factory.bin := storlink-3072k-factory-image $(1) + IMAGE/sysupgrade.bin := storlink-3072k-sysupgrade-image $(1) |\ + append-metadata DEVICE_PACKAGES += kmod-dsa-vsc73xx-spi endef TARGET_DEVICES += storlink_sl93512r diff --git a/target/linux/gemini/patches-6.12/305-gemini-augment-SL93512R-DTS-with-botched-partitions.patch b/target/linux/gemini/patches-6.12/305-gemini-augment-SL93512R-DTS-with-botched-partitions.patch new file mode 100644 index 00000000000..876cbf0a129 --- /dev/null +++ b/target/linux/gemini/patches-6.12/305-gemini-augment-SL93512R-DTS-with-botched-partitions.patch @@ -0,0 +1,68 @@ +From b5732601a7ff5457cb1e3a9389761aa23a81f54d Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Sun, 1 Feb 2026 10:20:56 +0100 +Subject: [PATCH] gemini: augment SL93512R DTS with botched partitions + +Same botched partitions as the Raidsonic IB-4220-B. + +Signed-off-by: Linus Walleij +--- + arch/arm/boot/dts/gemini/gemini-sl93512r.dts | 39 ++++++++++++++++++-- + 1 file changed, 35 insertions(+), 4 deletions(-) + +--- a/arch/arm/boot/dts/gemini/gemini-sl93512r.dts ++++ b/arch/arm/boot/dts/gemini/gemini-sl93512r.dts +@@ -24,7 +24,7 @@ + }; + + chosen { +- bootargs = "console=ttyS0,19200n8 root=/dev/mtdblock3 rw rootfstype=squashfs,jffs2 rootwait"; ++ bootargs = "console=ttyS0,19200n8"; + stdout-path = &uart0; + }; + +@@ -143,10 +143,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; ++ }; + }; + }; + -- 2.47.3