Skip to content

Asymmetric partition sizes for monolithic self-updates - #861

Open
bigbrett wants to merge 2 commits into
wolfSSL:masterfrom
bigbrett:monolithic-asymmetric-part-sizes
Open

Asymmetric partition sizes for monolithic self-updates#861
bigbrett wants to merge 2 commits into
wolfSSL:masterfrom
bigbrett:monolithic-asymmetric-part-sizes

Conversation

@bigbrett

Copy link
Copy Markdown
Contributor

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.

Copilot AI lite review requested due to automatic review settings August 18, 2026 02:39
@bigbrett bigbrett self-assigned this Aug 18, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 to WOLFBOOT_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.

Comment thread tools/keytools/sign.c
Comment thread src/image.c
Comment thread src/update_flash.c

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bigbrett
bigbrett force-pushed the monolithic-asymmetric-part-sizes branch from d6a7116 to 9f4f14b Compare August 18, 2026 15:18
@bigbrett
bigbrett marked this pull request as ready for review August 18, 2026 17:28
@bigbrett bigbrett assigned bigbrett and unassigned bigbrett Aug 18, 2026

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #861

Scan targets checked: none
Failed targets: wolfboot-bugs, wolfboot-src

⚠️ Review incomplete — one or more scan targets failed before findings could be produced. See the Fenrir PR review detail page for logs.

@bigbrett bigbrett assigned bigbrett and unassigned bigbrett Aug 18, 2026

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #861

Scan targets checked: none
Failed targets: wolfboot-bugs, wolfboot-src

⚠️ Review incomplete — one or more scan targets failed before findings could be produced. See the Fenrir PR review detail page for logs.

@bigbrett bigbrett assigned dgarske and unassigned bigbrett Aug 18, 2026
@bigbrett
bigbrett requested a review from dgarske August 18, 2026 17:56
@dgarske dgarske assigned danielinux and wolfSSL-Bot and unassigned dgarske Aug 18, 2026
@dgarske
dgarske requested review from danielinux and removed request for dgarske August 18, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants