Skip to contentSkip to conversation

Revert "arm-bsp/documentation: corstone1000: update capsule generation steps"

PATCH Applied Jon Mason 1 participant 4 messages Apr 23, 2024 – Apr 24, 2024

lore
Share & tools
lore

Jon Mason

author
#0 lore raw

PATCH 1/3 Revert "arm-bsp/documentation: corstone1000: update capsule generation steps"

This reverts commit 527475c354d8897d96eb7cb7248f4207cd8f44f8.

---
 .../documentation/corstone1000/user-guide.rst | 95 +++++++++++--------
 1 file changed, 58 insertions(+), 37 deletions(-)
meta-arm-bsp/documentation/corstone1000/user-guide.rst +58 -37
index 778e0113da2a..06353b5d3e8e 100644
@@ -692,6 +692,24 @@ incorrect capsule (corrupted or outdated) which fails to boot to the host softwa
 Check the "Run SystemReady-IR ACS tests" section above to download and unpack the ACS image file
  - ``ir-acs-live-image-generic-arm64.wic.xz``
 
+
+Download u-boot under <_workspace> and install tools:
+
+::
+
+  git clone https://github.com/u-boot/u-boot.git
+  cd u-boot
+  git checkout 83aa0ed1e93e1ffac24888d98d37a5b04ed3fb07
+  make tools-only_defconfig
+  make tools-only
+
+**NOTE:** The following error could happen if the linux build system does not have "libgnutls28-dev".
+ **error: "tools/mkeficapsule.c:21:10: fatal error: gnutls/gnutls.h: No such file or directory"**. If that's the case please install libgnutls28-dev and its dependencies by using the following command.
+
+::
+
+  sudo apt-get install -y libgnutls28-dev
+
 Download systemready-patch repo under <_workspace>:
 ::
 
@@ -701,48 +719,51 @@ Download systemready-patch repo under <_workspace>:
 Generating Capsules
 *******************
 
-A no-partition image is created during the Yocto build. An update capsule is generated using this ``.nopt`` image.
-This can be found in ``build/tmp_corstone1000-<fvp/mps3>/deploy/images/corstone1000-<fvp/mps3>/corstone1000-<fvp/mps3>_image.nopt``.
-The capsule's default metadata (name, version, etc.) can be found in ``meta-arm/meta-arm-bsp/recipes-bsp/images/corstone1000-flash-firmware-image.bb``
-and ``meta-arm/kas/corstone1000-image-configuration.yml``.
+Generating FPGA Capsules
+========================
 
-FPGA Capsules
-=============
+::
 
-The generated capsule can be found in ``build/tmp_corstone1000-mps3/deploy/images/corstone1000-mps3/corstone1000-mps3-v6.uefi.capsule``.
-If a new capsule has to be generated with different metadata, then it can be done by using the ``u-boot-tools`` and the previously
-created ``.nopt`` image.
+   cd <_workspace>/build/tmp/deploy/images/corstone1000-mps3/
+   sh <_workspace>/systemready-patch/embedded-a/corstone1000/capsule_gen/capsule_gen.sh -d mps3
+
+This will generate a file called "corstone1000_image.nopt" which will be used to
+generate a UEFI capsule.
 
-For example a capsule for the negative update test scenario, if the host's architecture is x86_64:
 ::
 
    cd <_workspace>
 
-   ./build/tmp/sysroots-components/x86_64/u-boot-tools-native/usr/bin/mkeficapsule --monotonic-count 1 \
-   --private-key build/tmp/deploy/images/corstone1000-mps3/corstone1000_capsule_key.key \
+   ./u-boot/tools/mkeficapsule --monotonic-count 1 --private-key build/tmp/deploy/images/corstone1000-mps3/corstone1000_capsule_key.key \
    --certificate build/tmp/deploy/images/corstone1000-mps3/corstone1000_capsule_cert.crt --index 1 --guid df1865d1-90fb-4d59-9c38-c9f2c1bba8cc \
