All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] trusted-firmware-a: support multi-board platforms
@ 2020-05-13 23:30 Denys Dmytriyenko
  2020-05-13 23:30 ` [PATCH 2/2] trusted-firmware-a: add support for SPD (Secure Payload Dispatcher) services Denys Dmytriyenko
  2020-05-13 23:44 ` [meta-arm] [PATCH 1/2] trusted-firmware-a: support multi-board platforms Joshua Watt
  0 siblings, 2 replies; 6+ messages in thread
From: Denys Dmytriyenko @ 2020-05-13 23:30 UTC (permalink / raw)
  To: meta-arm; +Cc: Denys Dmytriyenko

From: Denys Dmytriyenko <denys@ti.com>

Some platforms can have multiple board configurations, passed as TARGET_BOARD=""
that also becomes an extra directory level in the build output hierarchy.

Signed-off-by: Denys Dmytriyenko <denys@ti.com>
---
 .../recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc    | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc b/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
index 4b5da7a..b88b514 100644
--- a/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
+++ b/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
@@ -12,6 +12,10 @@ COMPATIBLE_MACHINE ?= "invalid"
 # Platform must be set for each machine
 TFA_PLATFORM ?= "invalid"
 
+# Some platforms can have multiple board configurations
+# Leave empty for default behavior
+TFA_BOARD ?= ""
+
 # Build for debug (set TFA_DEBUG to 1 to activate)
 TFA_DEBUG ?= "0"
 
@@ -65,6 +69,10 @@ DEPENDS_append = " dtc-native openssl-native"
 # Add platform parameter
 EXTRA_OEMAKE += "BUILD_BASE=${B} PLAT=${TFA_PLATFORM}"
 
+# Handle TFA_BOARD parameter
+EXTRA_OEMAKE += "${@['', 'TARGET_BOARD=${TFA_BOARD}'][bool(d.getVar('TFA_BOARD'))]}"
+BUILD_DIR = "${@['${TFA_PLATFORM}', '${TFA_PLATFORM}/${TFA_BOARD}'][bool(d.getVar('TFA_BOARD'))]}"
+
 # Handle TFA_DEBUG parameter
 EXTRA_OEMAKE += "${@bb.utils.contains('TFA_DEBUG', '1', ' DEBUG=${TFA_DEBUG}', '', d)}"
 
@@ -93,9 +101,9 @@ do_compile[cleandirs] = "${B}"
 
 do_install() {
     if ${@"true" if d.getVar('TFA_DEBUG') == '1' else "false"}; then
-        BUILD_PLAT=${B}/${TFA_PLATFORM}/debug/
+        BUILD_PLAT=${B}/${BUILD_DIR}/debug/
     else
-        BUILD_PLAT=${B}/${TFA_PLATFORM}/release/
+        BUILD_PLAT=${B}/${BUILD_DIR}/release/
     fi
 
     install -d -m 755 ${D}/firmware
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] trusted-firmware-a: add support for SPD (Secure Payload Dispatcher) services
  2020-05-13 23:30 [PATCH 1/2] trusted-firmware-a: support multi-board platforms Denys Dmytriyenko
@ 2020-05-13 23:30 ` Denys Dmytriyenko
  2020-05-13 23:44 ` [meta-arm] [PATCH 1/2] trusted-firmware-a: support multi-board platforms Joshua Watt
  1 sibling, 0 replies; 6+ messages in thread
From: Denys Dmytriyenko @ 2020-05-13 23:30 UTC (permalink / raw)
  To: meta-arm; +Cc: Denys Dmytriyenko

From: Denys Dmytriyenko <denys@ti.com>

Some platforms use Secure Payload Dispatcher - allow selecting one with TFA_SPD.

Official SPD description:
/*******************************************************************************
 * This is the Secure Payload Dispatcher (SPD). The dispatcher is meant to be a
 * plug-in component to the Secure Monitor, registered as a runtime service. The
 * SPD is expected to be a functional extension of the Secure Payload (SP) that
 * executes in Secure EL1. The Secure Monitor will delegate all SMCs targeting
 * the Trusted OS/Applications range to the dispatcher. The SPD will either
 * handle the request locally or delegate it to the Secure Payload. It is also
 * responsible for initialising and maintaining communication with the SP.
 ******************************************************************************/

Clean other EXTRA_OEMAKE to remove leading space not needed with +=

