Fix bug after reset fw-read & slot active/inactive bug - #404
Merged
Conversation
The fw_slot calculation for MRPC_FW_IMG_GET was inverted: even part_ids (active slots like BL20=4) were mapped to fw_slot=1 (inactive) and odd part_ids (inactive like BL21=5) mapped to fw_slot=0 (active). This caused fw-read of the active partition to actually read the inactive slot, failing when inactive is Invalid. Fix by using part_id % 2 directly, which correctly maps even IDs to slot 0 and odd IDs to slot 1. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
lsgunth
approved these changes
Aug 5, 2026
lsgunth
left a comment
Collaborator
There was a problem hiding this comment.
One very minor cosmetic thing, other than that it looks good to me. Thanks!
| return 1; | ||
| } | ||
|
|
||
|
|
Collaborator
Author
There was a problem hiding this comment.
Thanks for the catch, reverted change
All Gen6 partition types (CFG, BL2, IMG) require the full partition content for a successful fw-update roundtrip. CFG includes appended DCBI blocks, BL2/IMG include required padding to flash sector boundaries. Pass image_len=0 unconditionally so fw_img_get uses the firmware's total_len response, which reports the correct full content size for each partition type. Additionally, close and reopen the device before issuing MRPC_FW_IMG_GET to ensure firmware has fully initialized its flash state after a recent hard-reset. Without this, the firmware may return corrupted image data. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
BenReed161
force-pushed
the
fw-update-fix
branch
from
August 6, 2026 22:55
923825e to
be5b22e
Compare
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.
No description provided.