@@ -200,6 +200,78 @@ regular signed image at the bootloader origin.
200200See [ Signing.md] ( Signing.md#header-only-output-wolfboot-self-header ) for
201201more detail on the ` --header-only ` sign tool option.
202202
203+ #### Monolithic updates
204+
205+ The self-update mechanism can be used to update both the bootloader
206+ ** and** the application firmware in a single atomic operation. Because
207+ ` wolfBoot_self_update() ` copies ` fw_size ` bytes from the update image to
208+ ` ARCH_FLASH_OFFSET ` , a payload that is larger than the bootloader region
209+ will spill into the contiguous BOOT partition, overwriting whatever
210+ application image was there previously.
211+
212+ No wolfBoot code changes are required — only the update payload needs to
213+ be assembled differently. The payload is constructed by concatenating the
214+ new bootloader binary with the new signed application image and signing
215+ the result as a wolfBoot self-update:
216+
217+ ```
218+ cat wolfboot.bin image_v1_signed.bin > monolithic_payload.bin
219+ sign --wolfboot-update monolithic_payload.bin key.der 2
220+ ```
221+
222+ After the self-update completes, flash looks like:
223+
224+ ```
225+ ARCH_FLASH_OFFSET BOOT_ADDRESS
226+ | |
227+ v v
228+ [ new bootloader bytes | padding | new signed app image ]
229+ <-------- fw_size ------------------------------------------->
230+ ```
231+
232+ ##### Self-header interaction
233+
234+ When ` WOLFBOOT_SELF_HEADER ` is enabled, the persisted header retains the
235+ ` fw_size ` , hash and signature exactly as the signing tool produced them.
236+ The hash covers the ** entire** monolithic payload — both the bootloader
237+ bytes and the nested application image. Later calls to
238+ ` wolfBoot_open_self() ` / ` wolfBoot_verify_integrity() ` will re-hash
239+ ` fw_size ` bytes starting at ` ARCH_FLASH_OFFSET ` , spanning into the BOOT
240+ partition.
241+
242+ ##### Restrictions
243+
244+ - ** Not power-fail safe.** Like all self-updates, a monolithic update
245+ erases the bootloader region and writes in-place. An interruption
246+ during the write leaves the device unbootable. Additionally, the BOOT
247+ partition is written without a prior erase — this relies on the
248+ partition being in an erased (0xFF) state, which is only guaranteed
249+ when the device has no prior application installed or the partition has
250+ been explicitly erased beforehand.
251+
252+ - ** Not revertable.** There is no swap or rollback mechanism. The old
253+ bootloader and application are destroyed during the update.
254+
255+ - ** Locks bootloader verification to a specific application version.**
256+ Because the self-header hash covers the full monolithic image, any
257+ independent application update will invalidate the persisted
258+ self-header. To maintain a valid self-header, both components must
259+ always be updated together as a single monolithic payload.
260+
261+ - ** Payload must fit in the UPDATE partition.** The signed monolithic
262+ image (header + bootloader + signed application) plus the 5-byte
263+ ` pBOOT ` trailer must not exceed ` WOLFBOOT_PARTITION_SIZE ` .
264+
265+ ##### Simulator test
266+
267+ A simulator test is provided in ` tools/test.mk ` to exercise this use case:
268+
269+ ```
270+ cp config/examples/sim-self-update-monolithic.config .config
271+ make clean && make
272+ make test-sim-self-update-monolithic
273+ ```
274+
203275### Incremental updates (aka: 'delta' updates)
204276
205277wolfBoot supports incremental updates, based on a specific older version. The sign tool
0 commit comments