Signed-off-by: Denys Dmytriyenko <denys@ti.com>
---
 .../recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc  | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc b/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
index b88b514..0804689 100644
--- a/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
+++ b/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
@@ -16,6 +16,11 @@ TFA_PLATFORM ?= "invalid"
 # Leave empty for default behavior
 TFA_BOARD ?= ""
 
+# Some platforms use SPD (Secure Payload Dispatcher) services
+# Few options are "opteed", "tlkd", "trusty", "tspd"...
+# Leave empty to not use SPD
+TFA_SPD ?= ""
+
 # Build for debug (set TFA_DEBUG to 1 to activate)
 TFA_DEBUG ?= "0"
 
@@ -73,16 +78,19 @@ EXTRA_OEMAKE += "BUILD_BASE=${B} PLAT=${TFA_PLATFORM}"
 EXTRA_OEMAKE += "${@['', 'TARGET_BOARD=${TFA_BOARD}'][bool(d.getVar('TFA_BOARD'))]}"
 BUILD_DIR = "${@['${TFA_PLATFORM}', '${TFA_PLATFORM}/${TFA_BOARD}'][bool(d.getVar('TFA_BOARD'))]}"
 
+# Handle TFA_SPD parameter
+EXTRA_OEMAKE += "${@['', 'SPD=${TFA_SPD}'][bool(d.getVar('TFA_SPD'))]}"
+
 # Handle TFA_DEBUG parameter
-EXTRA_OEMAKE += "${@bb.utils.contains('TFA_DEBUG', '1', ' DEBUG=${TFA_DEBUG}', '', d)}"
+EXTRA_OEMAKE += "${@bb.utils.contains('TFA_DEBUG', '1', 'DEBUG=${TFA_DEBUG}', '', d)}"
 
 # Handle MBEDTLS
-EXTRA_OEMAKE += "${@bb.utils.contains('TFA_MBEDTLS', '1', ' MBEDTLS_DIR=${TFA_MBEDTLS_DIR}', '', d)}"
+EXTRA_OEMAKE += "${@bb.utils.contains('TFA_MBEDTLS', '1', 'MBEDTLS_DIR=${TFA_MBEDTLS_DIR}', '', d)}"
 
 # Uboot support
 DEPENDS += " ${@bb.utils.contains('TFA_UBOOT', '1', 'u-boot', '', d)}"
 do_compile[depends] += " ${@bb.utils.contains('TFA_UBOOT', '1', 'u-boot:do_deploy', '', d)}"
