From 10a2398f62c155b80de089200aebe0518db84a13 Mon Sep 17 00:00:00 2001 From: Dmitry Ilyin <6576495+widgetii@users.noreply.github.com> Date: Tue, 20 Oct 2026 18:56:14 +0300 Subject: [PATCH] hi3516cv300, hi3516ev100: the split NOR image, as on the gk7205v200 family hi3516cv300_lite, hi3516cv300_ultimate and hi3516ev100_lite build firmware.bin with general/scripts/post-image-split.sh -- the kernel's uImage (zImage + appended hi3516cv300-demb.dtb), then the squashfs at the next 64 KiB -- and publish it as the -split package. The kernel configs turn on the splitters and the root from the split (MTD_SPLIT_FIRMWARE, MTD_SPLIT_UIMAGE_FW, MTD_SPLIT_SQUASHFS_ROOT, MTD_ROOTFS_ROOT_DEV); the kernel (OpenIPC/linux hisilicon-hi3516cv300, the split NOR layout commit) finds the layout from its device tree, whatever mtdparts and root= the bootloader passes. hi3516cv300_neo keeps its own image. Like the Goke boards, these keep shipping the plain fixed-slot package (BR2_OPENIPC_NOR_FIXED_PACKAGE): cameras in the field upgrade from fixed slots. Its uImage is now held a 64 KiB block under the 2 MiB slot (1983K), which is how the kernel, U-Boot and sysupgrade tell the layouts apart; the field kernels are about 1.6 MiB. The kernel-read limit stays at the default 0x200000. The published U-Boot 2010.06 reads 3 MiB from 0x50000 on either chip size, but the fixed-slot 8 MiB layout has a 2 MiB kernel slot, so 2 MiB is what holds on every camera. Sizes (local builds with that kernel): - hi3516cv300_lite: uImage 1659K (1983K slot, 2048K read), squashfs 4956K (5120K slot), firmware.bin 6656K of 7616K (8 MiB less 320K and a 256K overlay); - hi3516cv300_ultimate: uImage 1659K, squashfs 6748K (8192K), firmware.bin 8448K of 15808K; - hi3516ev100_lite: uImage 1577K, squashfs 4948K, firmware.bin 6592K of 7616K. Tested in qemu-hisilicon (hi3516cv300; hi3516ev100, a machine added for this) from flash: the split firmware.bin at 0x50000 under the published U-Boot 2010.06 (its own bootcmd and mtdparts, 8 and 16 MiB) and under OpenIPC U-Boot 2022.10 with CONFIG_OPENIPC_NOR_SPLIT -- "hi_sfc: split NOR layout, device tree partitions", root on the split rootfs, /init's overlay found on rootfs_data on the next boot and a file written there kept across a reset; the plain package's uImage and rootfs under both, in fixed slots as before. Verified on a hi3516cv300 board (imx291, W25Q128 16 MiB, 128 MiB DRAM), after a full flash backup: - the split-aware kernel booted from RAM over the board's fixed-slot flash (its U-Boot 2010.06 env, 3072k kernel / 10240k rootfs): the command line's five partitions, nothing split, root on 31:3, login prompt; - the hi3516cv300_lite split firmware.bin written at 0x50000 under the same U-Boot 2010.06 and its saved 16 MiB mtdparts: "hi_sfc: split NOR layout, device tree partitions", kernel 0x50000-0x1f0000, rootfs from 0x1f0000, rootfs_data from 0x6d0000, "root=/dev/mtdblock3 ignored", root on 31:4, login prompt; /init's overlay marker (a JFFS2 inode and dirent ".openipc-overlay") on rootfs_data, kept across a power cycle; - OpenIPC U-Boot 2022.10 with CONFIG_OPENIPC_NOR_SPLIT written at 0, env default and saved: "Found Kernel at 0x00050000", "Found RootFS at 0x001f0000", command line "mem=32M console=ttyAMA0,115200 panic=20 rootfstype=squashfs init=/init", the same split, root on 31:4. --- .../board/hi3516cv300/hi3516cv300.generic.config | 5 +++++ .../board/hi3516cv300/hi3516ev100.generic.config | 5 +++++ br-ext-chip-hisilicon/configs/hi3516cv300_lite_defconfig | 2 ++ br-ext-chip-hisilicon/configs/hi3516cv300_ultimate_defconfig | 2 ++ br-ext-chip-hisilicon/configs/hi3516ev100_lite_defconfig | 2 ++ 5 files changed, 16 insertions(+) diff --git a/br-ext-chip-hisilicon/board/hi3516cv300/hi3516cv300.generic.config b/br-ext-chip-hisilicon/board/hi3516cv300/hi3516cv300.generic.config index f173e11610..5cbbc1d44e 100644 --- a/br-ext-chip-hisilicon/board/hi3516cv300/hi3516cv300.generic.config +++ b/br-ext-chip-hisilicon/board/hi3516cv300/hi3516cv300.generic.config @@ -774,6 +774,11 @@ CONFIG_MTD=y CONFIG_MTD_CMDLINE_PARTS=y # CONFIG_MTD_AFS_PARTS is not set CONFIG_MTD_OF_PARTS=y +CONFIG_MTD_ROOTFS_ROOT_DEV=y +CONFIG_MTD_SPLIT_FIRMWARE=y +CONFIG_MTD_SPLIT_FIRMWARE_NAME="firmware" +CONFIG_MTD_SPLIT_SQUASHFS_ROOT=y +CONFIG_MTD_SPLIT_UIMAGE_FW=y # CONFIG_MTD_AR7_PARTS is not set # diff --git a/br-ext-chip-hisilicon/board/hi3516cv300/hi3516ev100.generic.config b/br-ext-chip-hisilicon/board/hi3516cv300/hi3516ev100.generic.config index dd6f0e4cfe..15318b4a59 100644 --- a/br-ext-chip-hisilicon/board/hi3516cv300/hi3516ev100.generic.config +++ b/br-ext-chip-hisilicon/board/hi3516cv300/hi3516ev100.generic.config @@ -706,6 +706,11 @@ CONFIG_MTD=y CONFIG_MTD_CMDLINE_PARTS=y # CONFIG_MTD_AFS_PARTS is not set CONFIG_MTD_OF_PARTS=y +CONFIG_MTD_ROOTFS_ROOT_DEV=y +CONFIG_MTD_SPLIT_FIRMWARE=y +CONFIG_MTD_SPLIT_FIRMWARE_NAME="firmware" +CONFIG_MTD_SPLIT_SQUASHFS_ROOT=y +CONFIG_MTD_SPLIT_UIMAGE_FW=y # CONFIG_MTD_AR7_PARTS is not set # diff --git a/br-ext-chip-hisilicon/configs/hi3516cv300_lite_defconfig b/br-ext-chip-hisilicon/configs/hi3516cv300_lite_defconfig index 26f485d1cc..71d0790663 100644 --- a/br-ext-chip-hisilicon/configs/hi3516cv300_lite_defconfig +++ b/br-ext-chip-hisilicon/configs/hi3516cv300_lite_defconfig @@ -30,6 +30,8 @@ BR2_PACKAGE_WIREGUARD_TOOLS=y BR2_TARGET_ROOTFS_CPIO=y BR2_TARGET_ROOTFS_SQUASHFS=y BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y +BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_GENERAL_PATH)/scripts/post-image-split.sh" +BR2_OPENIPC_NOR_FIXED_PACKAGE=y # OpenIPC BR2_OPENIPC_SOC_VENDOR="hisilicon" diff --git a/br-ext-chip-hisilicon/configs/hi3516cv300_ultimate_defconfig b/br-ext-chip-hisilicon/configs/hi3516cv300_ultimate_defconfig index 531104891f..1eba373af0 100644 --- a/br-ext-chip-hisilicon/configs/hi3516cv300_ultimate_defconfig +++ b/br-ext-chip-hisilicon/configs/hi3516cv300_ultimate_defconfig @@ -36,6 +36,8 @@ BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y BR2_TARGET_ROOTFS_CPIO=y BR2_TARGET_ROOTFS_SQUASHFS=y BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y +BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_GENERAL_PATH)/scripts/post-image-split.sh" +BR2_OPENIPC_NOR_FIXED_PACKAGE=y # OpenIPC BR2_OPENIPC_SOC_VENDOR="hisilicon" diff --git a/br-ext-chip-hisilicon/configs/hi3516ev100_lite_defconfig b/br-ext-chip-hisilicon/configs/hi3516ev100_lite_defconfig index 420296eda6..5136ca2b42 100644 --- a/br-ext-chip-hisilicon/configs/hi3516ev100_lite_defconfig +++ b/br-ext-chip-hisilicon/configs/hi3516ev100_lite_defconfig @@ -32,6 +32,8 @@ BR2_PACKAGE_WIREGUARD_TOOLS=y BR2_TARGET_ROOTFS_CPIO=y BR2_TARGET_ROOTFS_SQUASHFS=y BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y +BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_GENERAL_PATH)/scripts/post-image-split.sh" +BR2_OPENIPC_NOR_FIXED_PACKAGE=y # OpenIPC BR2_OPENIPC_SOC_VENDOR="hisilicon"