From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAA9DC636CC for ; Wed, 15 Feb 2023 13:14:27 +0000 (UTC) Received: from mail-vs1-f42.google.com (mail-vs1-f42.google.com [209.85.217.42]) by mx.groups.io with SMTP id smtpd.web11.14541.1676466861334174000 for ; Wed, 15 Feb 2023 05:14:21 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ds/CFtQj; spf=pass (domain: gmail.com, ip: 209.85.217.42, mailfrom: quaresma.jose@gmail.com) Received: by mail-vs1-f42.google.com with SMTP id m1so19783499vst.7 for ; Wed, 15 Feb 2023 05:14:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=5X6bzY0UGMa78BdO4J0y1Ekd7ob+DNe9zWRrkmNibss=; b=ds/CFtQjb7yhaRvR/epiITho8mcfE/TY0lmLpPcaVuwRqgGj+7RQql0WBqyHcFOqU+ 7C1NBA8a+doFoNv+YChvkma9WvZlJ2igPBv1b9Q3dgVFK8virCoEGohhxVGu433dnYk9 jIz4RimJsdBHhcMajazv7Hgs1hmWHGRGmbvvrVJAE/8werFZbAqPD0VG7av8AEdOvsZw lCt929s+TfBwNJm5jJIcHRmz1OyO26tzYGD6FnG7qAwshYeVW+m7aWh4ZZEYyDLObJ4O OmWVYddms0oP61+I0a3ORIfLAVEIBUQF5KqUzvjsuv1toB++RVh0vC/2O+Dma/A3qGgU TfvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5X6bzY0UGMa78BdO4J0y1Ekd7ob+DNe9zWRrkmNibss=; b=aJlm3H1vzhlsft82okf+ekXdPwOsmDi78gPWBBcGKOy0TeflZQDyz70+QhcTGtY6Os 714OGBCrVnWVhu4JvQ9joJM5SAHegr2l9rEySsrM4KpwtJfs7jUWt8o9ZTxdtpP2rfTI u5t7wdCZCKLcaf4iYf4C7bkwTfnZ+Nx02285cXn0ioNkRhm/tEuJ/yHuLn36x3tuzHP9 YEXnP80Cwa0/jC5+cqqesYMxOo9OdjO/5OsKVdRQIab7fHeouT7mxjnFvECJDcoxiJQh 7+6aiZKUyUw5u1DR0pgdDOUrOT+Rxl4F3UzRgBdX4fCykb+6a21cX5Ayg0PBvejm7srV pKpQ== X-Gm-Message-State: AO0yUKVursAIzkzk2Gbx6bNZbzK+PnPStFMCI8W6rwiVT2ifdpbj+GWi eQymzrfIgCR+Iul2UVRXhS+3PndP6TBQZv3oPVA= X-Google-Smtp-Source: AK7set9EfNTzwHcF74N/orPCFx8VKw6fuMr6H6huoM+bnmUrwMQ1tcevCW4rfIr//xMqmG+6AauArCTxihDka2tJF8A= X-Received: by 2002:a05:6102:11f7:b0:3f0:be66:8037 with SMTP id e23-20020a05610211f700b003f0be668037mr397276vsg.80.1676466860271; Wed, 15 Feb 2023 05:14:20 -0800 (PST) MIME-Version: 1.0 References: <20230215104236.24484-1-gowtham.sureshkumar@arm.com> <20230215104236.24484-3-gowtham.sureshkumar@arm.com> In-Reply-To: From: Jose Quaresma Date: Wed, 15 Feb 2023 13:14:09 +0000 Message-ID: Subject: Re: [meta-arm] [PATCH 2/2] arm-bsp/uefi_capsule: Use json file to pass capsule config To: Gowtham Suresh Kumar Cc: "meta-arm@lists.yoctoproject.org" , Ross Burton , nd Content-Type: multipart/alternative; boundary="000000000000af2dbe05f4bcdbc1" List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 15 Feb 2023 13:14:27 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/meta-arm/message/4394 --000000000000af2dbe05f4bcdbc1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Gowtham Suresh Kumar escreveu no dia quarta, 15/02/2023 =C3=A0(s) 12:44: > Hello Jose, > > The CAPSULE_IMGTYPE is used in the uefi_capsule.bbclass as shown below. > > IMAGE_TYPEDEP:uefi_capsule:append =3D "${CAPSULE_IMGTYPE}" > Yup, sorry for the noise. Since it is needed, it can be reused in: -UEFI_FIRMWARE_BINARY =3D "${PN}-${MACHINE}.wic.nopt" +UEFI_FIRMWARE_BINARY =3D "${PN}-${MACHINE}.${CAPSULE_IMGTYPE}" Jose > Best regards, > Gowtham Suresh Kumar > ------------------------------ > *From:* Jose Quaresma > *Sent:* Wednesday, February 15, 2023 12:23 PM > *To:* Gowtham Suresh Kumar > *Cc:* meta-arm@lists.yoctoproject.org ; > Ross Burton ; nd > *Subject:* Re: [meta-arm] [PATCH 2/2] arm-bsp/uefi_capsule: Use json file > to pass capsule config > > Hi Gowtham, > > Gowtham Suresh Kumar escreveu no dia > quarta, 15/02/2023 =C3=A0(s) 10:42: > > From: Gowtham Suresh Kumar > > 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 > --- > .../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-i= mage.json > > diff --git a/meta-arm-bsp/recipes-bsp/images/corstone1000-image.bb > b/meta-arm-bsp/recipes-bsp/images/corstone1000-image.bb > index b0a71bca..ce4df8a6 100644 > --- a/meta-arm-bsp/recipes-bsp/images/corstone1000-image.bb > +++ b/meta-arm-bsp/recipes-bsp/images/corstone1000-image.bb > @@ -13,11 +13,9 @@ PACKAGE_INSTALL =3D "" > > IMAGE_FSTYPES +=3D "wic wic.nopt uefi_capsule" > > -UEFI_FIRMWARE_BINARY =3D "corstone1000-image-${MACHINE}.wic.nopt" > -UEFI_FIRMWARE_VERSION =3D "5" > -UEFI_FIRMWARE_LSV =3D "0" > -UEFI_FIRMWARE_GUID =3D "e2bb9c06-70e9-4b14-97a3-5a7913176e3f" > -UEFI_FIRMWARE_UPDATE_INDEX =3D "0" > +UEFI_FIRMWARE_BINARY =3D "${PN}-${MACHINE}.wic.nopt" > +UEFI_CAPSULE_CONFIG =3D "${THISDIR}/files/${PN}-capsule-update-image.jso= n" > +CAPSULE_IMGTYPE =3D "wic.nopt" > > > Looks like this variable is not used anywhere. > > Jose > > > > do_sign_images() { > # Sign TF-A BL2 > diff --git > a/meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-update= -image.json > b/meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-update= -image.json > new file mode 100644 > index 00000000..0f011ff7 > --- /dev/null > +++ > b/meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-update= -image.json > @@ -0,0 +1,11 @@ > +{ > + "Payloads": [ > + { > + "FwVersion": "5", > + "Guid": "e2bb9c06-70e9-4b14-97a3-5a7913176e3f", > + "LowestSupportedVersion": "1", > + "Payload": "$UEFI_FIRMWARE_BINARY", > + "UpdateImageIndex": "0" > + } > + ] > +} > diff --git a/meta-arm/classes/uefi_capsule.bbclass > b/meta-arm/classes/uefi_capsule.bbclass > index 0c3d3845..cf708412 100644 > --- a/meta-arm/classes/uefi_capsule.bbclass > +++ b/meta-arm/classes/uefi_capsule.bbclass > @@ -1,6 +1,7 @@ > # This class generates UEFI capsules > # The current class supports generating a capsule with single firmware > binary > > +DEPENDS +=3D "gettext-native" > inherit python3native > > IMAGE_TYPES +=3D "uefi_capsule" > @@ -19,14 +20,11 @@ CAPSULE_EXTENSION ?=3D "uefi.capsule" > > # The following variables must be set to be able to generate a capsule > update > UEFI_FIRMWARE_BINARY ?=3D "" > -UEFI_FIRMWARE_VERSION ?=3D "" > -UEFI_FIRMWARE_LSV ?=3D "" > -UEFI_FIRMWARE_GUID ?=3D "" > -UEFI_FIRMWARE_UPDATE_INDEX ?=3D "" > +UEFI_CAPSULE_CONFIG ?=3D "" > > # 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=3D${PYTHON} > > - > ${STAGING_DIR_NATIVE}/usr/bin/edk2-BaseTools/BinWrappers/PosixLike/Genera= teCapsule > -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=3D${UEFI_FIRMWARE_BINARY} > + envsubst < ${UEFI_CAPSULE_CONFIG} > > ./${MACHINE}-capsule-update-image.json > + > + > ${STAGING_DIR_NATIVE}/usr/bin/edk2-BaseTools/BinWrappers/PosixLike/Genera= teCapsule > \ > + -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 > > > -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- > 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: meta-arm+owner@lists.yoctoproject.org > Unsubscribe: https://lists.yoctoproject.org/g/meta-arm/unsub [ > quaresma.jose@gmail.com] > -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- > > > > -- > Best regards, > > Jos=C3=A9 Quaresma > --=20 Best regards, Jos=C3=A9 Quaresma --000000000000af2dbe05f4bcdbc1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
Gowtham Suresh Kumar <Gowtham.SureshKumar@arm.com> escr= eveu no dia quarta, 15/02/2023 =C3=A0(s) 12:44:
Hello Jose,

