Repository navigation
nor: boot the split layout, FIT and squashfs in one firmware partition - #18
Conversation
With CONFIG_OPENIPC_NOR_FIT_SPLIT (on for gk7205v200 and gk7205v300 here), a FIT at the NOR kernel offset means the split layout: firmware.bin, the hashed FIT and then the squashfs at the next 64 KiB boundary, written whole at 0x50000. firmware_scan() passes Linux "256k(u-boot),64k(env),-(firmware)" and the kernel divides that partition into kernel, rootfs and rootfs_data (mtdsplit). The read is the FIT's own size, and nothing is clamped to a slot. A uImage keeps today's fixed slots, unchanged. - A saved bootargs spells out root=/dev/mtdblock3, which under the split numbering (u-boot, env, firmware, kernel, rootfs, rootfs_data) is the FIT. The token is rewritten in RAM: mtdblock4 for the split layout, mtdblock3 for fixed slots. - openipc_nor_fit=1 joins the command line on either layout. sysupgrade reads it to know this bootloader boots the split layout before writing a firmware.bin for it. - bootm_size is set when a saved env lacks it, so the relocated DTB stays in the kernel's lowmem. - CONFIG_FIT and CONFIG_SHA1 for those boards; their NOR images grow from 205 KB to 216-217 KB (256 KB boot partition). - check_kernel/check_squashfs are __maybe_unused: NAND builds no longer call them. hi3516cv610 also boots a FIT from NOR, but its kernel has no mtdsplit and keeps fixed slots, so the option is off there.
misc_init_r() set verify=n after openipc_helper() had run, and cameras upgraded from the old bootloader carry verify=n in their saved env as well. So bootm loaded the FIT without checking its crc32 and sha1. For gk7205v200 and gk7205v300 the board now sets it before openipc_helper(), and firmware_scan() drops it (RAM only) when it boots the split layout's FIT. A uImage keeps verify=n, as before. Verified on a GK7205V200 with its env saved by u-boot-gk7205v200: 'Verifying Hash Integrity ... crc32+ sha1+ OK' for the kernel and the DTB, then boot to login.
PR Summary by QodoBoot split NOR FIT firmware while preserving fixed-slot images
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
1. Standard builds omit split firmware support
|
| CONFIG_FIT=y | ||
| CONFIG_SHA1=y | ||
| CONFIG_OPENIPC_NOR_FIT_SPLIT=y |
There was a problem hiding this comment.
1. Standard builds omit split firmware support 🐞 Bug ≡ Correctness
The new options are added to xm72050200_config and xm72050300_config, but build_xmedia()
selects ${soc}_config for the advertised GK7205V200 and GK7205V300 targets. For those targets it
looks for gk7205v200_config and gk7205v300_config, neither of which exists, so this build path
never consumes the new flags or produces the intended split-capable images.
Agent Prompt
## Issue description
The GK7205 build dispatch does not select the configuration fragments that enable split NOR firmware support.
## Fix Focus Areas
- openipc/xm72050200_config[5-8]
- openipc/xm72050300_config[11-14]
- build.sh[245-255]
## Recommended Fix
Map the GK7205V200 and GK7205V300 build targets to their corresponding xm configuration fragments, and verify that both generated NOR configurations retain the new options.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
The FIT path set kernsize to the FIT and rootaddr to the squashfs behind it. uk, ur and fwupd install a uImage and a squashfs, so on a split camera they wrote fixed-slot images at split offsets: ur at 0x230000 with the default rootsize, uk over the FIT only. The next scan found the rootfs at 0x230000, sized the kernel slot from it, and the mtdparts it built did not match where the rootfs is. kernsize, rootaddr and rootsize now name the fixed slots: kernel 2 MiB and rootfs 5 MiB, or 3 and 10 MiB on 16 MiB parts when the FIT needs 3; urwrite still moves to the ultimate slots for a big rootfs, as before. uk erases the whole kernel slot, so no head of the split squashfs is left for the scan to find. loadkernel reads the slot, which holds the whole FIT. Verified on GK7205V200 (U-Boot loaded into RAM with defib): the split layout still boots with the FIT hashes checked; ur then uk with rootfs.squashfs and uImage from TFTP turn the split camera into fixed slots, found at 0x50000 and 0x250000, and it boots to login.
|
Qodo #1 ("Standard builds omit split firmware support"): Qodo #2 ( |
Your clarification invalidates the basis for finding 1: if For finding 2, the reported issue is addressed in your latest commit and has been verified on GK7205V200. I can’t independently inspect that commit from the supplied diff, but the described verification confirms the intended update-path fix. |
Same as gk7205v200 and gk7205v300 (#18): CONFIG_FIT, CONFIG_SHA1 and CONFIG_OPENIPC_NOR_FIT_SPLIT in their fragments, and verify=n set before openipc_helper() so firmware_scan() can drop it for a FIT. Their kernels come from the same OpenIPC/linux goke-gk7205v200 branch, which carries mtdsplit, and OpenIPC/firmware already enables it for both. NOR images: gk7202v300 222 KB, gk7605v100 216 KB (256 KB boot partition). Build-tested only: no gk7202v300 or gk7605v100 board was run.
…0 family (#605) A new page for the split NOR layout on GK7205V200, GK7205V300, GK7202V300 and GK7605V100 (OpenIPC/linux#96, OpenIPC/u-boot#18 and #19, OpenIPC/firmware#2617 and #2621): - what the layout is, and how mtdsplit divides it at boot; - what it needs: the u-boot-<soc>-nor.bin bootloader and the -split package; - how to tell which layout a camera runs; - moving a camera over: the bootloader, then sysupgrade -k -r; - how sysupgrade carries the settings, -n, and what it refuses; - writing the image from U-Boot, and going back to fixed slots. The console lines quoted are from the lab GK7205V200 and GK7205V300. Linked from the README, install-goke and sysupgrade.
…yout (#482) * Wizard: the GK7205V200 family on OpenIPC/u-boot, and the split NOR layout GK7202V300, GK7205V200, GK7205V210, GK7205V300 and GK7605V100 now install OpenIPC/u-boot's u-boot-<soc>-nor.bin (OpenIPC/u-boot#18, #19), published in latest, in place of the -universal.bin of the retired u-boot-gk7205v200 repository. That bootloader scans the NOR layout at boot, so these SoCs take the #477 install: each image written at its offset, no uknor/urnor macros, no sf lock. The same bootloader boots the split NOR layout (OpenIPC/linux#96, OpenIPC/firmware#2617, #2621): one firmware.bin -- a hashed FIT, then the squashfs at the next 64 KiB -- at 0x50000, which the kernel divides into kernel, rootfs and rootfs_data at boot. Their firmware publishes it as openipc.<board>-nor-<edition>-split.tgz beside the fixed-slot package. The catalogue marks these SoCs nor_split; where the -split package is published for the board and edition, the Linux step writes that one image at 0x50000 and erases to the end of the chip in the same guarded line (0x7b0000 on 8 MB, 0xfb0000 on 16 MB), and the page links the -split package. Where it is not, the two-image install stays. The full image and the backup/restore steps are unchanged: the bootloader boots the fixed slots the full image carries. The fixture index gains the four published u-boot-<soc>-nor.bin, so the availability reference stands; boards.json and the documents golden are regenerated for the five SoCs. TestSplitNORInstall covers the split lines, gk7205v210 through its gk7205v200 build, the SD path, and the fall-back when no -split package is published. The split install was verified on the lab GK7205V200 (8 MB) and GK7205V300 (16 MB) with these bootloaders and the 2026-10-17 nightly's images, by the same U-Boot write: boots with the FIT hashes checked and kernel, rootfs and rootfs_data where the image puts them. * Wizard: the GK7205V200 family's NAND bootloader is OpenIPC/u-boot's -nand.bin Review of the previous commit: Bootloader("nand") falls back to uboot_filename, so moving these SoCs to u-boot-<soc>-nor.bin handed that NOR build to NAND installs and NAND full images. OpenIPC/u-boot publishes a NAND build for each of them too, u-boot-<soc>-nand.bin in latest, and that build is the UBI-only layout (768k boot, 256k env, the rest one UBI device), the same as u-boot-xmedia's. So the catalogue names it as uboot_nand_filename, which is what moves a SoC's NAND installs onto that layout; defib (OpenIPC/defib#154) installs these SoCs on NAND the same way. The retired -universal.bin, and its split NAND layout, is not offered for them again. The fixture index gains the four published -nand.bin. boards.json carries them; the gk7202v300 NAND row of the image reference is dropped, since it is the split NAND layout this SoC no longer installs (hi3516av100's row still covers that layout). The documents golden is regenerated.
This is opt-in through
CONFIG_OPENIPC_NOR_FIT_SPLIT, enabled here for gk7205v200 and gk7205v300. The NOR offsets inopenipc-common.hare unchanged, and a uImage at the kernel offset boots exactly as before.A FIT at the NOR kernel offset means the split layout:
firmware.bin, which is the hashed FIT followed by the squashfs at the next 64 KiB, written whole at 0x50000. In that casefirmware_scan():mtdparts=sfc:256k(u-boot),64k(env),-(firmware). The kernel then splits that partition into kernel, rootfs and rootfs_data (mtdsplit, mtd: split a firmware partition into kernel, rootfs and rootfs_data linux#96).Changes:
root=/dev/mtdblock3is rewritten in RAM tomtdblock4under the split numbering, and tomtdblock3for fixed slots.openipc_nor_fit=1joins the command line on either layout. sysupgrade looks for it before writing afirmware.bin, and refuses without it.bootm_sizeis set when a saved env lacks it.misc_init_r()used to setverify=nafteropenipc_helper(), and envs saved by the old bootloaders carryverify=ntoo. The board now sets it first, and the FIT path unsets it in RAM.CONFIG_FITandCONFIG_SHA1for these boards bring the NOR images to 216–217 KB of 256 KB.hi3516cv610 also boots a FIT from NOR, but its kernel has no mtdsplit, so the option stays off there.
Verified on hardware
GK7205V200 (8 MB NOR) and GK7205V300 (16 MB NOR), the latter with an env saved by u-boot-gk7205v200:
Verifying Hash Integrity ... crc32+ sha1+ OKfor the kernel and the DTB, the kernel splitsfirmwareat the computed offsets, and boot reaches login.root=/dev/mtdblock3plus the token).-nall work, with settings carried where they should be.Review fix
kernsize,rootaddrandrootsizenow name the fixed slots. Souk/ur/fwupd, which install a uImage and a squashfs, rebuild a consistent fixed-slot layout instead of writing at split offsets.loadkernelreads the slot, which holds the whole FIT.Verified on GK7205V200 with U-Boot loaded into RAM:
urthenukfrom TFTP turn a split camera into fixed slots, which boot.