-   --fw-version 5 build/tmp_corstone1000-mps3/deploy/images/corstone1000-mps3/corstone1000-mps3_image.nopt corstone1000-mps3-v5.uefi.capsule
+   --fw-version 6 build/tmp/deploy/images/corstone1000-mps3/corstone1000_image.nopt cs1k_cap_mps3_v6
 
-This command will put the newly generated capsule to the ``<_workspace>`` directory.
+   ./u-boot/tools/mkeficapsule --monotonic-count 1 --private-key build/tmp/deploy/images/corstone1000-mps3/corstone1000_capsule_key.key \
+   --certificate build/tmp/deploy/images/corstone1000-mps3/corstone1000_capsule_cert.crt --index 1 --guid df1865d1-90fb-4d59-9c38-c9f2c1bba8cc \
+   --fw-version 5 build/tmp/deploy/images/corstone1000-mps3/corstone1000_image.nopt cs1k_cap_mps3_v5
 
 Generating FVP Capsules
 =======================
 
-The generated capsule can be found in ``build/tmp_corstone1000-fvp/deploy/images/corstone1000-fvp/corstone1000-fvp-v6.uefi.capsule``.
-If a new capsule has to be generated with different metadata, then it can be done by using the ``u-boot-tools`` and the previously
-created ``.nopt`` image.
+::
+
+   cd <_workspace>/build/tmp/deploy/images/corstone1000-fvp/
+   sh <_workspace>/systemready-patch/embedded-a/corstone1000/capsule_gen/capsule_gen.sh -d fvp
+
+This will generate a file called "corstone1000_image.nopt" which will be used to
+generate a UEFI capsule.
 
-For example a capsule for the negative update test scenario, if the host's architecture is x86_64:
 ::
 
    cd <_workspace>
+   ./u-boot/tools/mkeficapsule --monotonic-count 1 --private-key build/tmp/deploy/images/corstone1000-fvp/corstone1000_capsule_key.key \
+   --certificate build/tmp/deploy/images/corstone1000-fvp/corstone1000_capsule_cert.crt --index 1 --guid 989f3a4e-46e0-4cd0-9877-a25c70c01329 \
+   --fw-version 6 build/tmp/deploy/images/corstone1000-fvp/corstone1000_image.nopt cs1k_cap_fvp_v6
 
-   ./build/tmp/sysroots-components/x86_64/u-boot-tools-native/usr/bin/mkeficapsule --monotonic-count 1 \
-   --private-key build/tmp/deploy/images/corstone1000-fvp/corstone1000_capsule_key.key \
+   ./u-boot/tools/mkeficapsule --monotonic-count 1 --private-key build/tmp/deploy/images/corstone1000-fvp/corstone1000_capsule_key.key \
    --certificate build/tmp/deploy/images/corstone1000-fvp/corstone1000_capsule_cert.crt --index 1 --guid 989f3a4e-46e0-4cd0-9877-a25c70c01329 \
-   --fw-version 5 build/tmp_corstone1000-fvp/deploy/images/corstone1000-fvp/corstone1000-fvp_image.nopt corstone1000-fvp-v5.uefi.capsule
+   --fw-version 5 build/tmp/deploy/images/corstone1000-fvp/corstone1000_image.nopt cs1k_cap_fvp_v5
 
-This command will put the newly generated capsule to the ``<_workspace>`` directory.
 
 Common Notes for FVP and FPGA
 =============================
@@ -761,15 +782,15 @@ Copying the FPGA capsules
 =========================
 
 The user should prepare a USB stick as explained in ACS image section `FPGA instructions for ACS image`_.
-Place the generated ``corstone1000-mps3-v<5/6>.uefi.capsule`` files in the root directory of the boot partition
-in the USB stick. Note: As we are running the direct method, the ``corstone1000-mps3-v<5/6>.uefi.capsule`` files
+Place the generated ``cs1k_cap`` files in the root directory of the boot partition
+in the USB stick. Note: As we are running the direct method, the ``cs1k_cap`` file
 should not be under the EFI/UpdateCapsule directory as this may or may not trigger
 the on disk method.
 
 ::
 
