Open
Conversation
The sysupgrade script previously hardcoded NOR/squashfs firmware downloads and used flashcp for all flash types. This bricks NAND cameras which boot with rootfstype=ubifs, since flashing squashfs to a UBI volume produces an unmountable rootfs. Changes: - download_firmware: select nand package when ipcinfo -F reports nand - do_update_kernel: use flash_eraseall + nandwrite for NAND partitions - do_update_rootfs_nand: new function that pivot_roots to tmpfs, detaches UBI, erases the MTD partition, and writes the UBI image with nandwrite before rebooting - do_wipe_overlay: use ubiupdatevol -t for NAND overlay wipe instead of flash_eraseall -j which is JFFS2-specific Tested on hi3516av200 with 128MB SPI NAND, upgrading from OpenIPC 2.2 (Nov 2022) to 2.6 (Apr 2026) successfully. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Re-attaching UBI after nandwrite to restore overlay data causes image_seq mismatch — the rootfs_data autoresize writes PEBs with a different sequence number than the original rootfs.ubi image, resulting in kernel panic on boot (UBI attach fails). Add a warning that NAND rootfs update erases overlay data. Overlay preservation would require ubiupdatevol with a bare UBIFS image, which is not currently included in release packages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ZigFisher
reviewed
Apr 16, 2026
Collaborator
ZigFisher
left a comment
There was a problem hiding this comment.
I think this will break sigmastar nand devices, the old solution was utilizing gluebi as compatibility layer to overwrite the partitions without ubi tools.
Member
Author
|
Are you comfortable making these changes only for HiSilicon devices, which I can currently test? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sysupgradepreviously hardcoded NOR/squashfs firmware downloads and usedflashcpfor all flash types, which bricks NAND cameras (boot expectsubifs, notsquashfs)download_firmware()now selects the correct NAND package ($soc-nand-$osr) whenipcinfo -Freportsnanddo_update_kernel()usesflash_eraseall+nandwrite -pfor NAND instead offlashcpdo_update_rootfs_nand()function: pivot_roots to tmpfs, detaches UBI, erases the MTD partition, writes the UBI image withnandwrite, and rebootsdo_wipe_overlay()usesubiupdatevol -tfor NAND overlay wipe instead offlash_eraseall -j(JFFS2-specific)Known limitation
NAND rootfs update erases the entire UBI partition, which includes both rootfs and rootfs_data (overlay). This means overlay data (settings, SSH keys, etc.) is lost during rootfs update. Preserving overlay would require
ubiupdatevolwith a bare UBIFS image, which is not currently included in release packages. Re-attaching UBI afternandwriteto restore overlay data is unsafe — it causesimage_seqmismatch and kernel panic.Test log (hi3516av200, 128MB SPI NAND)
sysupgrade -k -r -f -z output
Post-upgrade verification
Test plan
pivot_rootworks reliably/overlayafter upgrade)sysupgrade -n) on NAND🤖 Generated with Claude Code