Skip to contentSkip to conversation

conf/machine: pass OPTEEFLAVOR via OPTEEMACHINE as <mach>-<flavor>

PATCH In review Denys Dmytriyenko 2 participants 4 messages Oct 9, 2020 – Oct 11, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 conf/machine: pass OPTEEFLAVOR via OPTEEMACHINE as <mach>-<flavor>

From: Denys Dmytriyenko <[email protected]>

Recipe in meta-arm doesn't use OPTEEFLAVOR, but optee-os Makefile can extract it from OPTEEMACHINE.
Keep OPTEEFLAVOR for legacy platforms - used for HS signing in the output name.

---
 conf/machine/am437x-hs-evm.conf | 2 +-
 conf/machine/am57xx-hs-evm.conf | 2 +-
 conf/machine/dra7xx-hs-evm.conf | 2 +-
 conf/machine/include/am65xx.inc | 3 +--
 conf/machine/include/j7.inc     | 3 +--
 5 files changed, 5 insertions(+), 7 deletions(-)
conf/machine/am437x-hs-evm.conf +1 -1
index 34c1016..0a8ca06 100644
@@ -13,6 +13,6 @@ UBOOT_RD_ENTRYPOINT = "0x84000000"
 
 TI_SECURE_DEV_PKG = "${TI_SECURE_DEV_PKG_CAT}/am4x"
 
-OPTEEMACHINE = "ti"
+OPTEEMACHINE = "ti-am43xx"
 OPTEEFLAVOR = "am43xx"
 OPTEEOUTPUTMACHINE = "ti"
conf/machine/am57xx-hs-evm.conf +1 -1
index 4d3eb00..d4f6e09 100644
@@ -13,7 +13,7 @@ UBOOT_RD_ENTRYPOINT = "0x84000000"
 
 TI_SECURE_DEV_PKG = "${TI_SECURE_DEV_PKG_AUTO}/am5x"
 
-OPTEEMACHINE = "ti"
+OPTEEMACHINE = "ti-am57xx"
 OPTEEFLAVOR = "am57xx"
 OPTEEOUTPUTMACHINE = "ti"
 OPTEEPAGER = "y"
conf/machine/dra7xx-hs-evm.conf +1 -1
index 9b02985..da4000f 100644
@@ -13,7 +13,7 @@ UBOOT_RD_ENTRYPOINT = "0x84000000"
 
 TI_SECURE_DEV_PKG = "${TI_SECURE_DEV_PKG_AUTO}/dra7"
 
-OPTEEMACHINE = "ti"
+OPTEEMACHINE = "ti-dra7xx"
 OPTEEFLAVOR = "dra7xx"
 OPTEEOUTPUTMACHINE = "ti"
 OPTEEPAGER = "y"
conf/machine/include/am65xx.inc +1 -2
index 1acb205..67cfabe 100644
@@ -21,8 +21,7 @@ KERNEL_DEVICETREE = " \
     ti/k3-am654-evm-prupwm.dtbo \
 "
 
-OPTEEMACHINE = "k3"
-OPTEEFLAVOR = "am65x"
+OPTEEMACHINE = "k3-am65x"
 OPTEEOUTPUTMACHINE = "k3"
 
 # Set the list of device targets for ti-pdk class recipes
conf/machine/include/j7.inc +1 -2
index f6d9161..7d326f4 100644
@@ -1,8 +1,7 @@
 require conf/machine/include/k3.inc
 SOC_FAMILY_append = ":j7"
 
-OPTEEMACHINE = "k3"
-OPTEEFLAVOR = "j7"
+OPTEEMACHINE = "k3-j7"
 OPTEEOUTPUTMACHINE = "k3"
 
 # Set the list of device targets for ti-pdk class recipes
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/3 optee-os: add TI signing calls via TI_SECURE_DEV_PKG

From: Denys Dmytriyenko <[email protected]>

It was originally residing in meta-arago due to earlier dependency on meta-optee layer from meta-linaro. Now optee is in meta-arm and this code can move to meta-ti.

---
 recipes-security/optee/optee-os_%.bbappend | 83 ++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100644 recipes-security/optee/optee-os_%.bbappend
