Skip to content

nor: split layout on hi3519v101, hi3516av200 and hi3536cv100 - #63

Merged
widgetii merged 2 commits into
openipc-hisiliconfrom
nor/split-round3
Oct 24, 2026
Merged

widgetii merged 2 commits into
openipc-hisiliconfrom
nor/split-round3

Conversation

@widgetii

Copy link
Copy Markdown
Member

CONFIG_OPENIPC_NOR_SPLIT for the two 3.18 families whose kernels now find the split NOR layout from their device tree:

SoCs configs kernel
hi3519v101, hi3516av200 hi3519v101_config, hi3516av200_config OpenIPC/linux#145 (hisilicon-hi3519v101)
hi3536cv100 hi3536cv100_config OpenIPC/linux#146 (hisilicon-hi3536cv100)

Each board's misc_init_r() now sets verify=n before openipc_helper(), as #52, #61 and #62 did. The scan can then clear it for a split image, and bootm checks the uImage CRC. Fixed-slot cameras boot as before.

NOR images: u-boot-hi3519v101-nor.bin 162684 bytes, u-boot-hi3516av200-nor.bin 162720, u-boot-hi3536cv100-nor.bin 143656, all inside the 256K boot area.

Tested in qemu-hisilicon with each family's lite build on its new kernel (8 MB):

Case hi3519v101 hi3536cv100
split image, this U-Boot squashfs found at the next block, root-less command line, kernel's split, root on 31:4, login same
overlay across a power cycle kept kept
fixed-slot package fixed mtdparts, root on 31:3 same
fwupd over TFTP from fixed slots, and from a damaged kernel (fails its CRC) written byte-identical, boots split the scan sends the damaged kernel to recovery, but the download crashes

The hi3536cv100 download fails because U-Boot's gmac takes a data abort on the first TFTP packet in qemu-hisilicon. The published U-Boot fails the same way, so it's the emulated network or the gmac driver, not this change. Not run on hardware.

CONFIG_OPENIPC_NOR_SPLIT for hi3519v101 and hi3516av200, whose kernel
(OpenIPC/linux hisilicon-hi3519v101) finds the split layout from its
device tree. misc_init_r() sets verify=n before openipc_helper().

NOR images: u-boot-hi3519v101-nor.bin 162684 bytes,
u-boot-hi3516av200-nor.bin 162720 bytes.
CONFIG_OPENIPC_NOR_SPLIT for hi3536cv100, whose kernel (OpenIPC/linux
hisilicon-hi3536cv100) finds the split layout from its device tree.
misc_init_r() sets verify=n before openipc_helper().

NOR image: u-boot-hi3536cv100-nor.bin 143656 bytes.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Enable split NOR boot layouts on three HiSilicon SoCs

✨ Enhancement ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Enable split NOR detection for hi3519v101, hi3516av200, and hi3536cv100 builds.
• Set verification before scanning so split images receive kernel CRC checks while fixed-slot images
 retain existing behavior.
• Use the kernels’ device-tree partition layouts for split firmware.
Diagram

graph TD
  C["Board configs"] --> I["Board initialization"] --> H["OpenIPC helper"] --> S["NOR scan"] --> D{"Split layout?"} -->|Yes| P["CRC-checked boot"] --> K["Boot kernel"]
  D -->|No| F["Fixed slots"] --> K
Loading
High-Level Assessment

Reuse the existing CONFIG_OPENIPC_NOR_SPLIT scan rather than adding board-specific partition detection. Setting verify before the helper lets that scan select CRC verification for split images without changing fixed-slot boot behavior.

Files changed (6) +18 / -3

Enhancement (3) +6 / -3
board.cSet verification default before the hi3516av200 scan +2/-1

Set verification default before the hi3516av200 scan

• Moves verify=n ahead of openipc_helper(), allowing a detected split image to clear it so bootm checks the kernel CRC.

board/hisilicon/hi3516av200/board.c

