Fix incomplete NAND sysupgrade (kernel only, rootfs skipped)#23
Merged
Conversation
Change line 267 from '! -z' to '-z' to properly check if kernel_mtd is empty. The previous logic incorrectly set has_kernel=0 when kernel_mtd was NOT empty, preventing the kernel from being written to UBI volume and causing incomplete upgrades.
Copilot created this pull request from a session on behalf of
HiGarfield
June 21, 2026 18:40
View session
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a regression in the NAND sysupgrade TAR path where has_kernel could be forced to 0 even when a kernel MTD partition exists, preventing the kernel UBI volume from being created/updated during upgrade preparation.
Changes:
- Corrected the kernel MTD presence check in
nand_upgrade_tar()by replacing! -z "$kernel_mtd"with-z "$kernel_mtd"when deciding whether to clearhas_kernel.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Problem
After commit 1a04e13, NAND firmware upgrades only wrote the kernel but skipped rootfs upgrade entirely.
Root Cause
Line 267 in
package/base-files/files/lib/upgrade/nand.shinverted the kernel MTD check:The
! -z "$kernel_mtd"condition (NOT empty) incorrectly sethas_kernel=0when a kernel MTD partition existed, preventing the kernel UBI volume write innand_upgrade_prepare_ubi().Fix
Corrected the logic to properly detect when kernel MTD partition is absent:
Now
has_kernel=0only when kernel data is missing OR kernel MTD partition doesn't exist, allowing both kernel and rootfs to be written to UBI volumes during upgrade.