MCUBOOT_SWAP_STATUS_HOOKS provider-overlay seam - #2804
Open
DOAR-Infineon wants to merge 1 commit into
Open
Conversation
DOAR-Infineon
force-pushed
the
mr/1-fingerprint-hooks
branch
from
July 27, 2026 08:42
124051f to
9d4e415
Compare
… provider-agnostic) Signed-off-by: Artem Dovhal <artem.dovhal@infineon.com> Signed-off-by: INFINEON\DovhalA <artem.dovhal@infineon.com>
DOAR-Infineon
force-pushed
the
mr/1-fingerprint-hooks
branch
from
July 27, 2026 08:44
9d4e415 to
58a9ac1
Compare
nordicjm
reviewed
Jul 28, 2026
Comment on lines
+354
to
+357
| int swap_status_before_scratch_erase_hook(const struct boot_loader_state *state, | ||
| const struct flash_area *fap_pri, | ||
| const struct flash_area *fap_scratch, | ||
| struct boot_status *bs); |
Collaborator
There was a problem hiding this comment.
the plan is to deprecate swap using scratch, seems a bit superfluous?
| * Copyright (c) 2016-2019 JUUL Labs | ||
| * Copyright (c) 2019-2020 Arm Limited | ||
| * Copyright (c) 2025 Nordic Semiconductor ASA | ||
| * Copyright (c) 2026 Infineon Technologies AG |
Collaborator
There was a problem hiding this comment.
Suggested change
| * Copyright (c) 2026 Infineon Technologies AG |
same as below
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.
Adds a new hook family,
MCUBOOT_SWAP_STATUS_HOOKS, that lets a downstreamprovider take ownership of swap-status bookkeeping without editing the portable
core.
boot/stays provider-agnostic — this MR adds only the seam, no provider.What it does
BOOT_STATUS_HOOK_CALL(f, ret_default, ...)inboot_hooks.h, built onthe existing
DO_HOOK_CALL/HOOK_CALL_NOPmachinery, same as every otherhook family. When the gate is undefined it compiles to
ret_default— nocall, no link dependency, vanilla path unchanged.
boot_write_status(loader.c),swap_status_init(swap_misc.c), andswap_read_status_bytes(swap_offset/move/scratch). Two amend-style sites:before the scratch-area erase (swap_scratc
(loader.c
boot_swap_image).BOOT_STATUS_HOOK_REGULAR = INT_MINinstead of reusingBOOT_HOOK_REGULAR: that constant equals ndthese hooks legitimately return
BOOT_EFLASH— reusing it would misread areal flash error as "run the built-in path".
INT_MINcollides with nothing.built-in status-byte path runs only when the family is compiled out.
Notes
MCUBOOT_SWAP_STATUS_HOOKSundefined, behavior is identical to upstream by construction.#errorguard inbootutil_priv.hturns a feature-without-gatemisconfiguration into a compile-time failure.