-EXTRA_OEMAKE += "${@bb.utils.contains('TFA_UBOOT', '1', ' BL33=${DEPLOY_DIR_IMAGE}/u-boot.bin', '',d)}"
+EXTRA_OEMAKE += "${@bb.utils.contains('TFA_UBOOT', '1', 'BL33=${DEPLOY_DIR_IMAGE}/u-boot.bin', '',d)}"
 
 # The following hack is needed to fit properly in yocto build environment
 # TFA is forcing the host compiler and its flags in the Makefile using :=
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [meta-arm] [PATCH 1/2] trusted-firmware-a: support multi-board platforms
  2020-05-13 23:30 [PATCH 1/2] trusted-firmware-a: support multi-board platforms Denys Dmytriyenko
  2020-05-13 23:30 ` [PATCH 2/2] trusted-firmware-a: add support for SPD (Secure Payload Dispatcher) services Denys Dmytriyenko
@ 2020-05-13 23:44 ` Joshua Watt
  2020-05-14  0:04   ` Denys Dmytriyenko
  1 sibling, 1 reply; 6+ messages in thread
From: Joshua Watt @ 2020-05-13 23:44 UTC (permalink / raw)
  To: Denys Dmytriyenko; +Cc: meta-arm, Denys Dmytriyenko

[-- Attachment #1: Type: text/plain, Size: 2303 bytes --]

On Wed, May 13, 2020, 6:30 PM Denys Dmytriyenko <denis@denix.org> wrote:

> From: Denys Dmytriyenko <denys@ti.com>
>
> Some platforms can have multiple board configurations, passed as
> TARGET_BOARD=""
> that also becomes an extra directory level in the build output hierarchy.
>
> Signed-off-by: Denys Dmytriyenko <denys@ti.com>
> ---
>  .../recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc    | 12
> ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git
> a/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
> b/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
> index 4b5da7a..b88b514 100644
> --- a/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
> +++ b/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
> @@ -12,6 +12,10 @@ COMPATIBLE_MACHINE ?= "invalid"
>  # Platform must be set for each machine
>  TFA_PLATFORM ?= "invalid"
>
> +# Some platforms can have multiple board configurations
> +# Leave empty for default behavior
> +TFA_BOARD ?= ""
> +
>  # Build for debug (set TFA_DEBUG to 1 to activate)
>  TFA_DEBUG ?= "0"
>
> @@ -65,6 +69,10 @@ DEPENDS_append = " dtc-native openssl-native"
>  # Add platform parameter
>  EXTRA_OEMAKE += "BUILD_BASE=${B} PLAT=${TFA_PLATFORM}"
>
> +# Handle TFA_BOARD parameter
> +EXTRA_OEMAKE += "${@['',
> 'TARGET_BOARD=${TFA_BOARD}'][bool(d.getVar('TFA_BOARD'))]}"
> +BUILD_DIR = "${@['${TFA_PLATFORM}',
> '${TFA_PLATFORM}/${TFA_BOARD}'][bool(d.getVar('TFA_BOARD'))]}"
>

I noticed you're doing the Boolean index trick. A little more pythonic and
IMHO easier to read would be:

 "${TFA_PLATFORM}${@'/${TFA_BOARD}' if d.getVar('TFA_BOARD') else ''}"

+
>  # Handle TFA_DEBUG parameter
>  EXTRA_OEMAKE += "${@bb.utils.contains('TFA_DEBUG', '1', '
> DEBUG=${TFA_DEBUG}', '', d)}"
>
> @@ -93,9 +101,9 @@ do_compile[cleandirs] = "${B}"
>
>  do_install() {
>      if ${@"true" if d.getVar('TFA_DEBUG') == '1' else "false"}; then
> -        BUILD_PLAT=${B}/${TFA_PLATFORM}/debug/
> +        BUILD_PLAT=${B}/${BUILD_DIR}/debug/
>      else
> -        BUILD_PLAT=${B}/${TFA_PLATFORM}/release/
> +        BUILD_PLAT=${B}/${BUILD_DIR}/release/
>      fi
>
>      install -d -m 755 ${D}/firmware
> --
> 2.7.4
>
> 
>

[-- Attachment #2: Type: text/html, Size: 3396 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [meta-arm] [PATCH 1/2] trusted-firmware-a: support multi-board platforms
  2020-05-13 23:44 ` [meta-arm] [PATCH 1/2] trusted-firmware-a: support multi-board platforms Joshua Watt
