trusted-firmware-a: support multi-board platforms
PATCH 1/2 trusted-firmware-a: support multi-board platforms
From: Denys Dmytriyenko <[email protected]>
Some platforms can have multiple board configurations, passed as TARGET_BOARD="" that also becomes an extra directory level in the build output hierarchy.
--- .../recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc +10 -2
@@ -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
Signature · 1 line
2.7.4
PATCH 2/2 trusted-firmware-a: add support for SPD (Secure Payload Dispatcher) services
From: Denys Dmytriyenko <[email protected]>
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 +=
--- .../recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc +11 -3
@@ -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 :=
Signature · 1 line
2.7.4
Quoted 35 lines · Denys Dmytriyenko
From: Denys Dmytriyenko <[email protected]>
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 <[email protected]>--- .../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
meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc +6
-0@@ -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 += "${@['',
Quoted 4 lines
'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 ''}"
+
Quoted 21 lines
# Handle
TFA_DEBUGparameter
EXTRA_OEMAKE+= "${@bb.utils.contains('TFA_DEBUG', '1', '
DEBUG=${TFA_DEBUG}', '', d)}"meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc +2
-3@@ -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
Quoted 45 lines · Joshua Watt
Quoted 35 lines · Denys Dmytriyenko
From: Denys Dmytriyenko <[email protected]>
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 <[email protected]>--- .../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
meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc +6
-0@@ -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 += "${@['',Quoted 4 lines
'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:
Quoted 1 line
"${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.
Quoted 21 lines
Quoted 21 lines
# Handle
TFA_DEBUGparameter
EXTRA_OEMAKE+= "${@bb.utils.contains('TFA_DEBUG', '1', '
DEBUG=${TFA_DEBUG}', '', d)}"meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc +2
-3@@ -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
Quoted 56 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Denys Dmytriyenko via lists.yoctoproject.org
Sent: 14 May 2020 01:05
To: Joshua Watt <[email protected]>
Cc: [email protected]
Subject: Re: [meta-arm] [PATCH 1/2] trusted-firmware-a: support multi- board platformsQuoted 1 line · Joshua Watt
On Wed, May 13, 2020, 6:30 PM Denys Dmytriyenko <[email protected]>
Quoted 42 lines · wrote:
Quoted 34 lines
From: Denys Dmytriyenko <[email protected]>
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 <[email protected]>--- .../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
meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc +3
-0@@ -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"
meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc +2
-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 += "${@['',Quoted 4 lines
'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:
Quoted 1 line
"${TFA_PLATFORM}${@'/${TFA_BOARD}' if
d.getVar('TFA_BOARD')else ''}"
Quoted 8 lines
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.
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
# Handle
TFA_DEBUGparameter
EXTRA_OEMAKE+= "${@bb.utils.contains('TFA_DEBUG', '1', '
DEBUG=${TFA_DEBUG}', '', d)}"meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc +2
-3@@ -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
Quoted 10 lines · Denys Dmytriyenko
Quoted 4 lines
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