The=C2=A0=C2=A0CAPSULE_IMGTYPE is used in the=C2=A0uefi_capsule.bbclass as shown below.=C2=A0

IMAGE_TYPEDEP:uefi_capsule:append =3D "${CAPSULE_IMGTYPE}"

Yup, sorry for the noise.

Since it is needed= , it can be reused in:

-UEFI_FIRMWARE_B= INARY =3D "${PN}-${MACHINE}.wic.nopt"
+UEFI_FIRMWARE_BINARY = =3D "${PN}-${MACHINE}.${CAPSULE_IMGTYPE}"

Jose


Best regards,
Gowtham Suresh Kumar

From: = Jose Quaresma <quaresma.jose@gmail.com>
Sent: Wednesday, February 15, 2023 12:23 PM
To: Gowtham Suresh Kumar <Gowtham.SureshKumar@arm.com>
Cc: meta-arm@lists.yoctoproject.org <meta-arm@lists.yoctoproject.org&= gt;; Ross Burton <Ross.Burton@arm.com>; nd <nd@arm.com>
Subject: Re: [meta-arm] [PATCH 2/2] arm-bsp/uefi_capsule: Use json f= ile to pass capsule config
=C2=A0
Hi Gowtham,

Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com> escreve= u no dia quarta, 15/02/2023 =C3=A0(s) 10:42:
From: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>

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>
---
=C2=A0.../recipes-bsp/images/corstone1000-image.bb=C2=A0 |=C2=A0 8= +++---
=C2=A0...rstone1000-image-capsule-update-image.json | 11 ++++++++
=C2=A0meta-arm/classes/uefi_capsule.bbclass=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0| 27 ++++++++++++-------
=C2=A03 files changed, 32 insertions(+), 14 deletions(-)
=C2=A0create mode 100644 meta-arm-bsp/recipes-bsp/images/files/corstone1000= -image-capsule-update-image.json

