sysupgrade: route by build platform + SoC aliases; cv6xx combined-image OTA#2181
Merged
Merged
Conversation
…bined image Self-upgrade derived the camera's identity from the chip (fw_printenv -n soc / ipcinfo) and required it to exactly equal the published SOC_MODEL, so one image named hi3516cv6xx could not be found or validated by a die reporting hi3516cv610/hi3516cv608 (regression from #2175), and it forced wasted CI builds of byte-identical pairs (xm530/xm550, gk7205v200/gk7205v210). - sysupgrade (1.0.52 -> 1.0.53): derive `model` from os-release BUILD_PLATFORM (leading _-token; no SOC_MODEL contains '_'), fall back to fw_printenv only when absent and make it non-fatal. Use `model` for the manifest key, default download name, extracted artifact names and check_soc. Add resolve_model_alias() (manifest @alias records + a small static net). Add do_update_firmware() for the cv6xx combined image (FIT kernel + rootfs in one blob): whole-blob flash to a `firmware` partition when present, else split at the FIT boundary onto the existing kernel/rootfs partitions. FIT-aware guards in do_update_kernel and get_kernel_version. - New BR2_OPENIPC_SOC_ALIASES defconfig field (Config.in + external.mk export); declared on hi3516cv6xx_ultimate (hi3516cv610/608), xm530_lite (xm550), gk7205v200_lite (gk7205v210). - enrich_manifest.py: scan defconfigs and emit @alias records into manifest.flat plus an aliases map in manifest.json (schema unchanged; the rows are inert to the existing busybox awk readers). - build.yml: drop the duplicate gk7205v210_lite and xm550_lite matrix entries. Their defconfigs are kept (excluded from CI, still buildable locally). Verified with host unit tests, a host integration harness against the real cv6xx tgz (16/16), and a real QEMU boot under the on-image busybox (11/11) up to the flash step (the hi3516cv610 QEMU machine has no SPI-NOR to flashcp). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Validated the combined-image OTA against a full 16 MB SPI-NOR image in the hi3516cv610 QEMU machine (HiFMC emulation, flash-boot from NOR, real /proc/mtd partitions). The full-flash test surfaced two issues: - do_update_firmware preferred the dedicated "firmware" partition, but on cv6xx that partition OVERLAPS kernel+rootfs (env: 7168k@0x50000). Writing it via flashcp is risky and, for a fixed-offset U-Boot, only boot-consistent when the kernel partition happens to equal the FIT size. Prefer the traditional non-overlapping split instead: slice the blob at the FIT boundary and flash the FIT to the kernel partition and the rootfs to the rootfs partition (U-Boot reads each from its fixed offset). Whole-blob flash to a dedicated "firmware" partition is now only the fallback for a pure-combined layout (no separate kernel/rootfs partitions). - the whole-blob branch ignored flashcp's exit status and always printed "Firmware updated"; it now `|| die`s on flashcp failure. The QEMU HiFMC model verified the kernel/FIT write to NOR end-to-end; it intentionally write-protects detected SquashFS blocks, so an in-emulator rootfs flashcp is blocked by design (real hardware flashes the rootfs normally). Host sysupgrade harness still 16/16. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Member
Author
Validated
|
…comment) Follow-up to the cross-agent QEMU validation of this branch (hi3516ev300 split + hi3516cv610 combined, both pass): - get_kernel_version: display the uImage epoch with `date -d @seconds "+FMT"`. A bare positional `@SECONDS` is treated by busybox as a clock-SET request ("date: can't set date: Invalid argument") and prints nothing, which would make compare_versions see two empty strings and wrongly skip the kernel update. (Pre-existing since 1.0.52; the `@seconds` form is only valid after -d per busybox 1.36.1 coreutils/date.c.) - get_system_info: tighten the comment — fw_printenv returns nothing when the U-Boot env partition is empty/unwritten (not "fails under QEMU"; with a populated env it reads soc fine). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
sysupgradederives a camera's upgrade identity from the chip (fw_printenv -n soc, effectivelyipcinfochip detection) and requires it to exactly equal the publishedSOC_MODEL. That breaks two ways:hi3516cv6xximage serves dies that reporthi3516cv610/hi3516cv608, so the chip's id never matches the publishedhi3516cv6xxat any of the upgrade steps (extracted filenames, kernel/rootfs SoC checks, default download name, manifest key) → "Wrong SoC" / "No artifact" / file-not-found.SOC_MODEL(xm530/xm550,gk7205v200/gk7205v210) purely so each chip can find "its" image.Key invariant: no
SOC_MODELcontains_, soSOC_MODELis the leading_-token ofBUILD_PLATFORM(holds even for builder's${soc}_${variant}_${device}).Changes
1. Identity by build platform, not chip (
general/overlay/usr/sbin/sysupgrade, 1.0.52 → 1.0.53)Derive
modelfrom os-releaseBUILD_PLATFORM; fall back tofw_printenvonly when absent and make it non-fatal (it also fails under QEMU). All upgrade-identity uses switch from$socto$model;check_socvalidates the image's stamped SoC against$model. This alone fixes cv6xx with no data files.2. SoC-alias indirection (one image legitimately serves several chips)
New
BR2_OPENIPC_SOC_ALIASESdefconfig field (general/Config.in+external.mk), declared onhi3516cv6xx_ultimate(hi3516cv610 hi3516cv608),xm530_lite(xm550),gk7205v200_lite(gk7205v210).enrich_manifest.pyscans the defconfigs and emits@alias <chip> <model>intomanifest.flat+ analiasesmap inmanifest.json(schema unchanged; rows are inert to the existing busybox awk readers).resolve_model_alias()rewritesmodelvia the manifest, with a small static net so offline /--archivemigrations also resolve.3. CI dedup (
.github/workflows/build.yml)Drop the duplicate
gk7205v210_liteandxm550_litematrix entries. Their defconfigs are kept (excluded from CI, still buildable locally; documented with a NOTE header).4. cv6xx combined-image upgrade variant
cv6xx ships one
firmware.bin= FIT kernel + rootfs in a single blob with a floating boundary. Newdo_update_firmware(): flash the whole blob to a dedicatedfirmwarepartition when one exists (flexible kernel/rootfs split), else slice it at the FIT boundary onto the existingkernel/rootfspartitions. FIT-aware guards indo_update_kernelandget_kernel_version(the uImage offset probes misfire on a FIT).Verification
@aliasawk inertness,scan_aliases→{xm550:xm530, gk7205v210:gk7205v200, hi3516cv610:hi3516cv6xx, hi3516cv608:hi3516cv6xx}..tgz, mocking only camera-only binaries: 16/16 (real FIT split, real squashfs hostname check, flashcp →/dev/mtd2//dev/mtd3; plus xm550→xm530--list-builds).~/git/qemu-hisilicon,-M hi3516cv610, on-image busybox, expect-driven): 11/11 —Model=hi3516cv6xxresolves fromBUILD_PLATFORMdespitefw_printenvfailing, and combined--buildruns download → split → FIT guard → loop-mount + SoC OK, up to the flash step.The
flashcpwrite itself can't be exercised in QEMU (thehi3516cv610machine has no SPI-NOR) — that still needs a real CV610 board.Follow-up (not in this PR)
The fully-flexible whole-blob path needs a combined
firmwaremtdparts partition + a u-boot bootcmd that locates rootfs at the dynamic post-FIT offset (u-boot/board repo). Until then the split-fallback path works on the current cv6xx layout. Staleopenipc.xm550-*.tgz/openipc.gk7205v210-*.tgzassets on the rolling releases can be deleted once to fully retire those keys.🤖 Generated with Claude Code