mirror of
https://git.yoctoproject.org/meta-arm
synced 2026-07-16 03:47:19 +00:00
arm-bsp/uefi_capsule: Use json file to pass capsule config
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 <gowtham.sureshkumar@arm.com> Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
committed by
Jon Mason
parent
50c462da2d
commit
71f92f4df8
@@ -13,11 +13,9 @@ PACKAGE_INSTALL = ""
|
|||||||
|
|
||||||
IMAGE_FSTYPES += "wic wic.nopt uefi_capsule"
|
IMAGE_FSTYPES += "wic wic.nopt uefi_capsule"
|
||||||
|
|
||||||
UEFI_FIRMWARE_BINARY = "corstone1000-image-${MACHINE}.wic.nopt"
|
UEFI_FIRMWARE_BINARY = "${PN}-${MACHINE}.${CAPSULE_IMGTYPE}"
|
||||||
UEFI_FIRMWARE_VERSION = "5"
|
UEFI_CAPSULE_CONFIG = "${THISDIR}/files/${PN}-capsule-update-image.json"
|
||||||
UEFI_FIRMWARE_LSV = "0"
|
CAPSULE_IMGTYPE = "wic.nopt"
|
||||||
UEFI_FIRMWARE_GUID = "e2bb9c06-70e9-4b14-97a3-5a7913176e3f"
|
|
||||||
UEFI_FIRMWARE_UPDATE_INDEX = "0"
|
|
||||||
|
|
||||||
do_sign_images() {
|
do_sign_images() {
|
||||||
# Sign TF-A BL2
|
# Sign TF-A BL2
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"Payloads": [
|
||||||
|
{
|
||||||
|
"FwVersion": "5",
|
||||||
|
"Guid": "e2bb9c06-70e9-4b14-97a3-5a7913176e3f",
|
||||||
|
"LowestSupportedVersion": "1",
|
||||||
|
"Payload": "$UEFI_FIRMWARE_BINARY",
|
||||||
|
"UpdateImageIndex": "0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
# This class generates UEFI capsules
|
# This class generates UEFI capsules
|
||||||
# The current class supports generating a capsule with single firmware binary
|
# The current class supports generating a capsule with single firmware binary
|
||||||
|
|
||||||
|
DEPENDS += "gettext-native"
|
||||||
inherit python3native
|
inherit python3native
|
||||||
|
|
||||||
IMAGE_TYPES += "uefi_capsule"
|
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
|
# The following variables must be set to be able to generate a capsule update
|
||||||
UEFI_FIRMWARE_BINARY ?= ""
|
UEFI_FIRMWARE_BINARY ?= ""
|
||||||
UEFI_FIRMWARE_VERSION ?= ""
|
UEFI_CAPSULE_CONFIG ?= ""
|
||||||
UEFI_FIRMWARE_LSV ?= ""
|
|
||||||
UEFI_FIRMWARE_GUID ?= ""
|
|
||||||
UEFI_FIRMWARE_UPDATE_INDEX ?= ""
|
|
||||||
|
|
||||||
# Check if the required variables are set
|
# Check if the required variables are set
|
||||||
python() {
|
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):
|
if not d.getVar(var):
|
||||||
raise bb.parse.SkipRecipe(f"{var} not set")
|
raise bb.parse.SkipRecipe(f"{var} not set")
|
||||||
}
|
}
|
||||||
@@ -36,10 +34,21 @@ IMAGE_CMD:uefi_capsule(){
|
|||||||
# Force the GenerateCapsule script to use python3
|
# Force the GenerateCapsule script to use python3
|
||||||
export PYTHON_COMMAND=${PYTHON}
|
export PYTHON_COMMAND=${PYTHON}
|
||||||
|
|
||||||
${STAGING_DIR_NATIVE}/usr/bin/edk2-BaseTools/BinWrappers/PosixLike/GenerateCapsule -e -o \
|
# Copy the firmware and the capsule config json to current directory
|
||||||
${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY}.${CAPSULE_EXTENSION} --fw-version ${UEFI_FIRMWARE_VERSION} \
|
if [ -e ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY} ]; then
|
||||||
--lsv ${UEFI_FIRMWARE_LSV} --guid ${UEFI_FIRMWARE_GUID} --verbose --update-image-index \
|
cp ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY} . ;
|
||||||
${UEFI_FIRMWARE_UPDATE_INDEX} --verbose ${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
|
# The firmware binary should be created before generating the capsule
|
||||||
|
|||||||
Reference in New Issue
Block a user