On 3/22/24 11:57, Sughosh Ganu wrote:


The following patch series adds support for version 2 of the FWU
metadata. The version 2 metadata structure is defined in the latest
revision of the FWU specification [1].

The earlier versions of these patches were migrating to a version 2
only support in U-Boot, similar to TF-A. However, based on feedback
from ST [2], this series has been updated to support both versions. A
platform would still be needed to enable one of the two versions of
metadata through a config symbol.

TF-A has code which reads the FWU metadata and boots the platform from
the active partition. TF-A has decided to migrate the FWU code to a
version 2 only support. These changes have been merged in upstream
TF-A.

These changes have been tested on the ST DK2 board, which uses the GPT
based partitioning scheme. Both V1 and V2 metadata versions have been
tested on the DK2 board.

These changes need to be tested on platforms with MTD partitioned
storage devices.

@Michal and @Kojima-san, please help in this testing.

Note: The CI is breaking on some sandbox py tests, but the errors look
unrelated. I will look into those issues, but the code review can
proceed.

[1] - https://developer.arm.com/documentation/den0118/latest/
[2] - https://lists.denx.de/pipermail/u-boot/2024-February/546277.html

Changes since V2:
* New patch which retains support for V1 of metadata
* Earlier patch was catering to v2 only support. These changes support
   both versions of metadata.
* Earlier patch was migrating to v2 only support. These changes
   support both versions.
* Support both metadata versions instead of only v2.
* Added documentation changes.
* Make changes to have the test work with v1 metadata.
* Make changes to have the test work with updated logic in fwu code.
* Changes to indicate support for both v1 and v2 instead of only v2.
* Add config symbol for selecting either of the two metadata versions.


Sughosh Ganu (20):
   configs: fwu: remove FWU configs for metadata V2 support
   tools: mkfwumdata: fix the size parameter to the fwrite call
   drivers: fwu: add the size parameter to the metadata access API's
   drivers: fwu: mtd: allocate buffer for image info dynamically
   fwu: metadata: add support for version 2 of the structure
   fwu: metadata: add a version agnostic structure
   fwu: metadata: add functions for handling version specific metadata
     fields
   fwu: make changes to access version agnostic structure fields
   capsule: fwu: transition the platform state on a successful update
   fwu: add config symbols for enabling FWU metadata versions
   fwu: mtd: remove unused argument from function call
   fwu: mtd: get MTD partition specific info from driver
   fwu: mtd: obtain image information from version agnostic structure
   cmd: fwu: make changes for supporting FWU metadata version 2
   tools: mkfwumdata: add support for metadata version 2
   tools: mkfwumdata: add logic to append vendor data to the FWU metadata
   test: fwu: make changes to the FWU metadata access test
   doc: fwu: make changes to reflect support for FWU metadata v2
   MAINTAINERS: add entry for FWU multi bank update feature
   configs: fwu: re-enable FWU configs

  MAINTAINERS                              |   8 +
  cmd/fwu_mdata.c                          |  39 ++--
  configs/corstone1000_defconfig           |   1 +
  configs/sandbox64_defconfig              |   1 +
  configs/synquacer_developerbox_defconfig |   2 +-
  doc/board/socionext/developerbox.rst     |   7 +-
  doc/develop/uefi/fwu_updates.rst         |  20 +-
  doc/mkfwumdata.1                         |  16 +-
  drivers/fwu-mdata/fwu-mdata-uclass.c     |  10 +-
  drivers/fwu-mdata/gpt_blk.c              |  23 +-
  drivers/fwu-mdata/raw_mtd.c              |  78 ++++---
  include/fwu.h                            | 147 ++++++++++++-
  include/fwu_mdata.h                      |  71 ++++++-
  lib/efi_loader/efi_capsule.c             |  14 +-
  lib/fwu_updates/Kconfig                  |  14 ++
  lib/fwu_updates/Makefile                 |   2 +
  lib/fwu_updates/fwu.c                    | 204 ++++++++++++------
  lib/fwu_updates/fwu_mtd.c                |  34 +--
  lib/fwu_updates/fwu_v1.c                 | 167 +++++++++++++++
  lib/fwu_updates/fwu_v2.c                 | 260 +++++++++++++++++++++++
  test/dm/fwu_mdata.c                      |  16 +-
  tools/mkfwumdata.c                       | 235 ++++++++++++++++----
  22 files changed, 1153 insertions(+), 216 deletions(-)
  create mode 100644 lib/fwu_updates/fwu_v1.c
  create mode 100644 lib/fwu_updates/fwu_v2.c


FYI: We are working on changes in early firmware (img selector) to test this code on Kria platforms.

Thanks,
Michal

Reply via email to