arm-bsp/corstone1000: new gpt based disk layout and fwu metadata
PATCH 1/1 arm-bsp/corstone1000: new gpt based disk layout and fwu metadata
From: Satish Kumar <[email protected]>
Introduce the use of a gpt partition type layout, and use the firmware metadata as source of the current boot bank to boot from in the different boot stages.
This needs to be a large changeset, since it touches a lot of software components to guarantee that everything works in an atomic way, to not break the build and/or the boot flow of the corstone1000 platform.
fdisk -o Start,End,Sectors,Size,Type-UUID,Attrs,Name,UUID -l tmp/deploy/images/corstone1000-fvp/corstone1000-image-corstone1000-fvp.wic Disk build/tmp/deploy/images/corstone1000-fvp/corstone1000-image-corstone1000-fvp.wic: 32 MiB, 33554432 bytes, 65536 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 5BFC084A-9B95-4024-B60B-9748F5332524
Start End Sectors Size Type-UUID Attrs Name UUID 34 39 6 3K EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 reserved_1 B1F2FC8C-A7A3-4485-87CB-16961B8847D7 40 47 8 4K 8A7A84A0-8387-40F6-AB41-A8B9A5A60D23 FWU-Metadata 3FDFFEE1-3223-4C6B-80F9-B0E7D780C21D 48 55 8 4K 8A7A84A0-8387-40F6-AB41-A8B9A5A60D23 Bkup-FWU-Metadata B3068316-5351-4998-823A-3A7B09133EC1 56 63 8 4K ECB55DC3-8AB7-4A84-AB56-EB0A9974DB42 private_metadata_replica_2 3CC3B456-DEC8-4CE3-BC5C-965483CE4828 64 71 8 4K ECB55DC3-8AB7-4A84-AB56-EB0A9974DB42 private_metadata_replica_2 DCE9C503-8DFD-4DCB-8889-647E49641552 72 271 200 100K 64BD8ADB-02C0-4819-8688-03AB4CAB0ED9 bl2_primary 9A3A8FBF-55EF-439C-80C9-A3F728033929 272 1023 752 376K D763C27F-07F6-4FF0-B2F3-060CB465CD4E tfm_primary 07F9616C-1233-439C-ACBA-72D75421BF70 1024 5119 4096 2M B5EB19BD-CF56-45E8-ABA7-7ADB228FFEA7 FIP_A B9C7AC9D-40FF-4675-956B-EEF4DE9DF1C5 5120 15199 10080 4.9M 8197561D-6124-46FC-921E-141CC5745B05 kernel_primary BF7A6142-0662-47FD-9434-6A8811980816 32784 32983 200 100K 64BD8ADB-02C0-4819-8688-03AB4CAB0ED9 bl2_secondary 3F0C49A4-48B7-4D1E-AF59-3E4A3CE1BA9F 32984 32991 8 4K D763C27F-07F6-4FF0-B2F3-060CB465CD4E tfm_secondary 009A6A12-64A6-4F0F-9882-57CD79A34A3D 32992 32999 8 4K B5EB19BD-CF56-45E8-ABA7-7ADB228FFEA7 FIP_B 9424E370-7BC9-43BB-8C23-71EE645E1273 33000 33007 8 4K 8197561D-6124-46FC-921E-141CC5745B05 kernel_secondary A2698A91-F9B1-4629-9188-94E4520808F8 65496 65501 6 3K EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 reserved_2 CCB18569-C0BA-42E0-A429-FE1DC862D660
Add new nvmxip qspi block storage device to u-boot and the plumbing to boot using the fwu_metadata and gpt partition information.
Make sure that fwu and fwu-backup have the correct, as defined in spec, partition type. That will make SW pieces in the stack identify it correctly.
Update the fvp config to use the new wic image with the gpt scheme
Depends on metadata to decide boot bank in TFA, TFM and u-boot Using Reading partitions (GPT scheme)
changes needed:
- Rename FIP partition in wic image as defined in TF-A to FIP_A,FIP_B
- Rename metadata partitions to FWU_Metadata and Bkup-FWU-Metadata
- Enable support for GPT and PSA_FWU in TF-A
arm-bsp/corstone-1000: TF-M patch to calculate fwu metadata crc32
It's necessary to calculate the metadata crc for TF-A and U-boot verify the metadata.
and at last remove the wic.nopt (wic no partition) as target fstype since we now use the partitions.
--- .../conf/machine/corstone1000-fvp.conf | 2 +- .../recipes-bsp/images/corstone1000-image.bb | 6 +- ...1000-bl2-loads-fip-based-on-metadata.patch | 167 ++ .../trusted-firmware-a-corstone1000.inc | 6 +- ...rstone1000-Increase-number-of-assets.patch | 38 - ...-corstone1000-Introduce-IO-framework.patch | 1354 +++++++++++++++++ ...ne1000-Add-IO-test-in-ci_regressions.patch | 646 ++++++++ ...stone1000-Add-soft-crc32-calculation.patch | 171 +++ ...orstone1000-calculate-metadata-crc32.patch | 89 ++ ...e1000-fwu-metadata_read-validate-crc.patch | 99 ++ ...stone1000-Add-common-platform-logger.patch | 125 ++ ...rm-corstone1000-Introduce-GPT-parser.patch | 735 +++++++++ ...e1000-BL1-changes-to-adapt-to-new-fl.patch | 337 ++++ ...orm-corstone1000-BL2-uses-GPT-layout.patch | 411 +++++ ...tone1000-flash_layout-simplification.patch | 103 ++ ...e-sure-to-write-fwu-metadata-to-repl.patch | 43 + .../trusted-firmware-m-1.7.0-corstone1000.inc | 17 +- ...ntroduce-NVM-XIP-block-storage-emula.patch | 595 ++++++++ ...64-fix-return-unsigned-long-in-readq.patch | 46 + ...andbox64-add-support-for-NVMXIP-QSPI.patch | 113 ++ ...00-add-NVM-XIP-QSPI-device-tree-node.patch | 35 + ...rstone1000-enable-NVM-XIP-QSPI-flash.patch | 29 + ...64-add-a-test-case-for-UCLASS_NVMXIP.patch | 174 +++ ...-provide-a-u-boot-shell-test-command.patch | 135 ++ ...tone1000-add-fwu-metadata-store-info.patch | 42 + ...035-nvmxip-shorter-block-device-name.patch | 44 + ...ime-allow-to-reset-a-path-after-boot.patch | 31 + ...data-make-sure-structures-are-packed.patch | 50 + .../0038-corstone1000-add-boot-index.patch | 33 + ...adjust-boot-bank-and-kernel-location.patch | 36 + ...add-nvmxip-fwu-mdata-and-gpt-options.patch | 133 ++ .../0041-nvmxip-move-header-to-include.patch | 42 + ...00-set-kernel_addr-based-on-boot_idx.patch | 112 ++ ...-corstone1000-boot-index-from-active.patch | 42 + .../recipes-bsp/u-boot/u-boot_%.bbappend | 17 + .../wic/corstone1000-image.corstone1000.wks | 32 +- 36 files changed, 6036 insertions(+), 54 deletions(-) create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-a/files/corstone1000/0002-feat-corstone1000-bl2-loads-fip-based-on-metadata.patch delete mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0001-Platform-corstone1000-Increase-number-of-assets.patch create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0001-Platform-corstone1000-Introduce-IO-framework.patch create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0002-Platform-corstone1000-Add-IO-test-in-ci_regressions.patch create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0003-Platform-corstone1000-Add-soft-crc32-calculation.patch create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0004-Platform-corstone1000-calculate-metadata-crc32.patch create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0005-Platform-corstone1000-fwu-metadata_read-validate-crc.patch create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0006-Platform-corstone1000-Add-common-platform-logger.patch create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0007-Platform-corstone1000-Introduce-GPT-parser.patch create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0008-Platform-corstone1000-BL1-changes-to-adapt-to-new-fl.patch create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0009-Platform-corstone1000-BL2-uses-GPT-layout.patch create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0010-Platform-corstone1000-flash_layout-simplification.patch create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0011-corstone1000-make-sure-to-write-fwu-metadata-to-repl.patch create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0027-drivers-nvmxip-introduce-NVM-XIP-block-storage-emula.patch create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0028-sandbox64-fix-return-unsigned-long-in-readq.patch create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0029-sandbox64-add-support-for-NVMXIP-QSPI.patch create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0030-corstone1000-add-NVM-XIP-QSPI-device-tree-node.patch create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0031-corstone1000-enable-NVM-XIP-QSPI-flash.patch create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0032-sandbox64-add-a-test-case-for-UCLASS_NVMXIP.patch create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0033-nvmxip-provide-a-u-boot-shell-test-command.patch create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0034-corstone1000-add-fwu-metadata-store-info.patch create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0035-nvmxip-shorter-block-device-name.patch create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0036-efi_boottime-allow-to-reset-a-path-after-boot.patch create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0037-fwu_metadata-make-sure-structures-are-packed.patch create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0038-corstone1000-add-boot-index.patch create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0039-corstone1000-adjust-boot-bank-and-kernel-location.patch create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0040-corstone1000-add-nvmxip-fwu-mdata-and-gpt-options.patch create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0041-nvmxip-move-header-to-include.patch create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0042-corstone1000-set-kernel_addr-based-on-boot_idx.patch create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0043-corstone1000-boot-index-from-active.patch
meta-arm-bsp/conf/machine/corstone1000-fvp.conf +1 -1
@@ -31,7 +31,7 @@ FVP_CONFIG[disable_visualisation] ?= "true" FVP_CONFIG[se.nvm.update_raw_image] ?= "0" # Boot image -FVP_DATA ?= "board.flash0=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.wic.nopt@0x68100000" +FVP_DATA ?= "board.flash0=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.wic@0x68000000" # External system (cortex-M3) FVP_CONFIG[extsys_harness0.extsys_flashloader.fname] ?= "${DEPLOY_DIR_IMAGE}/es_flashfw.bin"
meta-arm-bsp/recipes-bsp/images/corstone1000-image.bb +3 -3
@@ -6,16 +6,16 @@ LICENSE = "MIT" COMPATIBLE_MACHINE = "corstone1000" inherit image -inherit wic_nopt tfm_sign_image +inherit tfm_sign_image inherit uefi_capsule PACKAGE_INSTALL = "" -IMAGE_FSTYPES += "wic wic.nopt uefi_capsule" +IMAGE_FSTYPES += "wic uefi_capsule" UEFI_FIRMWARE_BINARY = "${PN}-${MACHINE}.${CAPSULE_IMGTYPE}" UEFI_CAPSULE_CONFIG = "${THISDIR}/files/${PN}-capsule-update-image.json" -CAPSULE_IMGTYPE = "wic.nopt" +CAPSULE_IMGTYPE = "wic" do_sign_images() { # Sign TF-A BL2
meta-arm-bsp/recipes-bsp/trusted-firmware-a/files/corstone1000/0002-feat-corstone1000-bl2-loads-fip-based-on-metadata.patch new file +167 -0
167 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a-corstone1000.inc +5 -1
@@ -6,7 +6,8 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/files/corstone1000:" SRC_URI:append = " \ file://0001-Fix-FF-A-version-in-SPMC-manifest.patch \ - " + file://0002-feat-corstone1000-bl2-loads-fip-based-on-metadata.patch \ + " TFA_DEBUG = "1" TFA_UBOOT ?= "1"
@@ -31,6 +32,9 @@ EXTRA_OEMAKE:append = " \ CREATE_KEYS=1 \ GENERATE_COT=1 \ TRUSTED_BOARD_BOOT=1 \ + ARM_GPT_SUPPORT=1 \ + PSA_FWU_SUPPORT=1 \ + NR_OF_IMAGES_IN_FW_BANK=4 \ COT=tbbr \ ARM_ROTPK_LOCATION=devel_rsa \ ROT_KEY=plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem \
meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0001-Platform-corstone1000-Increase-number-of-assets.patch deleted +0 -38
@@ -1,38 +0,0 @@ -From decb355247c4ba4b876997f55c27ec3f55dbacd2 Mon Sep 17 00:00:00 2001 -From: Mohamed Omar Asaker <[email protected]> -Date: Mon, 23 Jan 2023 13:25:28 +0000 -Subject: [PATCH] Platform: corstone1000: Increase number of assets - -As Corstone1000 stores at boot time few efi variables. -Therefore, number of assets is increased to compansate this early usage. - -Note: Adding platform customized configs to config_tfm.h - More information see: -https://tf-m-user-guide.trustedfirmware.org/configuration/header_file_system.html - -Signed-off-by: Mohamed Omar Asaker <[email protected]> -Upstream-Status: Pending [Not submitted yet] ---- - platform/ext/target/arm/corstone1000/config_tfm_target.h | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/platform/ext/target/arm/corstone1000/config_tfm_target.h b/platform/ext/target/arm/corstone1000/config_tfm_target.h -index bf8d2f95f7..e968366639 100644 ---- a/platform/ext/target/arm/corstone1000/config_tfm_target.h -+++ b/platform/ext/target/arm/corstone1000/config_tfm_target.h -@@ -16,4 +16,12 @@ - #undef PLATFORM_SERVICE_OUTPUT_BUFFER_SIZE - #define PLATFORM_SERVICE_OUTPUT_BUFFER_SIZE 256 - -+/* The maximum number of assets to be stored in the Internal Trusted Storage. */ -+#undef ITS_NUM_ASSETS -+#define ITS_NUM_ASSETS 20 -+ -+/* The maximum number of assets to be stored in the Protected Storage area. */ -+#undef PS_NUM_ASSETS -+#define PS_NUM_ASSETS 20 -+ - #endif /* __CONFIG_TFM_TARGET_H__ */ --- -2.25.1 -
meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0001-Platform-corstone1000-Introduce-IO-framework.patch new file +1354 -0
1,354 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0002-Platform-corstone1000-Add-IO-test-in-ci_regressions.patch new file +646 -0
646 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0003-Platform-corstone1000-Add-soft-crc32-calculation.patch new file +171 -0
171 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0004-Platform-corstone1000-calculate-metadata-crc32.patch new file +89 -0
89 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0005-Platform-corstone1000-fwu-metadata_read-validate-crc.patch new file +99 -0
99 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0006-Platform-corstone1000-Add-common-platform-logger.patch new file +125 -0
125 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0007-Platform-corstone1000-Introduce-GPT-parser.patch new file +735 -0
266 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0008-Platform-corstone1000-BL1-changes-to-adapt-to-new-fl.patch new file +337 -0
337 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0009-Platform-corstone1000-BL2-uses-GPT-layout.patch new file +411 -0
411 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0010-Platform-corstone1000-flash_layout-simplification.patch new file +103 -0
103 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0011-corstone1000-make-sure-to-write-fwu-metadata-to-repl.patch new file +43 -0
43 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-1.7.0-corstone1000.inc +12 -5
Lines of this file are not shown. View the raw message.
meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0027-drivers-nvmxip-introduce-NVM-XIP-block-storage-emula.patch new file +595 -0
595 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0028-sandbox64-fix-return-unsigned-long-in-readq.patch new file +46 -0
46 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0029-sandbox64-add-support-for-NVMXIP-QSPI.patch new file +113 -0
113 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0030-corstone1000-add-NVM-XIP-QSPI-device-tree-node.patch new file +35 -0
Lines of this file are not shown. View the raw message.
meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0031-corstone1000-enable-NVM-XIP-QSPI-flash.patch new file +29 -0
Lines of this file are not shown. View the raw message.
meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0032-sandbox64-add-a-test-case-for-UCLASS_NVMXIP.patch new file +174 -0
174 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0033-nvmxip-provide-a-u-boot-shell-test-command.patch new file +135 -0
135 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0034-corstone1000-add-fwu-metadata-store-info.patch new file +42 -0
42 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0035-nvmxip-shorter-block-device-name.patch new file +44 -0
44 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0036-efi_boottime-allow-to-reset-a-path-after-boot.patch new file +31 -0
Lines of this file are not shown. View the raw message.
meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0037-fwu_metadata-make-sure-structures-are-packed.patch new file +50 -0
50 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0038-corstone1000-add-boot-index.patch new file +33 -0
Lines of this file are not shown. View the raw message.
meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0039-corstone1000-adjust-boot-bank-and-kernel-location.patch new file +36 -0
Lines of this file are not shown. View the raw message.
meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0040-corstone1000-add-nvmxip-fwu-mdata-and-gpt-options.patch new file +133 -0
133 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0041-nvmxip-move-header-to-include.patch new file +42 -0
42 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0042-corstone1000-set-kernel_addr-based-on-boot_idx.patch new file +112 -0
112 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0043-corstone1000-boot-index-from-active.patch new file +42 -0
42 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/u-boot/u-boot_%.bbappend +17 -0
Lines of this file are not shown. View the raw message.
meta-arm-bsp/wic/corstone1000-image.corstone1000.wks +26 -6
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.34.1
Part of the diff is not shown here. View the raw message.
Jon Mason
AppliedQuoted 10 lines · Rui Miguel Silva
Introduce the use of a gpt partition type layout, and use the firmware metadata as source of the current boot bank to boot from in the different boot stages.
This needs to be a large changeset, since it touches a lot of software components to guarantee that everything works in an atomic way, to not break the build and/or the boot flow of the corstone1000 platform.
[...]
Applied, thanks!
[1/1] arm-bsp/corstone1000: new gpt based disk layout and fwu metadata
commit: 2be960d8b790afc90552c149fd00be20b7f9bd81
Best regards,
Signature · 1 line
Jon Mason <[email protected]>