Skip to content

firmware: resolve CV6xx boot images by their real asset names - #117

Merged
widgetii merged 1 commit into
masterfrom
fix/cv6xx-firmware-asset-names
Jul 28, 2026
Merged

firmware: resolve CV6xx boot images by their real asset names#117
widgetii merged 1 commit into
masterfrom
fix/cv6xx-firmware-asset-names

Conversation

@widgetii

Copy link
Copy Markdown
Member

Follow-up to a latent bug spotted while working on #113.

The bug

hi3516cv608 and hi3516cv610 were listed in AVAILABLE_FIRMWARE, so firmware_url() built:

https://github.com/OpenIPC/firmware/releases/download/latest/u-boot-hi3516cv608-universal.bin  -> 404
https://github.com/OpenIPC/firmware/releases/download/latest/u-boot-hi3516cv610-universal.bin  -> 404

No u-boot-*-universal.bin has ever existed for any CV6xx SoC (cv608, cv610, cv613, dv500, dv500), so defib auto-download for those chips always failed.

This wasn't an oversight — #112 added them deliberately to get past the install gate at cli/app.py:2297, noting "the main OpenIPC/firmware releases manifest doesn't carry it yet" and instructing users to hand-seed ~/.cache/defib/firmware/. That caveat is now stale. The release does publish these images, under a different naming scheme:

boot-hi3516cv608-nor.bin              241664
boot-hi3516cv610-{00g,00s,10b,20g,20s}-nor.bin   241664 each
boot-hi3519dv500-{dmeb,dmebpro}-nor.bin          392192 each

These are the composite GSL + DDR tables + U-Boot blobs the CV6xx bootrom expects — i.e. the same content #112 had users seed by hand, just fetchable now.

The fix

Resolution goes through a new asset_name() that selects the naming scheme per SoC family. Verified against the live release — every chip the module claims to support now resolves to an asset returning HTTP 200:

chip has_firmware resolved asset
hi3516cv608 boot-hi3516cv608-nor.bin (200)
hi3516cv610 ambiguous — needs variant
hi3516cv610:00g boot-hi3516cv610-00g-nor.bin (200)
hi3519dv500:dmebpro boot-hi3519dv500-dmebpro-nor.bin (200)
hi3516cv613, hi3516dv500 no published image
hi3516ev300, hi3516ev300:emmc u-boot-hi3516ev300-universal.bin (200) — unchanged

The downloaded hi3516cv608 image matches the release SHA-256 (12c697d1…) and parses cleanly through parse_cv6xx_boot (gsl=22528B uboot=204800B tables=1).

Why variants must be explicit

I compared all five cv610 images. The GSL is byte-identical, but each ships a different U-Boot, and the DDR table differs by the numeric prefix00g/00s share one, 10b another, 20g/20s a third. Nothing in the CV6xx handshake identifies the board, so a guessed variant risks flashing the wrong DDR configuration. Chips with multiple images now require chip:variant (reusing defib's existing suffix convention) and otherwise fail early with:

'hi3516cv610' needs an explicit board variant — OpenIPC publishes 5 different
boot images for hi3516cv610 and they carry different DDR settings, so the right
one cannot be guessed. Use one of: hi3516cv610:00g, hi3516cv610:00s,
hi3516cv610:10b, hi3516cv610:20g, hi3516cv610:20s. Or use -f/--file ...

Previously this passed the gate and then died mid-flow on a 404.

No regression for #112 users

get_cached_path() still reads the historic u-boot-{chip}-universal.bin name, and has_firmware() now also returns True when only a cached blob exists — so hand-seeded caches keep opening the install gate even for chips with no published build. Covered by tests, including one run with an adversarially seeded cache.

Also

Adds hi3520dv200, hi3536cv100, hi3536dv100 — they ship u-boot-*-universal.bin assets the set never listed (same staleness fixed web-side in #115).

Test plan

  • 15 new tests; 555 passed, 2 skipped, fuzz 16 passed
  • ruff check and mypy clean
  • Live HTTP verification of every resolved URL, and a real download + digest + parse check for hi3516cv608

Not touched: the web UI still offers no auto-download for CV6xx (it only indexes u-boot-*-universal.bin), so those chips require a local file there. Worth revisiting once #113 has a working transport.

🤖 Generated with Claude Code

hi3516cv608 and hi3516cv610 were registered in AVAILABLE_FIRMWARE, which
made firmware_url() build a u-boot-{chip}-universal.bin URL. No such
asset has ever existed for any CV6xx SoC, so every auto-download 404'd.
#112 added them anyway to get past the install gate at cli/app.py:2297,
noting that "the main OpenIPC/firmware releases manifest doesn't carry
it yet" and telling users to hand-seed the cache instead. That caveat is
now stale: the release does publish these images, as
boot-{chip}[-{variant}]-nor.bin — the composite GSL + DDR tables +
U-Boot blob the CV6xx bootrom expects, which is the same content #112
had users seed by hand.

Resolution now goes through asset_name(), which picks the naming scheme
per SoC family. Verified against the live release: every chip the module
claims to support resolves to an asset that returns HTTP 200, and the
downloaded hi3516cv608 image matches the release SHA-256 and parses
cleanly via parse_cv6xx_boot (gsl=22528B, uboot=204800B).

CV6xx variants are board-specific and cannot be guessed. Across the five
hi3516cv610 images the GSL is identical, but each ships a different
U-Boot and the DDR table differs by the numeric prefix (00g/00s share
one, 10b another, 20g/20s a third). Nothing in the recovery handshake
identifies the board, so flashing a guessed variant risks the wrong DDR
config. Chips with multiple images therefore require an explicit
"chip:variant" and otherwise fail early with a message listing the
options, rather than mid-flow on a 404.

Hand-seeded caches from #112 keep working: get_cached_path() still reads
the historic u-boot-{chip}-universal.bin name, and has_firmware() now
also returns True when only a cached blob exists, so the install gate
still opens for chips with no published build.

Also adds hi3520dv200, hi3536cv100 and hi3536dv100, which ship
u-boot-*-universal.bin assets the set had never listed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@widgetii
widgetii merged commit 88b3f1b into master Jul 28, 2026
13 checks passed
@widgetii
widgetii deleted the fix/cv6xx-firmware-asset-names branch July 28, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant