[RFC PATCH 00/10] FWU: Add support for FWU Multi Bank Update feature

Sughosh Ganu sughosh.ganu at linaro.org
Thu Nov 25 08:01:36 CET 2021


The FWU multi bank update feature is used for supporting multiple
sets(also called banks) of firmware images, allowing the platform to
boot from a different bank, in case it fails to boot from the active
bank. This functionality is supported by keeping the relevant
information in a structure called metadata, which provides information
on the images. Among other parameters, the metadata structure contains
information on the currect active bank that is being used to boot
images.

Functionality is being added to work with the UEFI capsule driver in
u-boot. The metadata is read to gather information on the update bank,
which is the bank to which the firmware images would be flashed to. On
a successful completion of the update of all components, the active
bank field in the metadata is updated, to reflect the bank from which
the platform will boot on the subsequent boots.

This also requires changes in the previous stage of bootloader, which
parses the metadata and selects the bank to boot the images from.

Currently, the feature is being enabled on the STM32MP157C-DK2
board which boots a FIP image from a uSD card partitioned with the GPT
partioning scheme. Support is being added in tf-a(BL2 stage) for the
STM32MP157C-DK2 board to boot the active bank images. These changes
are under review currently[3].

The following config's need to be selected for enabling the feature
CONFIG_FWU_MULTI_BANK_UPDATE
CONFIG_EFI_CAPSULE_ON_DISK
CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT
CONFIG_EFI_CAPSULE_FIRMWARE
CONFIG_EFI_CAPSULE_FIRMWARE_RAW
CONFIG_EFI_CAPSULE_FMP_HEADER -- if capsule is being generated using EDKII GenerateCapsule script
CONFIG_CMD_FWU_METADATA


Todo's
------
1) Add a test(selftest) for the metadata access.
2) Add a tool for generation of the metadata. Not sure if this needs to
   be part of the u-boot repository though.
3) Add a tool for generation of the firmware accept/reject dummy
   capsule. Need to check if this can be added to the mkeficapsule
   tool in u-boot.

[1] - https://developer.arm.com/documentation/den0118/a
[2] - https://staging-git.codelinaro.org/linaro/firmware-dual-banked-updates/test
[3] - https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/12566

Sughosh Ganu (10):
  GPT: Add function to get gpt header and partition entries
  stm32mp: dfu: Move the ram partitions to the end of the dfu_alt_info
    variable
  FWU: Add metadata structure and functions for accessing metadata
  FWU: Add metadata access functions for GPT partitioned block devices
  FWU: stm32mp1: Add helper functions for accessing metadata
  FWU: STM32MP1: Add support to read boot index from backup register
  EFI: FMP: Add provision to update image's ImageTypeId in image
    descriptor
  FWU: Add boot time checks as highlighted by the FWU specification
  FWU: Add support for FWU Multi Bank Update feature
  FWU: cmd: Add a command to read metadata

 arch/arm/mach-stm32mp/include/mach/stm32.h |   1 +
 board/st/common/stm32mp_dfu.c              |  11 +-
 board/st/stm32mp1/stm32mp1.c               |  70 ++
 cmd/Kconfig                                |   6 +
 cmd/Makefile                               |   1 +
 cmd/fwu_metadata.c                         |  65 ++
 common/board_r.c                           |   6 +
 disk/part_efi.c                            |  10 +
 include/fwu_metadata.h                     | 140 ++++
 include/part.h                             |  14 +
 lib/Kconfig                                |  32 +
 lib/Makefile                               |   1 +
 lib/efi_loader/efi_capsule.c               | 190 +++++-
 lib/efi_loader/efi_firmware.c              |  76 ++-
 lib/fwu_updates/Makefile                   |  11 +
 lib/fwu_updates/fwu.c                      | 170 +++++
 lib/fwu_updates/fwu_metadata.c             | 275 ++++++++
 lib/fwu_updates/fwu_metadata_gpt_blk.c     | 716 +++++++++++++++++++++
 18 files changed, 1784 insertions(+), 11 deletions(-)
 create mode 100644 cmd/fwu_metadata.c
 create mode 100644 include/fwu_metadata.h
 create mode 100644 lib/fwu_updates/Makefile
 create mode 100644 lib/fwu_updates/fwu.c
 create mode 100644 lib/fwu_updates/fwu_metadata.c
 create mode 100644 lib/fwu_updates/fwu_metadata_gpt_blk.c

-- 
2.17.1




More information about the U-Boot mailing list