@ 2020-05-14  0:04   ` Denys Dmytriyenko
  2020-05-14  6:22     ` Diego Sueiro
  2020-05-14  9:36     ` Ross Burton
  0 siblings, 2 replies; 6+ messages in thread
From: Denys Dmytriyenko @ 2020-05-14  0:04 UTC (permalink / raw)
  To: Joshua Watt; +Cc: meta-arm

On Wed, May 13, 2020 at 06:44:32PM -0500, Joshua Watt wrote:
> On Wed, May 13, 2020, 6:30 PM Denys Dmytriyenko <denis@denix.org> wrote:
> 
> > From: Denys Dmytriyenko <denys@ti.com>
> >
> > Some platforms can have multiple board configurations, passed as
> > TARGET_BOARD=""
> > that also becomes an extra directory level in the build output hierarchy.
> >
> > Signed-off-by: Denys Dmytriyenko <denys@ti.com>
> > ---
> >  .../recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc    | 12
> > ++++++++++--
> >  1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git
> > a/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
> > b/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
> > index 4b5da7a..b88b514 100644
> > --- a/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
> > +++ b/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
> > @@ -12,6 +12,10 @@ COMPATIBLE_MACHINE ?= "invalid"
> >  # Platform must be set for each machine
> >  TFA_PLATFORM ?= "invalid"
> >
> > +# Some platforms can have multiple board configurations
> > +# Leave empty for default behavior
> > +TFA_BOARD ?= ""
> > +
> >  # Build for debug (set TFA_DEBUG to 1 to activate)
> >  TFA_DEBUG ?= "0"
> >
> > @@ -65,6 +69,10 @@ DEPENDS_append = " dtc-native openssl-native"
> >  # Add platform parameter
> >  EXTRA_OEMAKE += "BUILD_BASE=${B} PLAT=${TFA_PLATFORM}"
> >
> > +# Handle TFA_BOARD parameter
> > +EXTRA_OEMAKE += "${@['',
> > 'TARGET_BOARD=${TFA_BOARD}'][bool(d.getVar('TFA_BOARD'))]}"
> > +BUILD_DIR = "${@['${TFA_PLATFORM}',
> > '${TFA_PLATFORM}/${TFA_BOARD}'][bool(d.getVar('TFA_BOARD'))]}"
> >
> 
> I noticed you're doing the Boolean index trick. A little more pythonic and
> IMHO easier to read would be:
> 
>  "${TFA_PLATFORM}${@'/${TFA_BOARD}' if d.getVar('TFA_BOARD') else ''}"

Hmm, I saw OE-Core using the Boolean index trick in bitbake.conf and other 
places quite a lot - I was just following the tradition.

For me personally pure pythonic is too much of a brain twist - booleans, 
simple arrays and such are more natural for me to understand... :)

But if required, I can change - just let me know.


> >  # Handle TFA_DEBUG parameter
> >  EXTRA_OEMAKE += "${@bb.utils.contains('TFA_DEBUG', '1', '
> > DEBUG=${TFA_DEBUG}', '', d)}"
> >
> > @@ -93,9 +101,9 @@ do_compile[cleandirs] = "${B}"
> >
> >  do_install() {
> >      if ${@"true" if d.getVar('TFA_DEBUG') == '1' else "false"}; then
> > -        BUILD_PLAT=${B}/${TFA_PLATFORM}/debug/
> > +        BUILD_PLAT=${B}/${BUILD_DIR}/debug/
> >      else
> > -        BUILD_PLAT=${B}/${TFA_PLATFORM}/release/
> > +        BUILD_PLAT=${B}/${BUILD_DIR}/release/
> >      fi
> >
> >      install -d -m 755 ${D}/firmware
> > --
> > 2.7.4
> >
> > 
> >

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [meta-arm] [PATCH 1/2] trusted-firmware-a: support multi-board platforms
  2020-05-14  0:04   ` Denys Dmytriyenko
@ 2020-05-14  6:22     ` Diego Sueiro
  2020-05-14  9:36     ` Ross Burton
  1 sibling, 0 replies; 6+ messages in thread
From: Diego Sueiro @ 2020-05-14  6:22 UTC (permalink / raw)
  To: denis, Joshua Watt; +Cc: meta-arm, nd

> -----Original Message-----
> From: meta-arm@lists.yoctoproject.org <meta-arm@lists.yoctoproject.org>
> On Behalf Of Denys Dmytriyenko via lists.yoctoproject.org
> Sent: 14 May 2020 01:05
> To: Joshua Watt <jpewhacker@gmail.com>
> Cc: meta-arm@lists.yoctoproject.org
> Subject: Re: [meta-arm] [PATCH 1/2] trusted-firmware-a: support multi-
> board platforms
> 
> On Wed, May 13, 2020 at 06:44:32PM -0500, Joshua Watt wrote:
> > On Wed, May 13, 2020, 6:30 PM Denys Dmytriyenko <denis@denix.org>
> wrote:
> >
> > > From: Denys Dmytriyenko <denys@ti.com>
> > >
> > > Some platforms can have multiple board configurations, passed as
> > > TARGET_BOARD=""
> > > that also becomes an extra directory level in the build output hierarchy.
> > >
> > > Signed-off-by: Denys Dmytriyenko <denys@ti.com>
> > > ---
> > >  .../recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc    | 12
> > > ++++++++++--
> > >  1 file changed, 10 insertions(+), 2 deletions(-)
> > >
> > > diff --git
> > > a/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
> > > b/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
> > > index 4b5da7a..b88b514 100644
> > > --- a/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
> > > +++ b/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
> > > @@ -12,6 +12,10 @@ COMPATIBLE_MACHINE ?= "invalid"
> > >  # Platform must be set for each machine  TFA_PLATFORM ?= "invalid"
> > >
> > > +# Some platforms can have multiple board configurations # Leave
> > > +empty for default behavior TFA_BOARD ?= ""
> > > +
> > >  # Build for debug (set TFA_DEBUG to 1 to activate)  TFA_DEBUG ?=
> > > "0"
> > >
> > > @@ -65,6 +69,10 @@ DEPENDS_append = " dtc-native openssl-native"
> > >  # Add platform parameter
> > >  EXTRA_OEMAKE += "BUILD_BASE=${B} PLAT=${TFA_PLATFORM}"
> > >
> > > +# Handle TFA_BOARD parameter
> > > +EXTRA_OEMAKE += "${@['',
> > > 'TARGET_BOARD=${TFA_BOARD}'][bool(d.getVar('TFA_BOARD'))]}"
> > > +BUILD_DIR = "${@['${TFA_PLATFORM}',
> > > '${TFA_PLATFORM}/${TFA_BOARD}'][bool(d.getVar('TFA_BOARD'))]}"
> > >
> >
> > I noticed you're doing the Boolean index trick. A little more pythonic
> > and IMHO easier to read would be:
> >
> >  "${TFA_PLATFORM}${@'/${TFA_BOARD}' if d.getVar('TFA_BOARD') else ''}"
> 
> Hmm, I saw OE-Core using the Boolean index trick in bitbake.conf and other
> places quite a lot - I was just following the tradition.
> 
> For me personally pure pythonic is too much of a brain twist - booleans,
> simple arrays and such are more natural for me to understand... :)
> 
> But if required, I can change - just let me know.
> 

