Skip to content

Add compressed firmware updates for execute-in-place targets - #951

Open
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:compressed_images
Open

dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:compressed_images

Conversation

@dgarske

@dgarske dgarske commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Description

COMPRESSED_UPDATE=1 holds the update partition as a gzip-compressed, signed image and inflates it into the boot partition, which goes on executing in place. The update partition is then sized for the container rather than for a second full copy, and the flash that frees goes to the application: on a 2MB STM32 the example configs give the application 1MB where an equal split of the same space allows 896KB.

There is no local copy of the outgoing image, so this trades rollback for flash. Three things bound that: the container is verified before the first erase, so a bad image never touches the running one; the update partition is only ever read during an install, so a power cut leaves an intact source and the next boot resumes from the recorded progress; and the payload is a complete signed image, so the boot partition stays an ordinary wolfBoot partition that the normal boot path verifies, meaning the inflater need not be trusted.

What it adds

  • src/update_flash.c - the installer, built on the existing DISABLE_BACKUP path
  • src/gzip.c - a sink decoder with a bounded LZ77 window, selected at build time, leaving the flat decoder the FIT path uses unchanged
  • tools/keytools/sign.c - --compress[=bits], which compresses and signs the nested container; zlib is an optional dependency and the option is rejected without it
  • WOLFBOOT_PARTITION_UPDATE_SIZE smaller than the boot partition, which the existing monolithic self-update sizing already allowed in the other direction
  • Example configs, docs/Compression.md, simulator tests, unit tests and CI

Fixes in shared code

  • wb_trailer_clear() cleared the update partition's trailer at the boot partition's size offset, which matters once the two are sized independently
  • hal/stm32f4.c describes 1MB of flash, so a partition past that silently failed to erase; now refused at build time
  • DEBUG_UART=1 on TARGET=stm32f4 hung on the first print, because nothing initialized the port

Testing

Validated on a NUCLEO-F439ZI: install, verification of the installed image, the update being consumed rather than repeated, and resume after an install interrupted by reset. Simulator and unit tests cover the sink decoder against the flat one at every window size, the installer's bounds, and the manifest reader.

@dgarske dgarske self-assigned this Oct 26, 2026
@dgarske
dgarske requested a review from danielinux October 27, 2026 19:10
@dgarske dgarske changed the title Add compressed firmware images: gzip-compressed A/B slots executed from RAM Add compressed firmware images: RAM-executed A/B slots and compressed updates Oct 28, 2026
@dgarske
dgarske force-pushed the compressed_images branch 2 times, most recently from 9cd5e75 to 2fdd41a Compare October 28, 2026 20:54
@dgarske dgarske changed the title Add compressed firmware images: RAM-executed A/B slots and compressed updates Add compressed firmware updates for execute-in-place targets Oct 28, 2026
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.

2 participants