Repository navigation
install: the split NOR layout for hi3516ev200, hi3518ev300 and hi3516dv200 - #160
Conversation
…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.
PR Summary by QodoEnable split NOR installs for three HiSilicon SoCs
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1. Fixed-slot installs can use wrong partitions
|
| "hi3516cv300", "hi3516ev100", | ||
| # Not hi3516ev300: its kernel fills the 2 MiB slot, so its firmware | ||
| # ships fixed slots only. | ||
| "hi3516ev200", "hi3518ev300", "hi3516dv200", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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.
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: onefirmware.bin.<soc>at 0x50000, the rest of the chip erased. They already takeu-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.binpredates #48: the split image still boots under it (the kernel ignores its fixed mtdparts, checked in QEMU), but its scan andfwupdfor 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.