Skip to content

install: the split NOR layout for hi3516cv300 and hi3516ev100 - #158

Merged
widgetii merged 2 commits into
masterfrom
install/split-hi3516cv300
Oct 21, 2026
Merged

widgetii merged 2 commits into
masterfrom
install/split-hi3516cv300

Conversation

@widgetii

Copy link
Copy Markdown
Member

hi3516cv300 and hi3516ev100 now ship the split NOR package (OpenIPC/firmware#2645, on OpenIPC/linux#127), and their OpenIPC/u-boot NOR build scans for it (OpenIPC/u-boot#42). Both join NOR_SPLIT_SOCS: one firmware.bin.<soc> at 0x50000, the rest of the chip erased.

  • Their U-Boot comes from OpenIPC/u-boot as u-boot-<soc>-nor.bin (plus -nand.bin for cv300), so they move from AVAILABLE_FIRMWARE to PER_FLASH_TYPE_UBOOT. The u-boot-*-universal.bin still on the release is the U-Boot 2010.06 build, which knows no split layout.
  • hi3516ev100 publishes no NAND build: the new NOR_ONLY_UBOOT makes asking for one find none, not a URL that 404s.
  • Tests that used hi3516cv300 as their example of a universal image or of the legacy NAND layout now use hi3516cv200. CLAUDE.md lists the two SoCs.

Verified end to end on a hi3516cv300 board (imx291, W25Q128, 128 MiB), after a full flash backup:

defib install -c hi3516cv300 --firmware openipc.hi3516cv300-nor-lite-split.tgz \
  --uboot u-boot-hi3516cv300-nor.bin -p /dev/ttyUSB0 --power-cycle --poe-port ether3 ...

U-Boot at 0 (flash CRC 9507112D), firmware.bin at 0x50000 with 0x50000+0xFB0000 erased (flash CRC BD92A6E5), default env with the factory ethaddr restored. The next boot showed Found Kernel at 0x00050000, Found RootFS at 0x001f0000, Verifying Checksum ... OK, hi_sfc: split NOR layout, device tree partitions, root on 31:4, then the login prompt.

The install used local artifacts. The u-boot-hi3516{cv300,ev100}-nor.bin on the release predate OpenIPC/u-boot#42 and the split packages come with the next nightly, so the download path works once both are published.

pytest tests/ --ignore=tests/fuzz: 1082 passed. ruff and mypy are clean.

Their firmware now ships the split NOR package (OpenIPC/firmware#2645,
on OpenIPC/linux#127) and their OpenIPC/u-boot NOR build scans for it
(OpenIPC/u-boot#42), so both join NOR_SPLIT_SOCS: one
firmware.bin.<soc> at 0x50000, the rest of the chip erased.

Their U-Boot comes from OpenIPC/u-boot as u-boot-<soc>-nor.bin (and
-nand.bin for cv300), so they move from AVAILABLE_FIRMWARE to
PER_FLASH_TYPE_UBOOT. The u-boot-*-universal.bin still on the release
is the U-Boot 2010.06 build, which knows no split layout. hi3516ev100
publishes no NAND build; NOR_ONLY_UBOOT makes asking for one find none
rather than a URL that 404s. Tests that used hi3516cv300 as their
example of a universal image or of the legacy NAND layout use
hi3516cv200 now.

Verified end to end on a hi3516cv300 board (imx291, W25Q128, 128 MiB),
after a full flash backup:
  defib install -c hi3516cv300 --firmware openipc.hi3516cv300-nor-lite-split.tgz \
    --uboot u-boot-hi3516cv300-nor.bin -p /dev/ttyUSB0 --power-cycle \
    --poe-port ether3 --nic enp12s0 --host-ip ... --device-ip ...
U-Boot at 0 (flash CRC 9507112D), firmware.bin at 0x50000 with
0x50000+0xFB0000 erased (flash CRC BD92A6E5), default env with the
factory ethaddr restored; the next boot: "Found Kernel at 0x00050000",
"Found RootFS at 0x001f0000", "Verifying Checksum ... OK", "hi_sfc:
split NOR layout, device tree partitions", root on 31:4, login prompt.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Install split NOR firmware on hi3516cv300 and hi3516ev100

✨ Enhancement 🧪 Tests 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Enable split NOR installs for both SoCs, placing firmware after the boot and environment
 partitions.
• Select flash-specific U-Boot instead of legacy universal images; report no NAND build for
 hi3516ev100.
• Update tests and documentation; verify a hi3516cv300 install boots on hardware.
Diagram

graph TD
  A["Install request"] --> B{"Flash type?"} -->|NOR| C["Split lookup"] --> D["Firmware image"] --> E["NOR flash"]
  B --> F["U-Boot resolver"] -->|NOR build| E
  F -->|ev100 NAND| G["No build"]
  F -->|cv300 NAND| H["NAND build"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Exclude these SoCs from legacy offline U-Boot fallback
  • ➕ Prevents a cached U-Boot 2010.06 universal image from being paired with split NOR firmware when the download fails.
  • ➖ Removes an offline fallback that may still serve older, fixed-layout installations.

Recommendation: Reusing the existing split-layout and flash-specific asset tables is the right approach. Consider excluding these two SoCs from the existing offline universal-image fallback: their legacy U-Boot cannot scan the split layout, so a failed download could otherwise select an incompatible image.

Files changed (5) +34 / -17

Enhancement (1) +12 / -4
firmware.pySelect flash-specific U-Boot and split NOR for both SoCs +12/-4

Select flash-specific U-Boot and split NOR for both SoCs

• Moves both SoCs out of universal U-Boot selection and into flash-specific asset and split NOR lookups. Returns no asset for hi3516ev100 NAND requests.

src/defib/firmware.py

Tests (3) +19 / -11
test_firmware.pyCover new asset selection and retain a classic U-Boot example +14/-7

Cover new asset selection and retain a classic U-Boot example

• Tests hi3516cv300's per-flash naming and hi3516ev100's missing NAND asset. Uses hi3516cv200 for assertions about universal images.

tests/test_firmware.py

test_install_nor_split.pyAssert split NOR support for both SoCs +2/-1

Assert split NOR support for both SoCs

• Adds both SoCs to split-support checks and verifies hi3516cv300's boot and environment sizes, which place firmware at 0x50000.

tests/test_install_nor_split.py

test_nand_install.pyKeep the legacy NAND test on a classic SoC +3/-3

Keep the legacy NAND test on a classic SoC

• Switches the legacy NAND compatibility fixture and install request from hi3516cv300 to hi3516cv200.

tests/test_nand_install.py

Documentation (1) +3 / -2
CLAUDE.mdDocument the two SoCs' split NOR and U-Boot classifications +3/-2

Document the two SoCs' split NOR and U-Boot classifications

• Lists hi3516cv300 and hi3516ev100 among split NOR and flash-specific U-Boot SoCs, noting that hi3516ev100 has no NAND build.

CLAUDE.md

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Offline installs can leave cameras unbootable ✓ Resolved
Description
download_firmware can still return a cached universal U-Boot for these newly per-flash chips when
the NOR download fails, although that older build does not understand the split layout. An install
with a split package then writes firmware at 0x50000 and uses the bootloader's default environment,
so an offline user can flash an incompatible bootloader and firmware together.
Code

src/defib/firmware.py[58]

+    "hi3516cv300", "hi3516ev100",
Evidence
The new classifications activate both the split install and the previously existing offline fallback
for these chips. The PR's bootloader comment identifies their universal builds as incompatible,
while the installer accepts the returned file without checking its layout capability.

src/defib/firmware.py[46-58]
src/defib/firmware.py[80-84]
src/defib/firmware.py[418-434]
src/defib/install/orchestrator.py[237-266]
src/defib/install/orchestrator.py[317-330]
src/defib/install/orchestrator.py[1760-1790]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The offline NOR fallback can supply the older universal U-Boot for hi3516cv300 or hi3516ev100, even though their newly selected split layout requires a scanning U-Boot.
## Fix Focus Areas
- src/defib/firmware.py[418-434]
- src/defib/firmware.py[54-83]
- tests/test_firmware.py[345-370]
## Recommended Fix
Exclude these two chips from the legacy universal fallback while retaining it for compatible chips. Add an offline-download test for each new chip that confirms a cached universal image is not returned.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Browser recovery selects the old bootloader ✓ Resolved
Description
web/protocol.js has a separate per-flash chip list that omits hi3516cv300 and hi3516ev100, so its
asset resolver still selects their universal images. When either chip is selected, the release
filter discards its NOR image and the browser downloads the older build instead of the one now
selected by the Python recovery paths.
Code

src/defib/firmware.py[58]

+    "hi3516cv300", "hi3516ev100",
Evidence
Python now returns NOR-specific names for these chips, but the browser's unchanged mapping returns
universal names. Its release parser and download flow use that mapping to choose the bytes sent
during recovery.

src/defib/firmware.py[54-58]
src/defib/firmware.py[216-223]
web/protocol.js[193-234]
web/index.html[507-515]
web/index.html[551-562]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The browser retains a separate asset classification and still resolves both newly per-flash chips to their older universal U-Boot images.
## Fix Focus Areas
- web/protocol.js[193-234]
- web/protocol.test.js[625-628]
## Recommended Fix
Add hi3516cv300 and hi3516ev100 to the browser's per-flash NOR asset mapping. Test both direct asset-name resolution and release-asset filtering for the two chips.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can start a comment with 'qodo' or '@qodo' to chat about any finding

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread src/defib/firmware.py
Comment thread src/defib/firmware.py
From review:
- download_firmware() fell back offline to a cached
  u-boot-*-universal.bin for per-flash-type SoCs. For hi3516cv300 and
  hi3516ev100 that is U-Boot 2010.06, which cannot boot the split layout
  install now writes; NO_UNIVERSAL_FALLBACK makes the download fail
  instead.
- The Web UI's own list of -nor SoCs (XMEDIA_SOCS) gains both, so the
  browser loads the same OpenIPC/u-boot build as defib. That list also
  turns on SPL boundary detection, which this image needs: defib burn
  found its SPL at 0x5400 on the board, past the profile's 0x4F00.
@widgetii
widgetii merged commit 593c235 into master Oct 21, 2026
13 checks passed
@widgetii
widgetii deleted the install/split-hi3516cv300 branch October 21, 2026 04:00
widgetii added a commit to OpenIPC/website that referenced this pull request Oct 21, 2026
From review: their bootloader was still the -universal U-Boot 2010.06,
which does not scan the NOR layout, so the wizard never gave them the
split install (scansLayout) and fell back to fixed slots. They take
u-boot-<soc>-nor.bin (OpenIPC/u-boot 2022.10, scanning; cv300 also
-nand.bin), as defib does since OpenIPC/defib#158. The test index lists
those images, the boards reference names them, the golden is
regenerated for the two SoCs, and the test that used hi3516cv300 as its
-universal example uses hi3516cv200. go test ./... (uncached) passes.
widgetii added a commit to OpenIPC/website that referenced this pull request Oct 22, 2026
…yout (#491)

* Catalogue: hi3516ev300 on the split NOR layout, edition by edition

hi3516ev300's lite and ultimate builds now ship only the split NOR
package (OpenIPC/firmware split/hi3516ev300): its kernel fills the 2 MiB
slot, so no fixed-slot package can ship beside a split one. neo keeps
its own fixed-slot build.

nor_split, without nor_split_only: SplitOnlyEdition then takes the split
package for every edition that has one and no plain package, and keeps
neo on fixed slots; nor_split_only would have dropped neo from the
installer. That needs the stale plain openipc.hi3516ev300-nor-
{lite,ultimate}.tgz gone from the release once the split packages
publish; until then the site keeps offering them as fixed slots, as
today.

Tests: the fixture release index is moved to that state (the two
-split packages in, the plain lite/ultimate out; neo kept), and the
golden regenerated: hi3516ev300 still offers nor lite, ultimate, neo and
nand ultimate, lite and ultimate as split images. The two firmware
tests and the wizard test that used hi3516ev300 as a fixed-slot NOR SoC
use hi3516ev200 (same bootloaders and NAND layout, fixed slots kept).
go test ./... passes.

* Catalogue: hi3516cv300, hi3516ev100, hi3516ev200, hi3518ev300, hi3516dv200 on the split NOR layout

They ship -split packages since OpenIPC/firmware#2645, #2655 and #2656
(hi3518ev300 split-only, like hi3516ev300); nor_split lets each edition
use its split package where no plain one is published, and keeps the
fixed-slot one where it is. go test ./... (uncached) passes.

* Catalogue: hi3516cv300 and hi3516ev100 install their -nor U-Boot

From review: their bootloader was still the -universal U-Boot 2010.06,
which does not scan the NOR layout, so the wizard never gave them the
split install (scansLayout) and fell back to fixed slots. They take
u-boot-<soc>-nor.bin (OpenIPC/u-boot 2022.10, scanning; cv300 also
-nand.bin), as defib does since OpenIPC/defib#158. The test index lists
those images, the boards reference names them, the golden is
regenerated for the two SoCs, and the test that used hi3516cv300 as its
-universal example uses hi3516cv200. go test ./... (uncached) passes.
widgetii added a commit that referenced this pull request Oct 24, 2026
…t layout (#164)

`CHIP_TO_FIRMWARE` has mapped gk7201v200 to gk7205v200 since #4, when
gk7201v200 had nothing published of its own. So `defib install -c
gk7201v200` wrote **gk7205v200's U-Boot and firmware** onto it.

OpenIPC now publishes gk7201v200's own builds:
- `u-boot-gk7201v200-nor.bin` and `-nand.bin` (OpenIPC/u-boot,
`xm72010200`);
- `openipc.gk7201v200-nor-lite.tgz`, built on the gk7205v500 kernel tree
with gk7201v200's own vendor modules (OpenIPC/firmware#2478).

This PR:
- **Drops the alias.** gk7201v200 takes its `-nor`/`-nand` U-Boot
(`PER_FLASH_TYPE_UBOOT`) and its own firmware.
- **Adds it to `NOR_SPLIT_SOCS`.** Its kernel finds the split layout
since OpenIPC/linux#140, its U-Boot scans it since OpenIPC/u-boot#61,
and its firmware ships `-split` beside the fixed-slot package since
OpenIPC/firmware#2668.
- **Leaves gk7201v300 alone.** It has its own U-Boot builds but no
firmware package.

Not in this PR: hi3516cv200 and hi3518ev200 also ship `-split` since
OpenIPC/firmware#2668, but defib keeps installing them on fixed slots
for now.
- Today defib gives them the old `-universal` U-Boot. Its default
environment describes the lite fixed slots, so installing the split
layout with it would break the hi3518ev200 ultimate fixed-slot install.
- Moving them to the scanning `-nor.bin` U-Boot, as #158 did for
hi3516cv300, needs a NAND U-Boot build for hi3518ev200's NAND package
and a decision on its DDR3 boards. Neither exists yet.

Tests: `test_gk7201v200_installs_its_own_build` checks there's no alias,
that gk7201v200 uses its own NOR/NAND U-Boot names, that it's
split-capable, and that it has its own package board. The per-flash-type
U-Boot list includes it too. pytest, ruff and mypy are clean.

The firmware side was checked in qemu-hisilicon (gk7201v200, 8 MB; see
OpenIPC/firmware#2668). Not run on hardware.
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