recipes-security/optee/optee-os_%.bbappend new file +83 -0
new file mode 100644
index 0000000..2846d0a
@@ -0,0 +1,83 @@
+do_compile_prepend_ti-soc() {
+    export TI_SECURE_DEV_PKG=${TI_SECURE_DEV_PKG}
+}
+
+do_compile_append_k3() {
+    ( cd out/arm-plat-${OPTEEOUTPUTMACHINE}/core/; \
+        cp tee-pager_v2.bin ${B}/bl32.bin; \
+        cp tee.elf ${B}/bl32.elf; \
+    )
+}
+
+# Signing procedure for legacy HS devices
+optee_sign_legacyhs() {
+    ( cd out/arm-plat-${OPTEEOUTPUTMACHINE}/core/; \
+        ${TI_SECURE_DEV_PKG}/scripts/secure-binary-image.sh tee.bin tee.bin.signed; \
+        normfl=`echo ${OPTEEFLAVOR} | tr "_" "-"`
+        mv tee.bin.signed ${B}/$normfl.optee; \
+    )
+
+    if [ "${OPTEEPAGER}" = "y" ]; then
+        rm -rf out/
+        oe_runmake all CFG_TEE_TA_LOG_LEVEL=0 CFG_WITH_PAGER=y
+        ( cd out/arm-plat-${OPTEEOUTPUTMACHINE}/core/; \
+            ${TI_SECURE_DEV_PKG}/scripts/secure-binary-image.sh tee.bin tee.bin.signed; \
+            normfl=`echo ${OPTEEFLAVOR} | tr "_" "-"`
+            mv tee.bin.signed ${B}/$normfl-pager.optee; \
+        )
+    fi
+}
+
+# Signing procedure for K3 HS devices
+optee_sign_k3hs() {
+    ( cd out/arm-plat-${OPTEEOUTPUTMACHINE}/core/; \
+        ${TI_SECURE_DEV_PKG}/scripts/secure-binary-image.sh tee-pager_v2.bin tee-pager.bin.signed; \
+        mv tee-pager.bin.signed ${B}/bl32.bin; \
+        cp tee.elf ${B}/bl32.elf; \
+    )
+}
+
+do_compile_append_ti43x() {
+    optee_sign_legacyhs
+}
+
+do_compile_append_dra7xx() {
+    optee_sign_legacyhs
+}
+
+do_compile_append_am65xx-hs-evm() {
+    optee_sign_k3hs
+}
+
+do_compile_append_j7-hs-evm() {
+    optee_sign_k3hs
+}
+
+do_install_append_ti-soc() {
+    install -m 644 ${B}/*.optee ${D}${nonarch_base_libdir}/firmware/ || true
+    install -m 644 ${B}/bl32.bin ${D}${nonarch_base_libdir}/firmware/ || true
+    install -m 644 ${B}/bl32.elf ${D}${nonarch_base_libdir}/firmware/ || true
+}
+
+optee_deploy_legacyhs() {
+    cd ${DEPLOYDIR}/
+    for f in optee/*.optee; do
+        ln -sf $f ${DEPLOYDIR}/
+    done
+}
+
+do_deploy_append_ti43x() {
+    optee_deploy_legacyhs
+}
+
+do_deploy_append_dra7xx() {
+    optee_deploy_legacyhs
+}
+
+do_deploy_append_k3() {
+    ln -sf optee/bl32.bin ${DEPLOYDIR}/
+    ln -sf optee/bl32.elf ${DEPLOYDIR}/
+}
+
+# This is needed for bl32.elf
+INSANE_SKIP_${PN}_append_k3 = " textrel"
Signature · 1 line
2.7.4
#2 lore raw

PATCH 3/3 u-boot-ti: adjust location of optee binary to align with meta-arm

In reply to Denys Dmytriyenko

From: Denys Dmytriyenko <[email protected]>

---
 recipes-bsp/u-boot/u-boot-ti.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-bsp/u-boot/u-boot-ti.inc +1 -1
index f07dcfd..2063bac 100644
@@ -34,7 +34,7 @@ PV_append = "+git${SRCPV}"
 DEPENDS += "dtc-native bc-native lzop-native flex-native bison-native"
 
 PACKAGECONFIG[atf] = "ATF=${STAGING_DIR_HOST}/firmware/bl31.bin,,trusted-firmware-a"
-PACKAGECONFIG[optee] = "TEE=${STAGING_DIR_HOST}/boot/bl32.bin,,optee-os"
+PACKAGECONFIG[optee] = "TEE=${STAGING_DIR_HOST}${nonarch_base_libdir}/firmware/bl32.bin,,optee-os"
 
 PACKAGECONFIG_append_aarch64 = " atf optee"
 
Signature · 1 line
2.7.4
#3 lore raw
In reply to Denys Dmytriyenko

Denys

Quoted 73 lines · Denys Dmytriyenko

From: Denys Dmytriyenko <[email protected]>

Recipe in meta-arm doesn't use OPTEEFLAVOR, but optee-os Makefile can extract it from OPTEEMACHINE.
Keep OPTEEFLAVOR for legacy platforms - used for HS signing in the output name.

---
  conf/machine/am437x-hs-evm.conf | 2 +-
  conf/machine/am57xx-hs-evm.conf | 2 +-
  conf/machine/dra7xx-hs-evm.conf | 2 +-
  conf/machine/include/am65xx.inc | 3 +--
  conf/machine/include/j7.inc     | 3 +--
  5 files changed, 5 insertions(+), 7 deletions(-)
conf/machine/am437x-hs-evm.conf +1 -1
index 34c1016..0a8ca06 100644
@@ -13,6 +13,6 @@ UBOOT_RD_ENTRYPOINT = "0x84000000"
 
  TI_SECURE_DEV_PKG = "${TI_SECURE_DEV_PKG_CAT}/am4x"
 
-OPTEEMACHINE = "ti"
+OPTEEMACHINE = "ti-am43xx"
  OPTEEFLAVOR = "am43xx"
  OPTEEOUTPUTMACHINE = "ti"
conf/machine/am57xx-hs-evm.conf +1 -1
index 4d3eb00..d4f6e09 100644
@@ -13,7 +13,7 @@ UBOOT_RD_ENTRYPOINT = "0x84000000"
 
  TI_SECURE_DEV_PKG = "${TI_SECURE_DEV_PKG_AUTO}/am5x"
 
-OPTEEMACHINE = "ti"
+OPTEEMACHINE = "ti-am57xx"
  OPTEEFLAVOR = "am57xx"
  OPTEEOUTPUTMACHINE = "ti"
  OPTEEPAGER = "y"
conf/machine/dra7xx-hs-evm.conf +1 -1
index 9b02985..da4000f 100644
@@ -13,7 +13,7 @@ UBOOT_RD_ENTRYPOINT = "0x84000000"
 
  TI_SECURE_DEV_PKG = "${TI_SECURE_DEV_PKG_AUTO}/dra7"
 
-OPTEEMACHINE = "ti"
+OPTEEMACHINE = "ti-dra7xx"
  OPTEEFLAVOR = "dra7xx"
  OPTEEOUTPUTMACHINE = "ti"
  OPTEEPAGER = "y"
conf/machine/include/am65xx.inc +1 -2
index 1acb205..67cfabe 100644
@@ -21,8 +21,7 @@ KERNEL_DEVICETREE = " \
      ti/k3-am654-evm-prupwm.dtbo \
  "
 
-OPTEEMACHINE = "k3"
-OPTEEFLAVOR = "am65x"
+OPTEEMACHINE = "k3-am65x"
  OPTEEOUTPUTMACHINE = "k3"
 
  # Set the list of device targets for ti-pdk class recipes
conf/machine/include/j7.inc +0 -0
index f6d9161..7d326f4 100644

conf/machine/include/j7.inc line 7

Quoted 9 lines
conf/machine/include/j7.inc +1 -2
@@ -1,8 +1,7 @@
  require conf/machine/include/k3.inc
  SOC_FAMILY_append = ":j7"
 
-OPTEEMACHINE = "k3"
-OPTEEFLAVOR = "j7"
+OPTEEMACHINE = "k3-j7"
  OPTEEOUTPUTMACHINE = "k3"
 
  # Set the list of device targets for ti-pdk class recipes

All 3 applied

Thanks