RAW capsule updates hardcode dfu_alt_num = image_index - 1, which
assumes every board's fw_images[] table is a positionally
ordered mirror of its dfu_alt_info string. That's true for every
board that hand-writes fw_images[], but it breaks down for a platform
that builds the table by scanning its partition layout at boot: the
set of images and their indices can vary per board, with gaps where a
component isn't present, so image_index and dfu_alt_num can't be
assumed to stay in lockstep.
This series moves that calculation into a __weak
efi_firmware_get_dfu_alt_num() a platform can override, the same
pattern already used for efi_firmware_get_image_type_id() and the
efi_reset_system()/efi_get_time() hooks. The default implementation is
the same image_index - 1 every existing board relies on today, so
nothing needs to change anywhere else.
This is infrastructure for a follow-on series that builds fw_images[]
dynamically on Qualcomm boards, which needs this hook to keep
dfu_alt_num correct once the table stops being static.
This work is part of multi-image capsule update support for
Qualcomm boards.
Balaji Selvanathan (2):
efi_loader: firmware: decouple dfu_alt_num from image_index
test: efi_capsule: add sandbox coverage for dfu_alt_num override
---
Balaji Selvanathan (2):
efi_loader: firmware: decouple dfu_alt_num from image_index
test: efi_capsule: add sandbox coverage for dfu_alt_num override
arch/sandbox/dts/sandbox_capsule.dtsi | 12 ++++++
board/sandbox/sandbox.c | 18 +++++++++
include/efi_loader.h | 17 ++++++++
include/sandbox_efi_capsule.h | 1 +
lib/efi_loader/efi_firmware.c | 21 +++++++++-
.../test_efi_capsule/test_capsule_firmware_raw.py | 45 ++++++++++++++++++++++
6 files changed, 112 insertions(+), 2 deletions(-)
---
base-commit: 36c377b9859ffb53eb1e39ea31e8d96d1e0fe1e5
change-id: 20260811-efi-firmware-dfu-alt-num-1289dae96490
Best regards,
--
Balaji Selvanathan <[email protected]>