Asymmetric partition sizes for monolithic self-updates - #861
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds support for asymmetric BOOT vs UPDATE partition sizing specifically for monolithic self-updates, so the UPDATE slot can stage a full monolithic payload without forcing the BOOT slot to be the same (larger) size.
Changes:
- Introduces
WOLFBOOT_PARTITION_UPDATE_SIZE(defaulting toWOLFBOOT_PARTITION_SIZE) with compile-time constraints to keep swap-based modes symmetric. - Updates signing/tooling, partition boundary checks, and erase/write logic to use the UPDATE slot size where appropriate.
- Updates documentation and example configurations to describe and demonstrate independent UPDATE sizing.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/test.mk | Simulator self-update test now sizes/places the pBOOT trailer using UPDATE-size when provided. |
| tools/keytools/sign.c | Sign tool can validate self-update images against UPDATE partition size when set; improves error handling paths. |
| stage1/Makefile | Propagates WOLFBOOT_PARTITION_UPDATE_SIZE into generated build artifacts via template substitution. |
| src/update_flash.c | Adds a monolithic self-update size guard to prevent installed span from reaching into the UPDATE staging region. |
| src/libwolfboot.c | Uses UPDATE partition size for UPDATE erase, NSC range checks, and UPDATE trailer placement. |
| src/image.c | Makes fixed-partition size checks/trailer pointer depend on whether the image is in BOOT vs UPDATE. |
| Makefile | Exports WOLFBOOT_PARTITION_UPDATE_SIZE to the signing tool and injects it into include/target.h. |
| include/wolfboot/wolfboot.h | Defines and constrains WOLFBOOT_PARTITION_UPDATE_SIZE (monolithic-only for asymmetry; disallowed with ENCRYPT). |
| include/target.h.in | Adds optional UPDATE-size definition and updates overlap checks to use UPDATE-size. |
| docs/lib.md | Clarifies slot-size enforcement for BOOT vs UPDATE. |
| docs/flash_partitions.md | Documents the monolithic exception allowing a larger UPDATE partition. |
| docs/firmware_update.md | Adds detailed guidance for independent partition sizing and sizing math/constraints. |
| docs/compile.md | Documents WOLFBOOT_PARTITION_UPDATE_SIZE and its constraints. |
| config/examples/sim-self-update-monolithic.config | Updates the simulator example to an asymmetric BOOT/UPDATE layout. |
| config/examples/aurix-tc375-hsm-monolithic-update-wolfHSM-certs-rsa4096.config | Adds a new example configuration demonstrating asymmetric monolithic layout on AURIX TC375 + HSM. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #861
Scan targets checked: wolfboot-bugs, wolfboot-src
Findings: 4
4 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
d6a7116 to
9f4f14b
Compare
…ric partition sizing
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #861
Scan targets checked: none
Failed targets: wolfboot-bugs, wolfboot-src
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #861
Scan targets checked: none
Failed targets: wolfboot-bugs, wolfboot-src
Allows UPDATE to be sized independently from BOOT to save a huge amount of flash when using monolithic self-updates. Without this fix, the BOOT partition wastes
sizeof(wolfBoot)bytes, since only UPDATE needs to store the full monolithic payload.