diff --git a/meta-arm-bsp/recipes-bsp/images/corstone1000-image.bb b= /meta-arm-bsp/recipes-bsp/images/corstone1000-image.bb
index b0a71bca..ce4df8a6 100644
--- a/meta-arm-bsp/recipes-bsp/images/corstone1000-image.bb
+++ b/meta-arm-bsp/recipes-bsp/images/corstone1000-image.bb
@@ -13,11 +13,9 @@ PACKAGE_INSTALL =3D ""

=C2=A0IMAGE_FSTYPES +=3D "wic wic.nopt uefi_capsule"

-UEFI_FIRMWARE_BINARY =3D "corstone1000-image-${MACHINE}.wic.nopt"= ;
-UEFI_FIRMWARE_VERSION =3D "5"
-UEFI_FIRMWARE_LSV =3D "0"
-UEFI_FIRMWARE_GUID =3D "e2bb9c06-70e9-4b14-97a3-5a7913176e3f" -UEFI_FIRMWARE_UPDATE_INDEX =3D "0"
+UEFI_FIRMWARE_BINARY =3D "${PN}-${MACHINE}.wic.nopt"
+UEFI_CAPSULE_CONFIG =3D "${THISDIR}/files/${PN}-capsule-update-image.= json"
+CAPSULE_IMGTYPE =3D "wic.nopt"

Looks like this variable is not used anywhere.

Jose
=C2=A0

