Skip to content

install: the split NOR layout for hi3516ev200, hi3518ev300 and hi3516dv200 - #160

Merged
widgetii merged 1 commit into
masterfrom
install/split-hi3516ev200
Oct 21, 2026
Merged

widgetii merged 1 commit into
masterfrom
install/split-hi3516ev200

Conversation

@widgetii

Copy link
Copy Markdown
Member

Their firmware now ships the split NOR package beside the fixed-slot one (OpenIPC/firmware#2655, on OpenIPC/linux#131), and their OpenIPC/u-boot NOR build scans for it (OpenIPC/u-boot#48), so they join NOR_SPLIT_SOCS: one firmware.bin.<soc> at 0x50000, the rest of the chip erased. They already take u-boot-<soc>-nor.bin (PER_FLASH_TYPE_UBOOT).

hi3516ev300 stays on fixed slots: its uImage (2009K with the split options) fills the 2 MiB slot, over the 1983K a fixed-slot package beside a split one may use, so its firmware ships no split package. A test keeps it out even though its profile is an alias of hi3516ev200.

The split package appears with the next nightly. Until the U-Boot publish workflow runs again, the published u-boot-<soc>-nor.bin predates #48: the split image still boots under it (the kernel ignores its fixed mtdparts, checked in QEMU), but its scan and fwupd for the split image come with the republished build.

Not run on hardware; the firmware side was checked in qemu-hisilicon (hi3516ev200, hi3518ev300; 8 and 16 MB). pytest tests/ --ignore=tests/fuzz: 1084 passed. ruff and mypy are clean.

…dv200

Their firmware ships the split NOR package beside the fixed-slot one
(OpenIPC/firmware#2655, on OpenIPC/linux#131), and their OpenIPC/u-boot
NOR build scans for it (OpenIPC/u-boot#48), so they join NOR_SPLIT_SOCS: one firmware.bin.<soc> at
0x50000, the rest of the chip erased.

hi3516ev300 stays on fixed slots: its uImage (2009K with the split
options) fills the 2 MiB slot, over the 1983K a fixed-slot package beside
a split one may use, so its firmware ships no split package.

Not run on hardware; the firmware side was checked in qemu-hisilicon.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Enable split NOR installs for three HiSilicon SoCs

✨ Enhancement 🧪 Tests 📝 Documentation 🕐 10-20 Minutes

Grey Divider

AI Description

• Enable split NOR packages for hi3516ev200, hi3518ev300, and hi3516dv200.
• Keep hi3516ev300 on fixed slots because its kernel exceeds the compatible size limit.
• Test SoC eligibility and document the supported layouts.
Diagram

graph TD
  A["SoC profile"] --> B{"Split eligible?"} -->|Yes| C["Split NOR package"] --> D["NOR installer"] --> E["NOR flash"]
  B -->|ev300: no| F["Fixed-slot package"] --> D
Loading
High-Level Assessment

Extending the existing package-board eligibility set is the appropriate approach: the split installer and per-flash-type U-Boot selection already exist. Inferring eligibility from the shared profile would incorrectly admit hi3516ev300, so explicit exclusion is warranted.

Files changed (3) +7 / -2

Enhancement (1) +3 / -0
firmware.pyEnable split NOR eligibility for three SoCs +3/-0

Enable split NOR eligibility for three SoCs

• Adds hi3516ev200, hi3518ev300, and hi3516dv200 to NOR_SPLIT_SOCS. Leaves hi3516ev300 on fixed slots because its kernel fills the available slot.

src/defib/firmware.py

Tests (1) +2 / -1
test_install_nor_split.pyCover split NOR eligibility for the added SoCs +2/-1

Cover split NOR eligibility for the added SoCs

• Extends the eligibility assertion to all three SoCs. The existing assertion continues to guard against admitting hi3516ev300.

tests/test_install_nor_split.py

Documentation (1) +2 / -1
CLAUDE.mdDocument the expanded split NOR SoC list +2/-1

Document the expanded split NOR SoC list

• Adds the three supported SoCs to the layout guidance and explicitly notes that hi3516ev300 remains excluded.

CLAUDE.md

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

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Fixed-slot installs can use wrong partitions 🐞 Bug ≡ Correctness
Description
Adding these chips to NOR_SPLIT_SOCS also makes scanning_nor_uboot select env default -a for
fixed-slot packages, replacing the previous explicit mtdparts and bootcmd setup. When a NOR
U-Boot's defaults describe different slots from those selected for the detected flash size, the
installer still writes the selected slots but saves the mismatched defaults; this also affects
existing fixed-slot packages, not just the new split packages.
Code

src/defib/firmware.py[92]

+    "hi3516ev200", "hi3518ev300", "hi3516dv200",
Evidence
Membership now controls both split-package acceptance and the scanning-environment branch. That
branch resets defaults without setting partitions, while the former branch constructed mtdparts
from the detected NOR size. The repository defines different 8 MiB and 16 MiB fixed-slot offsets and
includes an 8 MiB fixed default in its generic boot-environment test; the repository does not
establish that every currently published NOR binary for the added chips supplies defaults matching
the installer-selected size.

src/defib/firmware.py[86-93]
src/defib/install/orchestrator.py[234-265]
src/defib/install/orchestrator.py[1760-1781]
src/defib/install/orchestrator.py[1810-1821]
src/defib/install/layout.py[15-34]
tests/test_ds_i203_final_contract.py[795-799]

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

## Issue description
Adding split-package support also changes how fixed-slot installs configure the boot environment. An older NOR U-Boot with fixed defaults can retain partition settings that disagree with the installer-selected flash layout.
## Fix Focus Areas
- src/defib/firmware.py[86-93]
- src/defib/install/orchestrator.py[234-265]
- src/defib/install/orchestrator.py[1760-1821]
## Recommended Fix
Decouple eligibility for a split firmware package from the decision to rely on a scanning U-Boot's default environment. Preserve or verify layout-matching environment settings for fixed-slot installs using a non-scanning NOR binary, and test the path with mismatched default and detected flash sizes.

ⓘ 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
"hi3516cv300", "hi3516ev100",
# Not hi3516ev300: its kernel fills the 2 MiB slot, so its firmware
# ships fixed slots only.
"hi3516ev200", "hi3518ev300", "hi3516dv200",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

1. Fixed-slot installs can use wrong partitions 🐞 Bug ≡ Correctness

Adding these chips to NOR_SPLIT_SOCS also makes scanning_nor_uboot select env default -a for
fixed-slot packages, replacing the previous explicit mtdparts and bootcmd setup. When a NOR
U-Boot's defaults describe different slots from those selected for the detected flash size, the
installer still writes the selected slots but saves the mismatched defaults; this also affects
existing fixed-slot packages, not just the new split packages.
Agent Prompt
## Issue description
Adding split-package support also changes how fixed-slot installs configure the boot environment. An older NOR U-Boot with fixed defaults can retain partition settings that disagree with the installer-selected flash layout.

## Fix Focus Areas
- src/defib/firmware.py[86-93]
- src/defib/install/orchestrator.py[234-265]
- src/defib/install/orchestrator.py[1760-1821]

## Recommended Fix
Decouple eligibility for a split firmware package from the decision to rely on a scanning U-Boot's default environment. Preserve or verify layout-matching environment settings for fixed-slot installs using a non-scanning NOR binary, and test the path with mismatched default and detected flash sizes.

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping this. The env default -a path runs only when the same install wrote the U-Boot ("uboot" in stage_set), and for these SoCs that is the published u-boot-<soc>-nor.bin: built by OpenIPC/u-boot openipc-hisilicon since u-boot-xmedia stopped publishing them, and it scans the layout on fixed slots too, so its defaults always match what is on the flash. In qemu-hisilicon, the published u-boot-hi3516ev200-nor.bin (2022.10-g862ab6b1) on fixed-slot images:

  • 8 MB lite: Found RootFS at 0x00250000, mtdparts=...2048k(kernel),5120k(rootfs)..., root on 31:3;
  • 16 MB ultimate: Found RootFS at 0x00350000, mtdparts=...3072k(kernel),10240k(rootfs)..., root on 31:3.

A hand-supplied non-scanning --uboot binary would hit the same assumption on the gk7205v200 family and hi3516cv300 already; deciding on the U-Boot rather than the SoC would be its own change across all split SoCs.

@widgetii
widgetii merged commit 8bbd026 into master Oct 21, 2026
13 checks passed
@widgetii
widgetii deleted the install/split-hi3516ev200 branch October 21, 2026 14:55
widgetii added a commit that referenced this pull request Oct 22, 2026
hi3516ev300's firmware now ships only the split NOR package, like
hi3516cv6xx (OpenIPC/firmware#2656): its uImage (2008K with the split
options) fills the 2 MiB slot, so a fixed-slot package cannot ship
beside a split one. hi3518ev300 went split-only in the same PR; it is
already in `NOR_SPLIT_SOCS` (#160).

- hi3516ev300 joins `NOR_SPLIT_SOCS`, so `install` writes
`firmware.bin.hi3516ev300` at 0x50000 and erases the rest of the chip;
its U-Boot is the published `u-boot-hi3516ev300-nor.bin` (split mode
since OpenIPC/u-boot#48).
- The refusal test that used hi3516ev300 as a chip without the split
layout now uses hi3518ev200. CLAUDE.md lists it.

The split package appears with the next nightly. Not run on hardware;
the firmware side was checked in qemu-hisilicon (8 MB lite, 16 MB
ultimate: root on the split rootfs, overlay kept across a reboot).
`pytest tests/ --ignore=tests/fuzz`: 1084 passed. ruff and mypy are
clean.
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