Update UEFI capsule generation to use json config file
cover Update UEFI capsule generation to use json config file
From: Gowtham Suresh Kumar <[email protected]>
The UEFI capsule parameters can be passed to the script using a json file which is easily scalable when generating multiple capsules. Also the edk2 base tools recipe is made native only.
Gowtham Suresh Kumar (2):
arm/edk2-basetools: Convert edk2 basetools recipes to native only arm-bsp/uefi_capsule: Use json file to pass capsule config
.../recipes-bsp/images/corstone1000-image.bb | 8 +++---
...rstone1000-image-capsule-update-image.json | 11 ++++++++
meta-arm/classes/uefi_capsule.bbclass | 27 ++++++++++++-------
...211.bb => edk2-basetools-native_202211.bb} | 6 ++---
4 files changed, 35 insertions(+), 17 deletions(-)
create mode 100644 meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-update-image.json
rename meta-arm/recipes-devtools/edk2-basetools/{edk2-basetools_202211.bb => edk2-basetools-native_202211.bb} (92%)--
2.17.1
PATCH 1/2 arm/edk2-basetools: Convert edk2 basetools recipes to native only
From: Gowtham Suresh Kumar <[email protected]>
The BBCLASSEXTEND configuration can generate native sdk and target recipes as well. The cp command used in do_install will create host contamination issues for these recipes, so this patch makes the recipe native only.
---
...-basetools_202211.bb => edk2-basetools-native_202211.bb} | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
rename meta-arm/recipes-devtools/edk2-basetools/{edk2-basetools_202211.bb => edk2-basetools-native_202211.bb} (92%)meta-arm/recipes-devtools/edk2-basetools/edk2-basetools-native_202211.bb renamed from meta-arm/recipes-devtools/edk2-basetools/edk2-basetools_202211.bb +3 -3
@@ -3,7 +3,7 @@ # generating UEFI capsules as it only depends on some python scripts. Other # tools need to be built first before adding to sysroot. -DESCRIPTION = "EDK2 Base Tools" +SUMMARY = "EDK2 Base Tools" LICENSE = "BSD-2-Clause-Patent" # EDK2
@@ -14,11 +14,11 @@ SRCREV = "fff6d81270b57ee786ea18ad74f43149b9f03494" S = "${WORKDIR}/git" +inherit native + RDEPENDS:${PN} += "python3-core" do_install () { mkdir -p ${D}${bindir}/edk2-BaseTools cp -r ${WORKDIR}/git/BaseTools/* ${D}${bindir}/edk2-BaseTools/ } - -BBCLASSEXTEND = "native"
Signature · 1 line
2.17.1
PATCH 2/2 arm-bsp/uefi_capsule: Use json file to pass capsule config
In reply to [email protected]From: Gowtham Suresh Kumar <[email protected]>
This patch uses the json config file for UEFI capsule generation as this is efficient and easily scalable to generate multiple capsules.
--- .../recipes-bsp/images/corstone1000-image.bb | 8 +++--- ...rstone1000-image-capsule-update-image.json | 11 ++++++++ meta-arm/classes/uefi_capsule.bbclass | 27 ++++++++++++------- 3 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-update-image.json
meta-arm-bsp/recipes-bsp/images/corstone1000-image.bb +3 -5
@@ -13,11 +13,9 @@ PACKAGE_INSTALL = "" IMAGE_FSTYPES += "wic wic.nopt uefi_capsule" -UEFI_FIRMWARE_BINARY = "corstone1000-image-${MACHINE}.wic.nopt" -UEFI_FIRMWARE_VERSION = "5" -UEFI_FIRMWARE_LSV = "0" -UEFI_FIRMWARE_GUID = "e2bb9c06-70e9-4b14-97a3-5a7913176e3f" -UEFI_FIRMWARE_UPDATE_INDEX = "0" +UEFI_FIRMWARE_BINARY = "${PN}-${MACHINE}.wic.nopt" +UEFI_CAPSULE_CONFIG = "${THISDIR}/files/${PN}-capsule-update-image.json" +CAPSULE_IMGTYPE = "wic.nopt" do_sign_images() { # Sign TF-A BL2
meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-update-image.json new file +11 -0
@@ -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 +18 -9
@@ -1,6 +1,7 @@ # This class generates UEFI capsules # The current class supports generating a capsule with single firmware binary +DEPENDS += "gettext-native" inherit python3native IMAGE_TYPES += "uefi_capsule"
@@ -19,14 +20,11 @@ CAPSULE_EXTENSION ?= "uefi.capsule" # The following variables must be set to be able to generate a capsule update UEFI_FIRMWARE_BINARY ?= "" -UEFI_FIRMWARE_VERSION ?= "" -UEFI_FIRMWARE_LSV ?= "" -UEFI_FIRMWARE_GUID ?= "" -UEFI_FIRMWARE_UPDATE_INDEX ?= "" +UEFI_CAPSULE_CONFIG ?= "" # Check if the required variables are set python() { - for var in ["UEFI_FIRMWARE_BINARY", "UEFI_FIRMWARE_VERSION", "UEFI_FIRMWARE_LSV", "UEFI_FIRMWARE_GUID", "UEFI_FIRMWARE_UPDATE_INDEX"]: + for var in ["UEFI_FIRMWARE_BINARY", "UEFI_CAPSULE_CONFIG"]: if not d.getVar(var): raise bb.parse.SkipRecipe(f"{var} not set") }
@@ -36,10 +34,21 @@ IMAGE_CMD:uefi_capsule(){ # Force the GenerateCapsule script to use python3 export PYTHON_COMMAND=${PYTHON} - ${STAGING_DIR_NATIVE}/usr/bin/edk2-BaseTools/BinWrappers/PosixLike/GenerateCapsule -e -o \ - ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY}.${CAPSULE_EXTENSION} --fw-version ${UEFI_FIRMWARE_VERSION} \ - --lsv ${UEFI_FIRMWARE_LSV} --guid ${UEFI_FIRMWARE_GUID} --verbose --update-image-index \ - ${UEFI_FIRMWARE_UPDATE_INDEX} --verbose ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY} + # Copy the firmware and the capsule config json to current directory + if [ -e ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY} ]; then + cp ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY} . ; + fi + + export UEFI_FIRMWARE_BINARY=${UEFI_FIRMWARE_BINARY} + envsubst < ${UEFI_CAPSULE_CONFIG} > ./${MACHINE}-capsule-update-image.json + + ${STAGING_DIR_NATIVE}/usr/bin/edk2-BaseTools/BinWrappers/PosixLike/GenerateCapsule \ + -e -o ${UEFI_FIRMWARE_BINARY}.${CAPSULE_EXTENSION} -j \ + ${MACHINE}-capsule-update-image.json + + # Remove the firmware to avoid contamination of IMGDEPLOYDIR + rm ${UEFI_FIRMWARE_BINARY} + } # The firmware binary should be created before generating the capsule
Signature · 1 line
2.17.1
Re: [meta-arm] [PATCH 2/2] arm-bsp/uefi_capsule: Use json file to pass capsule config
Hi Gowtham,
Gowtham Suresh Kumar <[email protected]> escreveu no dia quarta, 15/02/2023 à(s) 10:42:
Quoted 23 lines
From: Gowtham Suresh Kumar <[email protected]>
This patch uses the json config file for UEFI capsule generation as this is efficient and easily scalable to generate multiple capsules.
Signed-off-by Gowtham Suresh Kumar <[email protected]>--- .../recipes-bsp/images/corstone1000-image.bb | 8 +++--- ...rstone1000-image-capsule-update-image.json | 11 ++++++++ meta-arm/classes/uefi_capsule.bbclass | 27 ++++++++++++------- 3 files changed, 32 insertions(+), 14 deletions(-) create mode 100644
meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-update-image.jsonmeta-arm-bsp/recipes-bsp/images/corstone1000-image.bb +0
-0@@ -13,11 +13,9 @@ PACKAGE_INSTALL = "" IMAGE_FSTYPES += "wic wic.nopt uefi_capsule"
meta-arm-bsp/recipes-bsp/images/corstone1000-image.bb PACKAGE_INSTALL = "" · line 19
Quoted 10 lines
meta-arm-bsp/recipes-bsp/images/corstone1000-image.bb +3
-5-UEFI_FIRMWARE_BINARY = "corstone1000-image-${MACHINE}.wic.nopt" -UEFI_FIRMWARE_VERSION = "5" -UEFI_FIRMWARE_LSV = "0" -UEFI_FIRMWARE_GUID = "e2bb9c06-70e9-4b14-97a3-5a7913176e3f" -UEFI_FIRMWARE_UPDATE_INDEX = "0" +UEFI_FIRMWARE_BINARY = "${PN}-${MACHINE}.wic.nopt" +UEFI_CAPSULE_CONFIG = "${THISDIR}/files/${PN}-capsule-update-image.json" +CAPSULE_IMGTYPE = "wic.nopt"
Looks like this variable is not used anywhere.
Jose
Quoted 105 lines
meta-arm-bsp/recipes-bsp/images/corstone1000-image.bb +0
-0do_sign_images() { # Sign TF-A BL2diff --git
a/meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-update-image.jsonb/meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-update-image.jsonnew file mode 100644
index 00000000..0f011ff7
---/dev/null
+++b/meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-update-image.jsonmeta-arm-bsp/recipes-bsp/images/corstone1000-image.bb +11
-0@@ -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 +0
-0@@ -1,6 +1,7 @@ # This class generates UEFI capsules # The current class supports generating a capsule with single firmwarebinary
meta-arm/classes/uefi_capsule.bbclass +1
-0+DEPENDS += "gettext-native" inherit python3native IMAGE_TYPES += "uefi_capsule"@@ -19,14 +20,11 @@ CAPSULE_EXTENSION ?= "uefi.capsule" # The following variables must be set to be able to generate a capsuleupdate
UEFI_FIRMWARE_BINARY?= ""meta-arm/classes/uefi_capsule.bbclass +1
-5-UEFI_FIRMWARE_VERSION ?= "" -UEFI_FIRMWARE_LSV ?= "" -UEFI_FIRMWARE_GUID ?= "" -UEFI_FIRMWARE_UPDATE_INDEX ?= "" +UEFI_CAPSULE_CONFIG ?= "" # Check if the required variables are set python() { - for var in ["UEFI_FIRMWARE_BINARY", "UEFI_FIRMWARE_VERSION","
UEFI_FIRMWARE_LSV", "UEFI_FIRMWARE_GUID", "UEFI_FIRMWARE_UPDATE_INDEX"]:meta-arm/classes/uefi_capsule.bbclass +1
-1+ for var in ["UEFI_FIRMWARE_BINARY", "UEFI_CAPSULE_CONFIG"]: if not d.getVar(var): raise bb.parse.SkipRecipe(f"{var} not set") }@@ -36,10 +34,21 @@ IMAGE_CMD:uefi_capsule(){ # Force the GenerateCapsule script to use python3 export PYTHON_COMMAND=${PYTHON} -${STAGING_DIR_NATIVE}/usr/bin/edk2-BaseTools/BinWrappers/PosixLike/GenerateCapsule
meta-arm/classes/uefi_capsule.bbclass +0
-6-e -o \ - ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY}.${CAPSULE_EXTENSION} --fw-version ${UEFI_FIRMWARE_VERSION} \ - --lsv ${UEFI_FIRMWARE_LSV} --guid ${UEFI_FIRMWARE_GUID} --verbose --update-image-index \ - ${UEFI_FIRMWARE_UPDATE_INDEX} --verbose${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY}
meta-arm/classes/uefi_capsule.bbclass +7
-0+ # Copy the firmware and the capsule config json to current directory + if [ -e ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY} ]; then + cp ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY} . ; + fi + + export UEFI_FIRMWARE_BINARY=${UEFI_FIRMWARE_BINARY} + envsubst < ${UEFI_CAPSULE_CONFIG} >./${MACHINE}-capsule-update-image.json
meta-arm/classes/uefi_capsule.bbclass +2
-0+ +${STAGING_DIR_NATIVE}/usr/bin/edk2-BaseTools/BinWrappers/PosixLike/GenerateCapsule \
meta-arm/classes/uefi_capsule.bbclass +6
-1+ -e -o ${UEFI_FIRMWARE_BINARY}.${CAPSULE_EXTENSION} -j \ + ${MACHINE}-capsule-update-image.json + + # Remove the firmware to avoid contamination of IMGDEPLOYDIR + rm ${UEFI_FIRMWARE_BINARY} + } # The firmware binary should be created before generating the capsule --2.17.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#4391):
https://lists.yoctoproject.org/g/meta-arm/message/4391
Mute This Topic: https://lists.yoctoproject.org/mt/96980035/5052612
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-arm/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Best regards, José Quaresma
Re: [meta-arm] [PATCH 2/2] arm-bsp/uefi_capsule: Use json file to pass capsule config
Hello Jose,
The CAPSULE_IMGTYPE is used in the uefi_capsule.bbclass as shown below.
IMAGE_TYPEDEP:uefi_capsule:append = "${CAPSULE_IMGTYPE}"
Best regards,
Gowtham Suresh Kumar
________________________________
From: Jose Quaresma <[email protected]>
Sent: Wednesday, February 15, 2023 12:23 PM
To: Gowtham Suresh Kumar <[email protected]>
Cc: [email protected] <[email protected]>; Ross Burton <[email protected]>; nd <[email protected]>
Subject: Re: [meta-arm] [PATCH 2/2] arm-bsp/uefi_capsule: Use json file to pass capsule config
Hi Gowtham,
Gowtham Suresh Kumar <[email protected]<mailto:[email protected]>> escreveu no dia quarta, 15/02/2023 à(s) 10:42:
From: Gowtham Suresh Kumar <[email protected]<mailto:[email protected]>>
This patch uses the json config file for UEFI capsule generation as this is efficient and easily scalable to generate multiple capsules.
--- .../recipes-bsp/images/corstone1000-image.bb<http://corstone1000-image.bb> | 8 +++--- ...rstone1000-image-capsule-update-image.json | 11 ++++++++ meta-arm/classes/uefi_capsule.bbclass | 27 ++++++++++++------- 3 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-update-image.json
meta-arm-bsp/recipes-bsp/images/corstone1000-image.bb<http://corstone1000-image.bb> +3 -5
@@ -13,11 +13,9 @@ PACKAGE_INSTALL = "" IMAGE_FSTYPES += "wic wic.nopt uefi_capsule" -UEFI_FIRMWARE_BINARY = "corstone1000-image-${MACHINE}.wic.nopt" -UEFI_FIRMWARE_VERSION = "5" -UEFI_FIRMWARE_LSV = "0" -UEFI_FIRMWARE_GUID = "e2bb9c06-70e9-4b14-97a3-5a7913176e3f" -UEFI_FIRMWARE_UPDATE_INDEX = "0" +UEFI_FIRMWARE_BINARY = "${PN}-${MACHINE}.wic.nopt" +UEFI_CAPSULE_CONFIG = "${THISDIR}/files/${PN}-capsule-update-image.json" +CAPSULE_IMGTYPE = "wic.nopt"
Looks like this variable is not used anywhere.
Jose
do_sign_images() {
# Sign TF-A BL2
meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-update-image.json new file +11 -0
@@ -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 +18 -9
@@ -1,6 +1,7 @@ # This class generates UEFI capsules # The current class supports generating a capsule with single firmware binary +DEPENDS += "gettext-native" inherit python3native IMAGE_TYPES += "uefi_capsule"
@@ -19,14 +20,11 @@ CAPSULE_EXTENSION ?= "uefi.capsule" # The following variables must be set to be able to generate a capsule update UEFI_FIRMWARE_BINARY ?= "" -UEFI_FIRMWARE_VERSION ?= "" -UEFI_FIRMWARE_LSV ?= "" -UEFI_FIRMWARE_GUID ?= "" -UEFI_FIRMWARE_UPDATE_INDEX ?= "" +UEFI_CAPSULE_CONFIG ?= "" # Check if the required variables are set python() { - for var in ["UEFI_FIRMWARE_BINARY", "UEFI_FIRMWARE_VERSION", "UEFI_FIRMWARE_LSV", "UEFI_FIRMWARE_GUID", "UEFI_FIRMWARE_UPDATE_INDEX"]: + for var in ["UEFI_FIRMWARE_BINARY", "UEFI_CAPSULE_CONFIG"]: if not d.getVar(var): raise bb.parse.SkipRecipe(f"{var} not set") }
@@ -36,10 +34,21 @@ IMAGE_CMD:uefi_capsule(){ # Force the GenerateCapsule script to use python3 export PYTHON_COMMAND=${PYTHON} - ${STAGING_DIR_NATIVE}/usr/bin/edk2-BaseTools/BinWrappers/PosixLike/GenerateCapsule -e -o \ - ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY}.${CAPSULE_EXTENSION} --fw-version ${UEFI_FIRMWARE_VERSION} \ - --lsv ${UEFI_FIRMWARE_LSV} --guid ${UEFI_FIRMWARE_GUID} --verbose --update-image-index \ - ${UEFI_FIRMWARE_UPDATE_INDEX} --verbose ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY} + # Copy the firmware and the capsule config json to current directory + if [ -e ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY} ]; then + cp ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY} . ; + fi + + export UEFI_FIRMWARE_BINARY=${UEFI_FIRMWARE_BINARY} + envsubst < ${UEFI_CAPSULE_CONFIG} > ./${MACHINE}-capsule-update-image.json + + ${STAGING_DIR_NATIVE}/usr/bin/edk2-BaseTools/BinWrappers/PosixLike/GenerateCapsule \ + -e -o ${UEFI_FIRMWARE_BINARY}.${CAPSULE_EXTENSION} -j \ + ${MACHINE}-capsule-update-image.json + + # Remove the firmware to avoid contamination of IMGDEPLOYDIR + rm ${UEFI_FIRMWARE_BINARY} + } # The firmware binary should be created before generating the capsule
--
2.17.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#4391): https://lists.yoctoproject.org/g/meta-arm/message/4391
Mute This Topic: https://lists.yoctoproject.org/mt/96980035/5052612
Group Owner: [email protected]<mailto:meta-arm%[email protected]>
Unsubscribe: https://lists.yoctoproject.org/g/meta-arm/unsub [[email protected]<mailto:[email protected]>]
-=-=-=-=-=-=-=-=-=-=-=-
--
Best regards,
José Quaresma
Re: [meta-arm] [PATCH 2/2] arm-bsp/uefi_capsule: Use json file to pass capsule config
Gowtham Suresh Kumar <[email protected]> escreveu no dia quarta, 15/02/2023 à(s) 12:44:
Quoted 6 lines
Hello Jose,
The
CAPSULE_IMGTYPEis used in the uefi_capsule.bbclass as shown below.IMAGE_TYPEDEP:uefi_capsule:append = "${CAPSULE_IMGTYPE}"
Yup, sorry for the noise.
Since it is needed, it can be reused in:
-UEFI_FIRMWARE_BINARY = "${PN}-${MACHINE}.wic.nopt" +UEFI_FIRMWARE_BINARY = "${PN}-${MACHINE}.${CAPSULE_IMGTYPE}"
Jose
Quoted 166 lines
Best regards,
Gowtham Suresh Kumar
------------------------------
*From:* Jose Quaresma <[email protected]>
*Sent:* Wednesday, February 15, 2023 12:23 PM
*To:* Gowtham Suresh Kumar <[email protected]> *Cc:* [email protected] <[email protected]>; Ross Burton <[email protected]>; nd <[email protected]>
*Subject:* Re: [meta-arm] [PATCH 2/2] arm-bsp/uefi_capsule: Use json file to pass capsule configHi Gowtham,
Gowtham Suresh Kumar <[email protected]> escreveu no dia quarta, 15/02/2023 à(s) 10:42:
From: Gowtham Suresh Kumar <[email protected]>
This patch uses the json config file for UEFI capsule generation as this is efficient and easily scalable to generate multiple capsules.
Signed-off-by Gowtham Suresh Kumar <[email protected]>--- .../recipes-bsp/images/corstone1000-image.bb | 8 +++--- ...rstone1000-image-capsule-update-image.json | 11 ++++++++ meta-arm/classes/uefi_capsule.bbclass | 27 ++++++++++++------- 3 files changed, 32 insertions(+), 14 deletions(-) create mode 100644
meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-update-image.jsonmeta-arm-bsp/recipes-bsp/images/corstone1000-image.bb +3
-5@@ -13,11 +13,9 @@ PACKAGE_INSTALL = "" IMAGE_FSTYPES += "wic wic.nopt uefi_capsule" -UEFI_FIRMWARE_BINARY = "corstone1000-image-${MACHINE}.wic.nopt" -UEFI_FIRMWARE_VERSION = "5" -UEFI_FIRMWARE_LSV = "0" -UEFI_FIRMWARE_GUID = "e2bb9c06-70e9-4b14-97a3-5a7913176e3f" -UEFI_FIRMWARE_UPDATE_INDEX = "0" +UEFI_FIRMWARE_BINARY = "${PN}-${MACHINE}.wic.nopt" +UEFI_CAPSULE_CONFIG = "${THISDIR}/files/${PN}-capsule-update-image.json" +CAPSULE_IMGTYPE = "wic.nopt"Looks like this variable is not used anywhere.
Jose
do_sign_images(){
# Sign TF-A BL2
diff --gita/meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-update-image.jsonb/meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-update-image.jsonnew file mode 100644
index 00000000..0f011ff7
---/dev/null
+++b/meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-update-image.jsonmeta-arm-bsp/recipes-bsp/images/corstone1000-image.bb +11
-0@@ -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 +0
-0@@ -1,6 +1,7 @@ # This class generates UEFI capsules # The current class supports generating a capsule with single firmwarebinary
meta-arm/classes/uefi_capsule.bbclass +1
-0+DEPENDS += "gettext-native" inherit python3native IMAGE_TYPES += "uefi_capsule"@@ -19,14 +20,11 @@ CAPSULE_EXTENSION ?= "uefi.capsule" # The following variables must be set to be able to generate a capsuleupdate
UEFI_FIRMWARE_BINARY?= ""meta-arm/classes/uefi_capsule.bbclass +1
-5-UEFI_FIRMWARE_VERSION ?= "" -UEFI_FIRMWARE_LSV ?= "" -UEFI_FIRMWARE_GUID ?= "" -UEFI_FIRMWARE_UPDATE_INDEX ?= "" +UEFI_CAPSULE_CONFIG ?= "" # Check if the required variables are set python() { - for var in ["UEFI_FIRMWARE_BINARY", "UEFI_FIRMWARE_VERSION","
UEFI_FIRMWARE_LSV", "UEFI_FIRMWARE_GUID", "UEFI_FIRMWARE_UPDATE_INDEX"]:meta-arm/classes/uefi_capsule.bbclass +1
-1+ for var in ["UEFI_FIRMWARE_BINARY", "UEFI_CAPSULE_CONFIG"]: if not d.getVar(var): raise bb.parse.SkipRecipe(f"{var} not set") }@@ -36,10 +34,21 @@ IMAGE_CMD:uefi_capsule(){ # Force the GenerateCapsule script to use python3 export PYTHON_COMMAND=${PYTHON} -${STAGING_DIR_NATIVE}/usr/bin/edk2-BaseTools/BinWrappers/PosixLike/GenerateCapsule
meta-arm/classes/uefi_capsule.bbclass +0
-6-e -o \ - ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY}.${CAPSULE_EXTENSION} --fw-version ${UEFI_FIRMWARE_VERSION} \ - --lsv ${UEFI_FIRMWARE_LSV} --guid ${UEFI_FIRMWARE_GUID} --verbose --update-image-index \ - ${UEFI_FIRMWARE_UPDATE_INDEX} --verbose${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY}
meta-arm/classes/uefi_capsule.bbclass +7
-0+ # Copy the firmware and the capsule config json to current directory + if [ -e ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY} ]; then + cp ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY} . ; + fi + + export UEFI_FIRMWARE_BINARY=${UEFI_FIRMWARE_BINARY} + envsubst < ${UEFI_CAPSULE_CONFIG} >./${MACHINE}-capsule-update-image.json
meta-arm/classes/uefi_capsule.bbclass +2
-0+ +${STAGING_DIR_NATIVE}/usr/bin/edk2-BaseTools/BinWrappers/PosixLike/GenerateCapsule \
meta-arm/classes/uefi_capsule.bbclass +6
-1+ -e -o ${UEFI_FIRMWARE_BINARY}.${CAPSULE_EXTENSION} -j \ + ${MACHINE}-capsule-update-image.json + + # Remove the firmware to avoid contamination of IMGDEPLOYDIR + rm ${UEFI_FIRMWARE_BINARY} + } # The firmware binary should be created before generating the capsule --2.17.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#4391):
https://lists.yoctoproject.org/g/meta-arm/message/4391
Mute This Topic: https://lists.yoctoproject.org/mt/96980035/5052612
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-arm/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=---
Best regards,José Quaresma
Signature · 3 lines
Best regards, José Quaresma
Jon Mason
AppliedQuoted 9 lines · On Wed, 15 Feb 2023 10:42:34 +0000, [email protected] wrote:
The UEFI capsule parameters can be passed to the script using a json file which is easily scalable when generating multiple capsules. Also the edk2 base tools recipe is made native only.
Gowtham Suresh Kumar (2):
arm/edk2-basetools: Convert edk2 basetools recipes to native only arm-bsp/uefi_capsule: Use json file to pass capsule config[...]
Applied, thanks!
[1/2] arm/edk2-basetools: Convert edk2 basetools recipes to native only
commit: ae0dd2a58cf612b30d7d18d86bfdb0930432f44f
[2/2] arm-bsp/uefi_capsule: Use json file to pass capsule config
commit: ac39c6d4cc9390e002c7be6cd7080214c144349aBest regards,
Signature · 1 line
Jon Mason <[email protected]>