board.cSet verification default before the hi3519v101 scan +2/-1

Set verification default before the hi3519v101 scan

• Moves verify=n ahead of openipc_helper(), allowing a detected split image to clear it so bootm checks the kernel CRC.

board/hisilicon/hi3519v101/board.c

board.cSet verification default before the hi3536cv100 scan +2/-1

Set verification default before the hi3536cv100 scan

• Moves verify=n ahead of openipc_helper(), allowing a detected split image to clear it so bootm checks the kernel CRC.

board/hisilicon/hi3536c/board.c

Other (3) +12 / -0
hi3516av200_configEnable split NOR handling for hi3516av200 +4/-0

Enable split NOR handling for hi3516av200

• Enables CONFIG_OPENIPC_NOR_SPLIT for the build whose kernel derives the firmware split from its device tree.

openipc/hi3516av200_config

hi3519v101_configEnable split NOR handling for hi3519v101 +4/-0

Enable split NOR handling for hi3519v101

• Enables CONFIG_OPENIPC_NOR_SPLIT for the build whose kernel derives the firmware split from its device tree.

openipc/hi3519v101_config

hi3536cv100_configEnable split NOR handling for hi3536cv100 +4/-0

Enable split NOR handling for hi3536cv100

• Enables CONFIG_OPENIPC_NOR_SPLIT for the build whose kernel derives the firmware split from its device tree.

openipc/hi3536cv100_config

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

qodo-free-for-open-source-projects Bot commented Oct 24, 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. Recovery corrupts large kernel updates 🐞 Bug ≡ Correctness
Description
firmware_recovery() can run a recovery script's fwupd before firmware_scan() has adjusted the
fixed-slot write addresses and sizes for a split image. On an 8 MiB board with a split kernel larger
than 2 MiB, a script that falls back to the kernel/rootfs pair writes the rootfs at the default 2
MiB boundary, then writes the oversized kernel beyond its 2 MiB erase area, leaving the image
unbootable.
Code

openipc/hi3519v101_config[38]

+CONFIG_OPENIPC_NOR_SPLIT=y
Evidence
The new split setting also appears in openipc/hi3516av200_config[38-38] and
openipc/hi3536cv100_config[43-43]. Recovery runs before the scan, and its preliminary setup
calculates only fwsize; the pair-update commands still use the default 2 MiB kernel slot and fixed
rootfs boundary. An oversized kernel write therefore extends past its erased slot into the rootfs
area.

openipc/hi3519v101_config[36-38]
openipc/hi3516av200_config[36-38]
openipc/hi3536cv100_config[41-43]
common/openipc.c[1084-1141]
include/configs/openipc-common.h[66-76]
include/configs/openipc-common.h[202-243]

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

## Issue description
Recovery scripts can invoke the split-update fallback before the NOR layout scan. For a split kernel larger than the default 2 MiB slot, the fallback erases and writes overlapping or insufficiently erased ranges.
## Fix Focus Areas
- common/openipc.c[1090-1141]
- include/configs/openipc-common.h[202-243]
## Recommended Fix
Establish safe kernel and rootfs write ranges from the detected layout before a recovery script can invoke the pair-update fallback, while preserving the existing recovery behavior for fixed-slot images.

ⓘ 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 choose which labels appear on a finding, and whether they show icons or text

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread openipc/hi3519v101_config
@widgetii
widgetii merged commit 92c6551 into openipc-hisilicon Oct 24, 2026
74 checks passed
widgetii added a commit to OpenIPC/wiki that referenced this pull request Oct 24, 2026
They ship the split package beside the fixed-slot one since
OpenIPC/firmware#2672, on OpenIPC/linux#145 and #146 and
OpenIPC/u-boot#63. sysupgrade -k -r takes the split package on them, and
they go back to fixed slots the same way.

Checked in qemu-hisilicon (hi3519v101 and hi3536cv100, 8 MB). 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