I vote for keeping the consistency with the rest of the recipe.

> 
> > >  # Handle TFA_DEBUG parameter
> > >  EXTRA_OEMAKE += "${@bb.utils.contains('TFA_DEBUG', '1', '
> > > DEBUG=${TFA_DEBUG}', '', d)}"
> > >
> > > @@ -93,9 +101,9 @@ do_compile[cleandirs] = "${B}"
> > >
> > >  do_install() {
> > >      if ${@"true" if d.getVar('TFA_DEBUG') == '1' else "false"}; then
> > > -        BUILD_PLAT=${B}/${TFA_PLATFORM}/debug/
> > > +        BUILD_PLAT=${B}/${BUILD_DIR}/debug/
> > >      else
> > > -        BUILD_PLAT=${B}/${TFA_PLATFORM}/release/
> > > +        BUILD_PLAT=${B}/${BUILD_DIR}/release/
> > >      fi
> > >
> > >      install -d -m 755 ${D}/firmware
> > > --
> > > 2.7.4
> > >
> > >
> > >

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [meta-arm] [PATCH 1/2] trusted-firmware-a: support multi-board platforms
  2020-05-14  0:04   ` Denys Dmytriyenko
  2020-05-14  6:22     ` Diego Sueiro
@ 2020-05-14  9:36     ` Ross Burton
  1 sibling, 0 replies; 6+ messages in thread
From: Ross Burton @ 2020-05-14  9:36 UTC (permalink / raw)
  To: Denys Dmytriyenko; +Cc: Joshua Watt, meta-arm

On Thu, 14 May 2020 at 01:04, Denys Dmytriyenko <denis@denix.org> wrote:
> > I noticed you're doing the Boolean index trick. A little more pythonic and
> > IMHO easier to read would be:
> >
> >  "${TFA_PLATFORM}${@'/${TFA_BOARD}' if d.getVar('TFA_BOARD') else ''}"
>
> Hmm, I saw OE-Core using the Boolean index trick in bitbake.conf and other
> places quite a lot - I was just following the tradition.
>
> For me personally pure pythonic is too much of a brain twist - booleans,
> simple arrays and such are more natural for me to understand... :)

FWIW, I'm ripping out every boolean index trick in oe-core as I come
across them in other work as they're really not Pythonic at all.  X if
foo else Y is idiomatic.

Ross

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-14  9:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-13 23:30 [PATCH 1/2] trusted-firmware-a: support multi-board platforms Denys Dmytriyenko
2020-05-13 23:30 ` [PATCH 2/2] trusted-firmware-a: add support for SPD (Secure Payload Dispatcher) services Denys Dmytriyenko
2020-05-13 23:44 ` [meta-arm] [PATCH 1/2] trusted-firmware-a: support multi-board platforms Joshua Watt
2020-05-14  0:04   ` Denys Dmytriyenko
2020-05-14  6:22     ` Diego Sueiro
2020-05-14  9:36     ` Ross Burton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.