[PATCH 00/18] FWU: Migrate FWU metadata to version 2

Michal Simek monstr at monstr.eu
Fri Jan 26 16:09:51 CET 2024


Hi Sughosh,

po 22. 1. 2024 v 12:55 odesílatel Sughosh Ganu <sughosh.ganu at linaro.org> napsal:
>
>
> The following patches migrate the FWU metadata access code to version
> 2 of the structure. This is based on the structure definition as
> defined in the latest rev of the FWU Multi Bank Update specification
> [1].
>
> Since the version 1 of the structure has currently been adopted on a
> couple of platforms, it was decided to have a clean migration of the
> metadata to version 2 only, instead of supporting both the versions of
> the structure. Also, based on consultations with the main author of
> the specification, it is expected that any further changes in the
> structure would be minor tweaks, and not be significant. Hence a
> migration to version 2.
>
> Similar migration is also being done in TF-A, including migrating the
> ST platform port to support version 2 of the metadata structure [2].
>
> The patches have been tested on STM32MP1 DK2 board and the Synquacer
> board from Socionext. This covers testing both the GPT and the MTD
> partitioned storage devices for the metadata access.
>
> [1] - https://developer.arm.com/documentation/den0118/latest/
> [2] - https://review.trustedfirmware.org/q/topic:%22topics/fwu_metadata_v2_migration%22
>
> Sughosh Ganu (18):
>   configs: fwu: Remove FWU configs for metadata V2 migration
>   fwu: metadata: Migrate to version 2 of the structure
>   drivers: fwu: Add the size parameter to the metadata access API's
>   fwu: Add some API's for metadata version 2 access
>   lib: fwu: Make changes to support version 2 of FWU metadata
>   drivers: fwu: mtd: Allocate buffer for image info dynamically
>   drivers: fwu: Allocate memory for metadata copies
>   fwu: Add a function to put a bank in Trial State
>   capsule: Accept a bank on a successful update
>   fwu: mtd: Modify the DFU API's to align with metadata version 2
>   efi_firmware: fwu: Do not read FWU metadata on sandbox
>   efi_firmware: fwu: Get the number of FWU banks at runtime
>   cmd: fwu: Align the command with metadata version 2
>   test: fwu: Align the FWU metadata access test with version 2
>   fwu: Remove the config symbols for number of banks and images
>   tools: mkfwumdata: Migrate to metadata version 2
>   configs: fwu: Re-enable FWU configs
>   doc: fwu: Make changes for supporting FWU Metadata version 2
>
>  arch/sandbox/Kconfig                     |   6 -
>  board/armltd/corstone1000/corstone1000.c |   2 +-
>  cmd/fwu_mdata.c                          |  43 +++-
>  configs/synquacer_developerbox_defconfig |   1 -
>  doc/board/socionext/developerbox.rst     |   9 +-
>  doc/develop/uefi/fwu_updates.rst         |  12 +-
>  doc/usage/cmd/fwu_mdata.rst              |  12 +-
>  drivers/fwu-mdata/fwu-mdata-uclass.c     |  10 +-
>  drivers/fwu-mdata/gpt_blk.c              |  27 +-
>  drivers/fwu-mdata/raw_mtd.c              |  85 ++++---
>  include/fwu.h                            |  94 ++++++-
>  include/fwu_mdata.h                      |  56 +++--
>  lib/efi_loader/efi_capsule.c             |  12 +-
>  lib/efi_loader/efi_firmware.c            |  20 +-
>  lib/fwu_updates/Kconfig                  |  11 -
>  lib/fwu_updates/fwu.c                    | 308 ++++++++++++++++++-----
>  lib/fwu_updates/fwu_mtd.c                |  76 ++++--
>  test/dm/fwu_mdata.c                      |  56 +++--
>  test/dm/fwu_mdata_disk_image.h           | 124 ++++-----
>  tools/mkfwumdata.c                       |  43 +++-
>  20 files changed, 705 insertions(+), 302 deletions(-)


Thanks for this work. I have tested it on kv260 and I see an issue
with 2 image per location configuration.
When I build mdata v2 with:
./tools/mkfwumdata -a 0 -i 2 -b 2
588aced7-2cce-ed11-81cd-d324e93ac223,e86660de-5602-ad4f-8238-e406e274c4cf,48054af6-ce2c-11ed-8f66-7bc4531cfe6b,4b819c3e-ce2c-11ed-bec8-23de4c6d2cf2
588aced7-2cce-ed11-81cd-d324e93ac223,d4cf9ecf-8b93-c541-8551-1f883ab7dc18,fb04da52-0e9d-11ee-a57f-637805837c3f,07609246-0e9e-11ee-a23a-a38980b779a1
mdata.bin

fwu command is showing up configuration for the second image

Image Type Guid: DE6066E8-0256-4FAD-8238-E406E274C4CF
Location Guid: D7CE8A58-CE2C-11ED-81CD-D324E93AC223
Image Guid:  F64A0548-2CCE-ED11-8F66-7BC4531CFE6B
Image Acceptance: yes
Image Guid:  3E9C814B-2CCE-ED11-BEC8-23DE4C6D2CF2
Image Acceptance: yes

Image Type Guid: F64A0548-2CCE-ED11-8F66-7BC4531CFE6B
Location Guid: 00000001-0000-0000-4B81-9C3ECE2C11ED
Image Guid:  DE23C8BE-6D4C-F22C-0100-000000000000
Image Acceptance: no
Image Guid:  881F5185-B73A-18DC-588A-CED72CCEED11
Image Acceptance: no

but it should be (from mdata v1)
Image Type Guid: DE6066E8-0256-4FAD-8238-E406E274C4CF
Location Guid: D7CE8A58-CE2C-11ED-81CD-D324E93AC223
Image Guid:  F64A0548-2CCE-ED11-8F66-7BC4531CFE6B
Image Acceptance: yes
Image Guid:  3E9C814B-2CCE-ED11-BEC8-23DE4C6D2CF2
Image Acceptance: yes

Image Type Guid: CF9ECFD4-938B-41C5-8551-1F883AB7DC18
Location Guid: D7CE8A58-CE2C-11ED-81CD-D324E93AC223
Image Guid:  52DA04FB-9D0E-EE11-A57F-637805837C3F
Image Acceptance: yes
Image Guid:  46926007-9E0E-EE11-A23A-A38980B779A1
Image Acceptance: yes

And I think the issue is not with mdata v2 generation but it is with
decoding inside u-boot.
Which ends up in a situation that dfu_alt_info for 2 images is not
generated properly.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs


More information about the U-Boot mailing list