Pad U-Boot to boot-partition size on install (#73)#74
Merged
Conversation
OpenIPC dropped the historical 1 MiB padding from published U-Boot assets — for example u-boot-hi3516av200-universal.bin went from 1,048,576 B (1 MiB padded) to 199,276 B (raw). Consumers that flash to a fixed-size partition need to pad locally so trailing flash bytes are erased (0xFF) instead of left at whatever was previously written. Add pad_to_size() in firmware.py and call it at the install read site. Padding to the boot partition size matches the historical 1 MiB on NAND and gives 256 KiB on NOR — both clean partition boundaries. The agent flash path (LZMA SPL boundary detection) is unaffected, and the restore path doesn't write U-Boot to flash, only loads it into RAM via the bootrom — so neither needs to change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Member
Author
Hardware verification — av200 board (hi3516av200, NAND)Tested with the cached u-boot truncated to 199,276 B to simulate the new (unpadded) OpenIPC producer asset:
The bootrom upload + agent stages handle the new (smaller) producer asset cleanly. |
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
u-boot-hi3516av200-universal.binwent from 1,048,576 B (1 MiB padded) → 199,276 B (raw).pad_to_size()infirmware.pyand call it at the install read site so the U-Boot region is written with0xFFtrailing bytes — matches the historical 1 MiB on NAND and 256 KiB on NOR (clean partition boundaries either way).Closes #73
Test plan
uv run pytest tests/test_firmware.py -x -v— 16/16 pass (5 newTestPadToSizecases)uv run pytest tests/ -x -q --ignore=tests/fuzz— 407 passed, 2 skippeduv run ruff check src/defib/firmware.py src/defib/cli/app.py tests/test_firmware.py— cleanuv run mypy src/defib/firmware.py src/defib/cli/app.py --ignore-missing-imports— cleanmake -C agent test HOST_CC=gcc— 5406/5406defib install -c hi3516av200 …on av200 hardware and confirm the boot partition still flashes clean.🤖 Generated with Claude Code