-   sudo cp <capsule path>/corstone1000-mps3-v6.uefi.capsule <mounting path>/BOOT/
-   sudo cp <capsule path>/corstone1000-mps3-v5.uefi.capsule <mounting path>/BOOT/
+   sudo cp cs1k_cap_mps3_v6 <mounting path>/BOOT/
+   sudo cp cs1k_cap_mps3_v5 <mounting path>/BOOT/
    sync
 
 Copying the FVP capsules
@@ -786,8 +807,8 @@ Then, copy the capsules:
 
 ::
 
-   sudo cp <capsule path>/corstone1000-fvp-v6.uefi.capsule /mnt/test/
-   sudo cp <capsule path>/corstone1000-fvp-v5.uefi.capsule /mnt/test/
+   sudo cp cs1k_cap_fvp_v6 /mnt/test/
+   sudo cp cs1k_cap_fvp_v5 /mnt/test/
    sync
 
 Then, unmount the IR image:
@@ -802,13 +823,8 @@ Then, unmount the IR image:
 Performing the capsule update
 ******************************
 
-During this section we will be using the capsule with the higher version (``corstone1000-<fvp/mps3>-v6.uefi.capsule``) for the positive scenario
-and the capsule with the lower version (``corstone1000-<fvp/mps3>-v5.uefi.capsule``) for the negative scenario.
-
-Running the FPGA with the IR prebuilt image
-===========================================
-
-Insert the prepared USB stick then Power cycle the MPS3 board.
+During this section we will be using the capsule with the higher version (cs1k_cap_<fvp/mps3>_v6) for the positive scenario
+and the capsule with the lower version (cs1k_cap_<fvp/mps3>_v5) for the negative scenario.
 
 Running the FVP with the IR prebuilt image
 ==========================================
@@ -821,6 +837,11 @@ Run the FVP with the IR prebuilt image:
 
 **NOTE:** <path-to-img> must start from the root directory. make sure there are no spaces before or after of "=". board.msd_mmc.p_mmc_file=<path-to-img>/ir-acs-live-image-generic-arm64.wic.
 
+Running the FPGA with the IR prebuilt image
+===========================================
+
+Insert the prepared USB stick then Power cycle the MPS3 board.
+
 Executing capsule update for FVP and FPGA
 =========================================
 
@@ -840,7 +861,7 @@ In case of the positive scenario run the update with the higher version capsule
 
 ::
 
-  EFI/BOOT/app/CapsuleApp.efi corstone1000-<fvp/mps3>-v6.uefi.capsule
+  EFI/BOOT/app/CapsuleApp.efi cs1k_cap_<fvp/mps3>_v6
 
 After successfully updating the capsule the system will reset.
 
@@ -848,7 +869,7 @@ In case of the negative scenario run the update with the lower version capsule a
 
 ::
 
-  EFI/BOOT/app/CapsuleApp.efi corstone1000-<fvp/mps3>-v5.uefi.capsule
+  EFI/BOOT/app/CapsuleApp.efi cs1k_cap_<fvp/mps3>_v5
 
 The command above should fail and in the TF-M logs the following message should appear:
 
Signature · 1 line
2.30.2
author
#1 lore raw

PATCH 2/3 Revert "arm/uefi_capsule: use U-Boot for capsule generation"

This reverts commit d0d1b96b0a39b973b6b882e561752c1fd7065fc7.

---
 kas/corstone1000-image-configuration.yml      |  5 --
 .../corstone1000-firmware-deploy-image.inc    |  2 +-
 .../corstone1000-flash-firmware-image.bb      | 26 ++--------
 ...h-firmware-image-capsule-update-image.json | 11 +++++
 meta-arm/classes/uefi_capsule.bbclass         | 49 ++++++++++---------
 5 files changed, 41 insertions(+), 52 deletions(-)
 create mode 100644 meta-arm-bsp/recipes-bsp/images/files/corstone1000-flash-firmware-image-capsule-update-image.json
kas/corstone1000-image-configuration.yml +0 -5
index 0136048476a2..2b2852230b42 100644
@@ -38,8 +38,3 @@ local_conf_header:
 
     # TS PSA API tests commands for crypto, its, ps and iat
     CORE_IMAGE_EXTRA_INSTALL += "packagegroup-ts-tests-psa"