=C2=A0do_sign_images() {
=C2=A0 =C2=A0 =C2=A0# Sign TF-A BL2
diff --git a/meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsu= le-update-image.json b/meta-arm-bsp/recipes-bsp/images/files/corstone1000-i= mage-capsule-update-image.json
new file mode 100644
index 00000000..0f011ff7
--- /dev/null
+++ b/meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-upda= te-image.json
@@ -0,0 +1,11 @@
+{
+=C2=A0 =C2=A0 "Payloads": [
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "FwVersion": "5&q= uot;,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "Guid": "e2bb9c06= -70e9-4b14-97a3-5a7913176e3f",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "LowestSupportedVersion&quo= t;: "1",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "Payload": "$UEFI= _FIRMWARE_BINARY",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "UpdateImageIndex": &q= uot;0"
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 ]
+}
diff --git a/meta-arm/classes/uefi_capsule.bbclass b/meta-arm/classes/uefi_= capsule.bbclass
index 0c3d3845..cf708412 100644
--- a/meta-arm/classes/uefi_capsule.bbclass
+++ b/meta-arm/classes/uefi_capsule.bbclass
@@ -1,6 +1,7 @@
=C2=A0# This class generates UEFI capsules
=C2=A0# The current class supports generating a capsule with single firmwar= e binary

+DEPENDS +=3D "gettext-native"
=C2=A0inherit python3native

=C2=A0IMAGE_TYPES +=3D "uefi_capsule"
@@ -19,14 +20,11 @@ CAPSULE_EXTENSION ?=3D "uefi.capsule"

=C2=A0# The following variables must be set to be able to generate a capsul= e update
=C2=A0UEFI_FIRMWARE_BINARY ?=3D ""
-UEFI_FIRMWARE_VERSION ?=3D ""
-UEFI_FIRMWARE_LSV ?=3D ""
-UEFI_FIRMWARE_GUID ?=3D ""
-UEFI_FIRMWARE_UPDATE_INDEX ?=3D ""
+UEFI_CAPSULE_CONFIG ?=3D ""

=C2=A0# Check if the required variables are set
=C2=A0python() {
-=C2=A0 =C2=A0 for var in ["UEFI_FIRMWARE_BINARY", "UEFI_FIR= MWARE_VERSION", "UEFI_FIRMWARE_LSV", "UEFI_FIRMWARE_GUI= D", "UEFI_FIRMWARE_UPDATE_INDEX"]:
+=C2=A0 =C2=A0 for var in ["UEFI_FIRMWARE_BINARY", "UEFI_CAP= SULE_CONFIG"]:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if not d.getVar(var):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0raise bb.parse.SkipRecipe(f= "{var} not set")
=C2=A0}
@@ -36,10 +34,21 @@ IMAGE_CMD:uefi_capsule(){
=C2=A0 =C2=A0 =C2=A0# Force the GenerateCapsule script to use python3
=C2=A0 =C2=A0 =C2=A0export PYTHON_COMMAND=3D${PYTHON}

-=C2=A0 =C2=A0 ${STAGING_DIR_NATIVE}/usr/bin/edk2-BaseTools/BinWrappers/Pos= ixLike/GenerateCapsule -e -o \
-=C2=A0 =C2=A0 ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY}.${CAPSULE_EXT= ENSION} --fw-version ${UEFI_FIRMWARE_VERSION} \
-=C2=A0 =C2=A0 --lsv ${UEFI_FIRMWARE_LSV} --guid ${UEFI_FIRMWARE_GUID} --ve= rbose --update-image-index \
-=C2=A0 =C2=A0 ${UEFI_FIRMWARE_UPDATE_INDEX} --verbose ${CAPSULE_IMGLOCATIO= N}/${UEFI_FIRMWARE_BINARY}
+=C2=A0 =C2=A0 # Copy the firmware and the capsule config json to current d= irectory
+=C2=A0 =C2=A0 if [ -e ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINARY} ]; th= en
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 cp ${CAPSULE_IMGLOCATION}/${UEFI_FIRMWARE_BINA= RY} . ;
+=C2=A0 =C2=A0 fi
+
+=C2=A0 =C2=A0 export UEFI_FIRMWARE_BINARY=3D${UEFI_FIRMWARE_BINARY}
+=C2=A0 =C2=A0 envsubst < ${UEFI_CAPSULE_CONFIG} > ./${MACHINE}-capsu= le-update-image.json
+
+=C2=A0 =C2=A0 ${STAGING_DIR_NATIVE}/usr/bin/edk2-BaseTools/BinWrappers/Pos= ixLike/GenerateCapsule \
+=C2=A0 =C2=A0 -e -o ${UEFI_FIRMWARE_BINARY}.${CAPSULE_EXTENSION} -j \
+=C2=A0 =C2=A0 ${MACHINE}-capsule-update-image.json
+
+=C2=A0 =C2=A0 # Remove the firmware to avoid contamination of IMGDEPLOYDIR=
+=C2=A0 =C2=A0 rm ${UEFI_FIRMWARE_BINARY}
+
=C2=A0}

=C2=A0# The firmware binary should be created before generating the capsule=
--
2.17.1


-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
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: meta-arm+owner@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/meta-arm/unsub [quaresma.jose@gmail.com]
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-



--
Best regards,

Jos=C3=A9 Quaresma


--
Best regards,

J= os=C3=A9 Quaresma
--000000000000af2dbe05f4bcdbc1--