From 754c0a280de30914dd836f3bd37fe7739f6f6a4e Mon Sep 17 00:00:00 2001 From: Dmitry Ilyin <6576495+widgetii@users.noreply.github.com> Date: Thu, 22 Oct 2026 13:50:28 +0300 Subject: [PATCH 1/2] nor: split layout on the gk7205v500 family CONFIG_OPENIPC_NOR_SPLIT for gk7205v500, gk7205v510 and gk7205v530 (xm720xxx_config, which build.sh uses for all three, and xm72050500_config), now that their kernel (OpenIPC/linux goke-gk7205v500) finds the split layout from its device tree. The scan takes a uImage at 0x50000 with the squashfs at the next 64 KiB as the split image and boots it with a root-less command line; fwupd and recovery take firmware.bin.. Fixed-slot cameras boot as before. The NAND builds compile the split code out. misc_init_r() on xm720xxx and xm72050500 set verify=n after openipc_helper(), undoing the scan's clearing of it for a split image so bootm never checked the uImage CRC; it is set before the scan, as #48 did for the boards that had it then. NOR images: u-boot-gk7205v500/v510/v530-nor.bin 225792 bytes each, inside the 256K boot area; NAND images build as before. Tested in qemu-hisilicon with a gk7205v500_lite build: gk7205v500 8 MB and gk7205v510/v530 16 MB, the split firmware.bin -> "Found RootFS at 0x00240000", "Verifying Checksum ... OK", root-less command line, the kernel's split, root on 31:4, login; the fixed-slot uImage + rootfs -> "Found RootFS at 0x00250000", fixed mtdparts, root on 31:3. Not run on hardware. --- board/xmedia/xm72050500/board.c | 3 ++- board/xmedia/xm720xxx/board.c | 3 ++- common/Kconfig | 2 +- openipc/xm72050500_config | 4 ++++ openipc/xm720xxx_config | 4 ++++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/board/xmedia/xm72050500/board.c b/board/xmedia/xm72050500/board.c index 79e37182bf21..c82655a027e0 100755 --- a/board/xmedia/xm72050500/board.c +++ b/board/xmedia/xm72050500/board.c @@ -143,11 +143,12 @@ void clear_update_flag(int update_flag) int misc_init_r(void) { + /* before the scan: a split image clears it, so bootm checks its CRC */ + env_set("verify", "n"); openipc_helper(); #ifdef CONFIG_RANDOM_ETHADDR random_init_r(); #endif - env_set("verify", "n"); #ifdef CFG_MMU_HANDLEOK dcache_stop(); diff --git a/board/xmedia/xm720xxx/board.c b/board/xmedia/xm720xxx/board.c index a3c2beb48037..a9c6b08a4061 100755 --- a/board/xmedia/xm720xxx/board.c +++ b/board/xmedia/xm720xxx/board.c @@ -142,11 +142,12 @@ void clear_update_flag(int update_flag) int misc_init_r(void) { + /* before the scan: a split image clears it, so bootm checks its CRC */ + env_set("verify", "n"); openipc_helper(); #ifdef CONFIG_RANDOM_ETHADDR random_init_r(); #endif - env_set("verify", "n"); #ifdef CFG_MMU_HANDLEOK dcache_stop(); diff --git a/common/Kconfig b/common/Kconfig index d5b0eaa49b01..e2d1c9b015f8 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1070,5 +1070,5 @@ config OPENIPC_NOR_SPLIT of a saved environment are dropped, and bootm checks the uImage CRC. Only for boards whose kernel knows the layout (gk7205v200 family, hi3516cv6xx, hi3519dv500, hi3516cv300/hi3516ev100, the hi3516ev200 - family). + family, the gk7205v500 family). diff --git a/openipc/xm72050500_config b/openipc/xm72050500_config index ae226538b520..f28bbbb16aba 100644 --- a/openipc/xm72050500_config +++ b/openipc/xm72050500_config @@ -2,3 +2,7 @@ CONFIG_SYS_LOAD_ADDR=0x42000000 CONFIG_MMC=y CONFIG_CMD_MMC=y CONFIG_MMC_SDHCI=y + +# The split NOR layout: the kernel (OpenIPC/linux goke-gk7205v500) +# divides one firmware partition from its own device tree. +CONFIG_OPENIPC_NOR_SPLIT=y diff --git a/openipc/xm720xxx_config b/openipc/xm720xxx_config index b221fc9b8c33..09a42888b29b 100755 --- a/openipc/xm720xxx_config +++ b/openipc/xm720xxx_config @@ -8,3 +8,7 @@ CONFIG_SYS_LOAD_ADDR=0x42000000 CONFIG_MMC=y CONFIG_CMD_MMC=y CONFIG_MMC_SDHCI=y + +# The split NOR layout: the kernel (OpenIPC/linux goke-gk7205v500) +# divides one firmware partition from its own device tree. +CONFIG_OPENIPC_NOR_SPLIT=y From fd1cb49b6b25b281d0e313361a6cf23bf72ee94f Mon Sep 17 00:00:00 2001 From: Dmitry Ilyin <6576495+widgetii@users.noreply.github.com> Date: Thu, 22 Oct 2026 15:14:13 +0300 Subject: [PATCH 2/2] openipc: recovery checks what it runs, whatever verify the board set From review: boards set verify=n before openipc_helper() so the split scan can clear it for bootm (#48, and this PR for xm720xxx/xm72050500), and recovery then ran with verify=n: source skipped the data CRC of a uImage-wrapped script.txt. openipc_helper() now drops verify while firmware_recovery() runs and puts it back for the boot, on every board. QEMU (gk7205v500, 8 MB, split image): 'Verifying Checksum ... OK' before the kernel, split, root on 31:4, login; hi3516ev300 builds. --- common/openipc.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/common/openipc.c b/common/openipc.c index d59f5b692753..96370e4515d5 100644 --- a/common/openipc.c +++ b/common/openipc.c @@ -1022,7 +1022,20 @@ int openipc_helper(void) { char msize[16]; sprintf(msize, "%ldM", gd->ram_size / 1024 / 1024); env_set("totalmem", msize); - firmware_recovery(); + + /* Recovery checks what it runs: a board may already have set verify=n + * (so that the split scan below can clear it), and source would then run + * a wrapped script.txt without its data CRC. Drop it for recovery only + * and put it back for the boot. */ + { + const char *v = env_get("verify"); + char *saved = v ? strdup(v) : NULL; + + env_set("verify", NULL); + firmware_recovery(); + env_set("verify", saved); + free(saved); + } altbootcmd_migrate(); /* Persist the default environment on first start (or after a bad env);