-
-  capsule: |
-    CAPSULE_EXTENSION = "uefi.capsule"
-    CAPSULE_FW_VERSION = "6"
-    CAPSULE_NAME = "${MACHINE}-v${CAPSULE_FW_VERSION}"
meta-arm-bsp/recipes-bsp/images/corstone1000-firmware-deploy-image.inc +1 -1
index f959573d8051..2d192745fdf5 100644
@@ -3,7 +3,7 @@ COMPATIBLE_MACHINE = "corstone1000"
 FIRMWARE_BINARIES = "corstone1000-flash-firmware-image-${MACHINE}.wic \
                      bl1.bin \
                      es_flashfw.bin \
-                     ${CAPSULE_NAME}.${CAPSULE_EXTENSION} \
+                     corstone1000-flash-firmware-image-${MACHINE}.wic.uefi.capsule \
                      corstone1000_capsule_cert.crt \
                      corstone1000_capsule_key.key \
                     "
meta-arm-bsp/recipes-bsp/images/corstone1000-flash-firmware-image.bb +3 -23
index 0f5ae011049b..5238d1d34fff 100644
@@ -12,12 +12,10 @@ IMAGE_FSTYPES = "wic uefi_capsule"
 inherit image
 inherit tfm_sign_image
 inherit uefi_capsule
-inherit deploy
 
 DEPENDS += "external-system \
             trusted-firmware-a \
             trusted-firmware-m \
-            u-boot \
 "
 
 IMAGE_FEATURES = ""
@@ -25,21 +23,9 @@ IMAGE_LINGUAS = ""
 
 PACKAGE_INSTALL = ""
 
-# The generated ${MACHINE}_image.nopt is used instead of the default wic image
-# for the capsule generation. The uefi.capsule image type doesn't have to
-# depend on the wic because of this.
-#
-# The corstone1000_capsule_cert.crt and corstone1000_capsule_key.key are installed
-# by the U-Boot recipe so this recipe has to depend on that.
-CAPSULE_IMGTYPE = ""
-CAPSULE_CERTIFICATE_PATH = "${DEPLOY_DIR_IMAGE}/corstone1000_capsule_cert.crt"
-CAPSULE_GUID:corstone1000-fvp ?= "989f3a4e-46e0-4cd0-9877-a25c70c01329"
-CAPSULE_GUID:corstone1000-mps3 ?= "df1865d1-90fb-4d59-9c38-c9f2c1bba8cc"
-CAPSULE_IMGLOCATION = "${DEPLOY_DIR_IMAGE}"
-CAPSULE_INDEX = "1"
-CAPSULE_MONOTONIC_COUNT = "1"
-CAPSULE_PRIVATE_KEY_PATH = "${DEPLOY_DIR_IMAGE}/corstone1000_capsule_key.key"
-UEFI_FIRMWARE_BINARY = "${B}/${MACHINE}_image.nopt"
+UEFI_FIRMWARE_BINARY = "${IMAGE_LINK_NAME}.${CAPSULE_IMGTYPE}"
+UEFI_CAPSULE_CONFIG = "${THISDIR}/files/${PN}-capsule-update-image.json"
+CAPSULE_IMGTYPE = "wic"
 
 # TF-A settings for signing host images
 TFA_BL2_BINARY = "bl2-corstone1000.bin"
@@ -87,9 +73,3 @@ create_nopt_image() {
 }
 create_nopt_image[depends] += "mc:firmware:linux-yocto:do_deploy"
 do_image_uefi_capsule[prefuncs] += "create_nopt_image"
-
-do_deploy() {
-    install -m 0755 ${B}/${MACHINE}_image.nopt  ${DEPLOYDIR}
-}
-
-addtask deploy after do_image_uefi_capsule
meta-arm-bsp/recipes-bsp/images/files/corstone1000-flash-firmware-image-capsule-update-image.json new file +11 -0
new file mode 100644
index 000000000000..0f011ff740cf
@@ -0,0 +1,11 @@
+{
+    "Payloads": [
+        {
+            "FwVersion": "5",
+            "Guid": "e2bb9c06-70e9-4b14-97a3-5a7913176e3f",
+            "LowestSupportedVersion": "1",
+            "Payload": "$UEFI_FIRMWARE_BINARY",
+            "UpdateImageIndex": "0"
+        }
+    ]
+}
meta-arm/classes/uefi_capsule.bbclass +26 -23

73 lines not on this page · raw message

Signature · 1 line
2.30.2
author
#2 lore raw

PATCH 3/3 Revert "arm-bsp/corstone1000-flash-firmware-image: add nopt generation"

In reply to Jon Mason

This reverts commit e6ff022d6d3d6cbcbd9b30006a75be69f7d35c29.

---
 .../images/corstone1000-flash-firmware-image.bb | 17 -----------------
 1 file changed, 17 deletions(-)
meta-arm-bsp/recipes-bsp/images/corstone1000-flash-firmware-image.bb +0 -17
index 5238d1d34fff..73fc17664d87 100644
@@ -38,11 +38,6 @@ RE_LAYOUT_WRAPPER_VERSION = "0.0.7"
 TFM_SIGN_PRIVATE_KEY = "${libdir}/tfm-scripts/root-RSA-3072_1.pem"
 RE_IMAGE_OFFSET = "0x1000"
 
-# Offsets for the .nopt image generation
-TFM_OFFSET = "102400"
-FIP_OFFSET = "479232"
-KERNEL_OFFSET = "2576384"
-
 do_sign_images() {
     # Sign TF-A BL2
     sign_host_image ${RECIPE_SYSROOT}/firmware/${TFA_BL2_BINARY} \
@@ -61,15 +56,3 @@ do_sign_images() {
 do_sign_images[depends] = "\
     fiptool-native:do_populate_sysroot \
     "
-
-# This .nopt image is not the same as the one which is generated by meta-arm/meta-arm/classes/wic_nopt.bbclass.
-# The meta-arm/meta-arm/classes/wic_nopt.bbclass removes the partition table from the wic image, but keeps the
-# second bank. This function creates a no-partition image with only the first bank.
-create_nopt_image() {
-    dd conv=notrunc bs=1 if=${DEPLOY_DIR_IMAGE}/bl2_signed.bin of=${B}/${MACHINE}_image.nopt
-    dd conv=notrunc bs=1 if=${DEPLOY_DIR_IMAGE}/tfm_s_signed.bin of=${B}/${MACHINE}_image.nopt seek=${TFM_OFFSET}
-    dd conv=notrunc bs=1 if=${DEPLOY_DIR_IMAGE}/signed_fip-corstone1000.bin of=${B}/${MACHINE}_image.nopt seek=${FIP_OFFSET}
-    dd conv=notrunc bs=1 if=${DEPLOY_DIR_IMAGE}/Image.gz-initramfs-${MACHINE}.bin of=${B}/${MACHINE}_image.nopt seek=${KERNEL_OFFSET}
-}
-create_nopt_image[depends] += "mc:firmware:linux-yocto:do_deploy"
-do_image_uefi_capsule[prefuncs] += "create_nopt_image"
Signature · 1 line
2.30.2
author Applied
#3 lore raw
In reply to Jon Mason
Quoted 2 lines · Jon Mason

This reverts commit 527475c354d8897d96eb7cb7248f4207cd8f44f8.

Applied, thanks!

[1/3] Revert "arm-bsp/documentation: corstone1000: update capsule generation steps"

      commit: 08474f5ce44ab886821953766984fd4215e51612
[2/3] Revert "arm/uefi_capsule: use U-Boot for capsule generation"
      commit: 39d31fff7f34c59ce220541ee9b329d1ad166576
[3/3] Revert "arm-bsp/corstone1000-flash-firmware-image: add nopt generation"
      commit: 6b64cd3704bbda28debcf1171ef0751178f6fcf9

Best regards,

Signature · 1 line
Jon Mason <[email protected]>