Skip to contentSkip to conversation

improving OP-TEE support for u-boot-based platforms

PATCH Superseded Yann Dirson 3 participants 13 messages Apr 13, 2021 – Apr 15, 2021

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover improving OP-TEE support for u-boot-based platforms

From: Yann Dirson <[email protected]>

While working on integrating OP-TEE on rk3399 with a readonly rootfs, I figured that a couple of things would be good to have in the optee recipes.

Also, having started to work on old meta-linaro/meta-optee initially:
- I had to duplicate some of the work done here and had submitted a similar patch upstream
- pycrypto simplification became obvious

Yann Dirson (4):
arm/optee: use pycryptodome rather pycryptodomex arm/optee-os: mark LDFLAGS patch as submitted arm/optee-os: deploy tee.elf for u-boot arm/optee-client: create the /data/tee/ directory needed by
tee-supplicant

 meta-arm/recipes-security/optee/optee-client.inc            | 6 ++++++
 meta-arm/recipes-security/optee/optee-examples.inc          | 2 +-
 .../optee-examples/0001-make-Pass-ldflags-during-link.patch | 2 +-
 meta-arm/recipes-security/optee/optee-os.inc                | 4 ++--
 meta-arm/recipes-security/optee/optee-test.inc              | 2 +-
 5 files changed, 11 insertions(+), 5 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/4 arm/optee: use pycryptodome rather pycryptodomex

From: Yann Dirson <[email protected]>

Recent versions of OP-TEE perfectly build with pycryptodome, no need for the pycryptodomex transition package any more.

---
 meta-arm/recipes-security/optee/optee-examples.inc | 2 +-
 meta-arm/recipes-security/optee/optee-os.inc       | 2 +-
 meta-arm/recipes-security/optee/optee-test.inc     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
meta-arm/recipes-security/optee/optee-examples.inc +1 -1
index 851043b..81c31bc 100644
@@ -5,7 +5,7 @@ HOMEPAGE = "https://github.com/linaro-swg/optee_examples"
 LICENSE = "BSD-2-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=cd95ab417e23b94f381dafc453d70c30"
 
-DEPENDS = "optee-client optee-os python3-pycryptodomex-native"
+DEPENDS = "optee-client optee-os python3-pycryptodome-native"
 
 inherit python3native
 
meta-arm/recipes-security/optee/optee-os.inc +1 -1
index f8697cf..34f586a 100644
@@ -10,7 +10,7 @@ require optee.inc
 
 CVE_PRODUCT = "linaro:op-tee op-tee:op-tee_os"
 
-DEPENDS = "python3-pycryptodome-native python3-pycryptodomex-native python3-pyelftools-native"
+DEPENDS = "python3-pycryptodome-native python3-pyelftools-native"
 
 DEPENDS_append_toolchain-clang = " compiler-rt"
 
meta-arm/recipes-security/optee/optee-test.inc +1 -1
index 877bdeb..f09b9d2 100644
@@ -13,7 +13,7 @@ require optee.inc
 # When upgraded we should be able to remove this limitation
 COMPATIBLE_HOST_libc-musl = 'null'
 
-DEPENDS = "optee-client optee-os python3-pycryptodomex-native"
+DEPENDS = "optee-client optee-os python3-pycryptodome-native"
 
 SRC_URI = "git://github.com/OP-TEE/optee_test.git \
            file://0001-host-xtest-Adjust-order-of-including-compiler.h.patch \
Signature · 1 line
2.30.2
Reviewed-by on v1 1/4
#2 lore raw

Re: [meta-arm] [PATCH 1/4] arm/optee: use pycryptodome rather pycryptodomex

Quoted 6 lines · Yann Dirson

From: Yann Dirson <[email protected]>

Recent versions of OP-TEE perfectly build with pycryptodome, no need for the pycryptodomex transition package any more.

Quoted 52 lines
---
 meta-arm/recipes-security/optee/optee-examples.inc | 2 +-
 meta-arm/recipes-security/optee/optee-os.inc       | 2 +-
 meta-arm/recipes-security/optee/optee-test.inc     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
meta-arm/recipes-security/optee/optee-examples.inc +1 -1
index 851043b..81c31bc 100644
@@ -5,7 +5,7 @@ HOMEPAGE = "https://github.com/linaro-swg/optee_examples"
 LICENSE = "BSD-2-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=cd95ab417e23b94f381dafc453d70c30"
 
-DEPENDS = "optee-client optee-os python3-pycryptodomex-native"
+DEPENDS = "optee-client optee-os python3-pycryptodome-native"
 
 inherit python3native
 
meta-arm/recipes-security/optee/optee-os.inc +1 -1
index f8697cf..34f586a 100644
@@ -10,7 +10,7 @@ require optee.inc
 
 CVE_PRODUCT = "linaro:op-tee op-tee:op-tee_os"
 
-DEPENDS = "python3-pycryptodome-native python3-pycryptodomex-native python3-pyelftools-native"
+DEPENDS = "python3-pycryptodome-native python3-pyelftools-native"
 
 DEPENDS_append_toolchain-clang = " compiler-rt"
 
meta-arm/recipes-security/optee/optee-test.inc +1 -1
index 877bdeb..f09b9d2 100644
@@ -13,7 +13,7 @@ require optee.inc
 # When upgraded we should be able to remove this limitation
 COMPATIBLE_HOST_libc-musl = 'null'
 
-DEPENDS = "optee-client optee-os python3-pycryptodomex-native"
+DEPENDS = "optee-client optee-os python3-pycryptodome-native"
 
 SRC_URI = "git://github.com/OP-TEE/optee_test.git \
            file://0001-host-xtest-Adjust-order-of-including-compiler.h.patch \
Signature · 1 line
2.30.2
Signature · 4 lines
Regards,
Denys Dmytriyenko <[email protected]>
PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964
Fingerprint: 25FC E4A5 8A72 2F69 1186  6D76 4209 0272 9A92 C964
#3 lore raw

PATCH 2/4 arm/optee-os: mark LDFLAGS patch as submitted

In reply to Yann Dirson

From: Yann Dirson <[email protected]>

---
 .../optee-examples/0001-make-Pass-ldflags-during-link.patch     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch +1 -1
index 0894a7a..84202ef 100644
@@ -8,7 +8,7 @@ for gnu_hash among others which sets the linking straight
 using LDFLAGS varible here means, we can affect the linker flags
 from build environment
 
-Upstream-Status: Pending
+Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/85]
 
 Signed-off-by: Khem Raj <[email protected]>
 ---
Signature · 1 line
2.30.2
#4 lore raw

PATCH 3/4 arm/optee-os: deploy tee.elf for u-boot

In reply to Yann Dirson

From: Yann Dirson <[email protected]>

Integration of OP-TEE in the u-boot image is done with TEE=tee.elf. This can now be done in a BSP layer with something like this in u-boot_%.bbappend:

OPTEE_DEPENDS ??= ""
OPTEE_DEPENDS_rk3399 = " optee-os:do_deploy"

do_compile[depends] .= "${OPTEE_DEPENDS}"

 do_compile_prepend_rk3399() {
     export TEE=${DEPLOY_DIR_IMAGE}/optee/tee.elf

}

---
 meta-arm/recipes-security/optee/optee-os.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-arm/recipes-security/optee/optee-os.inc +1 -1
index 34f586a..db8428a 100644
@@ -58,7 +58,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 do_deploy() {
     install -d ${DEPLOYDIR}/optee
-    install -m 644 ${D}${nonarch_base_libdir}/firmware/* ${DEPLOYDIR}/optee/
+    install -m 644 ${D}${nonarch_base_libdir}/firmware/* ${B}/core/tee.elf ${DEPLOYDIR}/optee/
 }
 
 addtask deploy before do_build after do_install
Signature · 1 line
2.30.2
#5 lore raw

Re: [meta-arm] [PATCH 3/4] arm/optee-os: deploy tee.elf for u-boot

Quoted 5 lines · Yann Dirson

From: Yann Dirson <[email protected]>

Integration of OP-TEE in the u-boot image is done with TEE=tee.elf. This can now be done in a BSP layer with something like this in u-boot_%.bbappend:

Well, this is not very standardized and is platform-specific.

For example, TI K3 platforms take tee-pager_v2.bin file into U-boot, not tee.elf one. But tee.elf still gets deployed for debugging purposes...

E.g. in meta-ti u-boot_%.bbappend:

PACKAGECONFIG[optee] = "TEE=${STAGING_DIR_HOST}${nonarch_base_libdir}/firmware/tee-pager_v2.bin,,optee-os" PACKAGECONFIG_append_k3 = " optee"

Quoted 8 lines

OPTEE_DEPENDS ??= ""
OPTEE_DEPENDS_rk3399 = " optee-os:do_deploy"

do_compile[depends] .= "${OPTEE_DEPENDS}"

 do_compile_prepend_rk3399() {
     export TEE=${DEPLOY_DIR_IMAGE}/optee/tee.elf

}

To mee, the above PACKAGECONFIG approach is a bit cleaner...

In summary, I support availability of tee.elf, but besides do_deploy(), I would also suggest adding it to do_install()

Quoted 21 lines
---
 meta-arm/recipes-security/optee/optee-os.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-arm/recipes-security/optee/optee-os.inc +1 -1
index 34f586a..db8428a 100644
@@ -58,7 +58,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 do_deploy() {
     install -d ${DEPLOYDIR}/optee
-    install -m 644 ${D}${nonarch_base_libdir}/firmware/* ${DEPLOYDIR}/optee/
+    install -m 644 ${D}${nonarch_base_libdir}/firmware/* ${B}/core/tee.elf ${DEPLOYDIR}/optee/
 }
 
 addtask deploy before do_build after do_install
Signature · 1 line
2.30.2
Signature · 4 lines
Regards,
Denys Dmytriyenko <[email protected]>
PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964
Fingerprint: 25FC E4A5 8A72 2F69 1186  6D76 4209 0272 9A92 C964
#6 lore raw

Re: [meta-arm] [PATCH 3/4] arm/optee-os: deploy tee.elf for u-boot

Hi Denis,

Quoted 22 lines · Denys Dmytriyenko
Quoted 5 lines · Yann Dirson

From: Yann Dirson <[email protected]>

Integration of OP-TEE in the u-boot image is done with TEE=tee.elf. This can now be done in a BSP layer with something like this in u-boot_%.bbappend:

Well, this is not very standardized and is platform-specific.

For example, TI K3 platforms take tee-pager_v2.bin file into U-boot, not tee.elf one. But tee.elf still gets deployed for debugging purposes...

E.g. in meta-ti u-boot_%.bbappend:

PACKAGECONFIG[optee] = "TEE=${STAGING_DIR_HOST}${nonarch_base_libdir}/firmware/tee-pager_v2.bin,,optee-os" PACKAGECONFIG_append_k3 = " optee"

Quoted 3 lines

OPTEE_DEPENDS ??= ""
OPTEE_DEPENDS_rk3399 = " optee-os:do_deploy"

Quoted 7 lines
Quoted 5 lines

do_compile[depends] .= "${OPTEE_DEPENDS}"

 do_compile_prepend_rk3399() {
     export TEE=${DEPLOY_DIR_IMAGE}/optee/tee.elf

}

To mee, the above PACKAGECONFIG approach is a bit cleaner...

Well, I did not like it either and went with a DISTRO_FEATURES approach, see my meta-rockchip patches on yocto ml. It would be nice if it was generic enough, but your example above shows it probably needs some more refining anyway.

Eg. even the PACKAGECONFIG you show above is still BSP-specific. Maybe we could centralize in meta-arm the different ways to integrate op-tee, and get the BSP to choose one ?

Quoted 3 lines

In summary, I support availability of tee.elf, but besides do_deploy(), I would also suggest adding it to do_install()

I must say I was puzzled by those optee files put it a package for installation in the target rootfs (but then as you say there seem to be many ways to integrate
op-tee on different platforms). If they're just useful for debugging, they would look like
good candidates for a -dbg package: what use-case does the current optee-os binary package serve ?

Quoted 29 lines
Quoted 21 lines
---
 meta-arm/recipes-security/optee/optee-os.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-arm/recipes-security/optee/optee-os.inc +1 -2
index 34f586a..db8428a 100644
@@ -58,7 +58,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 do_deploy() {
     install -d ${DEPLOYDIR}/optee
-    install -m 644 ${D}${nonarch_base_libdir}/firmware/* ${DEPLOYDIR}/optee/
+    install -m 644 ${D}${nonarch_base_libdir}/firmware/* ${B}/core/tee.elf ${DEPLOYDIR}/optee/
 }
 
 addtask deploy before do_build after do_install
--
Quoted 2 lines

2.30.2

--
Regards,
Denys Dmytriyenko <[email protected]>
PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964
Fingerprint: 25FC E4A5 8A72 2F69 1186 6D76 4209 0272 9A92 C964

Signature · 2 lines
Yann Dirson <[email protected]>
Blade / Shadow -- http://shadow.tech
#7 lore raw

Re: [meta-arm] [PATCH 3/4] arm/optee-os: deploy tee.elf for u-boot

Quoted 43 lines · Yann Dirson

Hi Denis,

Quoted 22 lines · Denys Dmytriyenko
Quoted 5 lines · Yann Dirson

From: Yann Dirson <[email protected]>

Integration of OP-TEE in the u-boot image is done with TEE=tee.elf. This can now be done in a BSP layer with something like this in u-boot_%.bbappend:

Well, this is not very standardized and is platform-specific.

For example, TI K3 platforms take tee-pager_v2.bin file into U-boot, not tee.elf one. But tee.elf still gets deployed for debugging purposes...

E.g. in meta-ti u-boot_%.bbappend:

PACKAGECONFIG[optee] = "TEE=${STAGING_DIR_HOST}${nonarch_base_libdir}/firmware/tee-pager_v2.bin,,optee-os" PACKAGECONFIG_append_k3 = " optee"

Quoted 3 lines

OPTEE_DEPENDS ??= ""
OPTEE_DEPENDS_rk3399 = " optee-os:do_deploy"

Quoted 7 lines
Quoted 5 lines

do_compile[depends] .= "${OPTEE_DEPENDS}"

 do_compile_prepend_rk3399() {
     export TEE=${DEPLOY_DIR_IMAGE}/optee/tee.elf

}

To mee, the above PACKAGECONFIG approach is a bit cleaner...

Well, I did not like it either and went with a DISTRO_FEATURES approach, see my meta-rockchip patches on yocto ml. It would be nice if it was generic enough, but your example above shows it probably needs some more refining anyway.

Eg. even the PACKAGECONFIG you show above is still BSP-specific. Maybe we could centralize in meta-arm the different ways to integrate op-tee, and get the BSP to choose one ?

Quoted 1 line
Quoted 5 lines
Quoted 2 lines

In summary, I support availability of tee.elf, but besides do_deploy(), I would also suggest adding it to do_install()

I must say I was puzzled by those optee files put it a package for installation in the target rootfs

No, they are not in the target rootfs, they don't have to be. Getting files installed does put them in a package, which enables proper staging, so you can DEPENDS += "optee-os" and the files will be in recipe-sysroot, similar to my PACKAGECONFIG example above. Whether the package gets installed in the target rootfs or not is completely orthogonal here.

Quoted 30 lines

(but then as you say there seem to be many ways
to integrate
op-tee on different platforms). If they're just useful for debugging, they would look like
good candidates for a -dbg package: what use-case does the current optee-os binary package serve ?

Quoted 23 lines
Quoted 23 lines
---
 meta-arm/recipes-security/optee/optee-os.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-arm/recipes-security/optee/optee-os.inc +1 -2
index 34f586a..db8428a 100644
@@ -58,7 +58,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 do_deploy() {
     install -d ${DEPLOYDIR}/optee
-    install -m 644 ${D}${nonarch_base_libdir}/firmware/* ${DEPLOYDIR}/optee/
+    install -m 644 ${D}${nonarch_base_libdir}/firmware/* ${B}/core/tee.elf ${DEPLOYDIR}/optee/
 }
 
 addtask deploy before do_build after do_install
--

2.30.2

Signature · 4 lines
Regards,
Denys Dmytriyenko <[email protected]>
PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964
Fingerprint: 25FC E4A5 8A72 2F69 1186  6D76 4209 0272 9A92 C964
#8 lore raw

Re: [meta-arm] [PATCH 3/4] arm/optee-os: deploy tee.elf for u-boot

Quoted 51 lines · Denys Dmytriyenko
Quoted 43 lines · Yann Dirson

Hi Denis,

Quoted 22 lines · Denys Dmytriyenko
Quoted 5 lines · Yann Dirson

From: Yann Dirson <[email protected]>

Integration of OP-TEE in the u-boot image is done with TEE=tee.elf. This can now be done in a BSP layer with something like this in u-boot_%.bbappend:

Well, this is not very standardized and is platform-specific.

For example, TI K3 platforms take tee-pager_v2.bin file into U-boot, not tee.elf one. But tee.elf still gets deployed for debugging purposes...

E.g. in meta-ti u-boot_%.bbappend:

PACKAGECONFIG[optee] = "TEE=${STAGING_DIR_HOST}${nonarch_base_libdir}/firmware/tee-pager_v2.bin,,optee-os" PACKAGECONFIG_append_k3 = " optee"

Quoted 3 lines

OPTEE_DEPENDS ??= ""
OPTEE_DEPENDS_rk3399 = " optee-os:do_deploy"

Quoted 7 lines
Quoted 5 lines

do_compile[depends] .= "${OPTEE_DEPENDS}"

 do_compile_prepend_rk3399() {
     export TEE=${DEPLOY_DIR_IMAGE}/optee/tee.elf

}

To mee, the above PACKAGECONFIG approach is a bit cleaner...

Well, I did not like it either and went with a DISTRO_FEATURES approach, see my meta-rockchip patches on yocto ml. It would be nice if it was generic enough, but your example above shows it probably needs some more refining anyway.

Eg. even the PACKAGECONFIG you show above is still BSP-specific. Maybe we could centralize in meta-arm the different ways to integrate op-tee, and get the BSP to choose one ?

Quoted 1 line
Quoted 5 lines
Quoted 2 lines

In summary, I support availability of tee.elf, but besides do_deploy(), I would also suggest adding it to do_install()

I must say I was puzzled by those optee files put it a package for installation in the target rootfs

Quoted 6 lines

No, they are not in the target rootfs, they don't have to be. Getting files installed does put them in a package, which enables proper staging, so you can DEPENDS += "optee-os" and the files will be in recipe-sysroot, similar to my PACKAGECONFIG example above. Whether the package gets installed in the target rootfs or not is completely orthogonal here.

I see what you mean. However, a package is still originally the "installable unit"
for meant for usage in a consistent filesystem, so we got a semantic shift, then :).
If we have all those bootloader parts and other files already usable through classical
DEPENDS, what good does it make to have them also exposed by do_deploy ?

In fact, using deployed artifacts in a recipe could even cause reproducibility issues of the same kind we had before per-recipe sysroots. Shouldn't we just stop getting *any* file from DEPLOY_DIR_IMAGE in recipes ?

Quoted 38 lines
Quoted 28 lines

(but then as you say there seem to be many ways
to integrate
op-tee on different platforms). If they're just useful for debugging, they would look like
good candidates for a -dbg package: what use-case does the current optee-os binary package serve ?

Quoted 19 lines
Quoted 19 lines
---
 meta-arm/recipes-security/optee/optee-os.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-arm/recipes-security/optee/optee-os.inc +1 -1
index 34f586a..db8428a 100644
@@ -58,7 +58,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 do_deploy() {
     install -d ${DEPLOYDIR}/optee
-    install -m 644 ${D}${nonarch_base_libdir}/firmware/* ${DEPLOYDIR}/optee/
+    install -m 644 ${D}${nonarch_base_libdir}/firmware/* ${B}/core/tee.elf ${DEPLOYDIR}/optee/
 }
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
meta-arm/recipes-security/optee/optee-os.inc +0 -1
 addtask deploy before do_build after do_install
--

2.30.2

--
Regards,
Denys Dmytriyenko <[email protected]>
PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964
Fingerprint: 25FC E4A5 8A72 2F69 1186 6D76 4209 0272 9A92 C964

Signature · 2 lines
Yann Dirson <[email protected]>
Blade / Shadow -- http://shadow.tech
#9 lore raw

Re: [meta-arm] [PATCH 3/4] arm/optee-os: deploy tee.elf for u-boot

Quoted 67 lines · Yann Dirson
Quoted 51 lines · Denys Dmytriyenko
Quoted 43 lines · Yann Dirson

Hi Denis,

Quoted 22 lines · Denys Dmytriyenko
Quoted 5 lines · Yann Dirson

From: Yann Dirson <[email protected]>

Integration of OP-TEE in the u-boot image is done with TEE=tee.elf. This can now be done in a BSP layer with something like this in u-boot_%.bbappend:

Well, this is not very standardized and is platform-specific.

For example, TI K3 platforms take tee-pager_v2.bin file into U-boot, not tee.elf one. But tee.elf still gets deployed for debugging purposes...

E.g. in meta-ti u-boot_%.bbappend:

PACKAGECONFIG[optee] = "TEE=${STAGING_DIR_HOST}${nonarch_base_libdir}/firmware/tee-pager_v2.bin,,optee-os" PACKAGECONFIG_append_k3 = " optee"

Quoted 3 lines

OPTEE_DEPENDS ??= ""
OPTEE_DEPENDS_rk3399 = " optee-os:do_deploy"

Quoted 7 lines
Quoted 5 lines

do_compile[depends] .= "${OPTEE_DEPENDS}"

 do_compile_prepend_rk3399() {
     export TEE=${DEPLOY_DIR_IMAGE}/optee/tee.elf

}

To mee, the above PACKAGECONFIG approach is a bit cleaner...

Well, I did not like it either and went with a DISTRO_FEATURES approach, see my meta-rockchip patches on yocto ml. It would be nice if it was generic enough, but your example above shows it probably needs some more refining anyway.

Eg. even the PACKAGECONFIG you show above is still BSP-specific. Maybe we could centralize in meta-arm the different ways to integrate op-tee, and get the BSP to choose one ?

Quoted 1 line
Quoted 5 lines
Quoted 2 lines

In summary, I support availability of tee.elf, but besides do_deploy(), I would also suggest adding it to do_install()

I must say I was puzzled by those optee files put it a package for installation in the target rootfs

Quoted 6 lines

No, they are not in the target rootfs, they don't have to be. Getting files installed does put them in a package, which enables proper staging, so you can DEPENDS += "optee-os" and the files will be in recipe-sysroot, similar to my PACKAGECONFIG example above. Whether the package gets installed in the target rootfs or not is completely orthogonal here.

I see what you mean. However, a package is still originally the "installable unit"
for meant for usage in a consistent filesystem, so we got a semantic shift, then :).
If we have all those bootloader parts and other files already usable through classical
DEPENDS, what good does it make to have them also exposed by do_deploy ?

Quoted 3 lines

In fact, using deployed artifacts in a recipe could even cause reproducibility issues of the same kind we had before per-recipe sysroots. Shouldn't we just stop getting *any* file from DEPLOY_DIR_IMAGE in recipes ?

Consuming files from DEPLOY within recipes is not recommended. At least it wasn't originally...

Quoted 45 lines
Quoted 38 lines
Quoted 28 lines

(but then as you say there seem to be many ways
to integrate
op-tee on different platforms). If they're just useful for debugging, they would look like
good candidates for a -dbg package: what use-case does the current optee-os binary package serve ?

Quoted 19 lines
Quoted 19 lines
---
 meta-arm/recipes-security/optee/optee-os.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-arm/recipes-security/optee/optee-os.inc +1 -1
index 34f586a..db8428a 100644
@@ -58,7 +58,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 do_deploy() {
     install -d ${DEPLOYDIR}/optee
-    install -m 644 ${D}${nonarch_base_libdir}/firmware/* ${DEPLOYDIR}/optee/
+    install -m 644 ${D}${nonarch_base_libdir}/firmware/* ${B}/core/tee.elf ${DEPLOYDIR}/optee/
 }
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
meta-arm/recipes-security/optee/optee-os.inc +0 -1
 addtask deploy before do_build after do_install
--

2.30.2

--
Regards,
Denys Dmytriyenko <[email protected]>
PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964
Fingerprint: 25FC E4A5 8A72 2F69 1186 6D76 4209 0272 9A92 C964

Signature · 2 lines
Yann Dirson <[email protected]>
Blade / Shadow -- http://shadow.tech
Signature · 4 lines
Regards,
Denys Dmytriyenko <[email protected]>
PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964
Fingerprint: 25FC E4A5 8A72 2F69 1186  6D76 4209 0272 9A92 C964
#10 lore raw

PATCH 4/4 arm/optee-client: create the /data/tee/ directory needed by tee-supplicant

In reply to Yann Dirson

From: Yann Dirson <[email protected]>

With a writable rootfs, tee-supplicant will create this directory as needed, but on a readonly rootfs it's obviously not possible.

Getting a readonly-rootfs use-case fully working still require a proper writable filesystem to be mounted there, but how to do that is distro policy, and correct OP-TEE can be at least be checked by mounting a tmpfs there.

---
 meta-arm/recipes-security/optee/optee-client.inc | 6 ++++++
 1 file changed, 6 insertions(+)
meta-arm/recipes-security/optee/optee-client.inc +6 -0
index f697386..0198433 100644
@@ -24,6 +24,8 @@ do_install_append() {
     install -D -p -m0644 ${WORKDIR}/tee-supplicant.service ${D}${systemd_system_unitdir}/tee-supplicant.service
     install -D -p -m0755 ${WORKDIR}/tee-supplicant.sh ${D}${sysconfdir}/init.d/tee-supplicant
 
+    install -d -m755 ${D}/data/tee
+
     sed -i -e s:@sysconfdir@:${sysconfdir}:g \
            -e s:@sbindir@:${sbindir}:g \
               ${D}${systemd_system_unitdir}/tee-supplicant.service \
@@ -35,3 +37,7 @@ SYSTEMD_SERVICE_${PN} = "tee-supplicant.service"
 INITSCRIPT_PACKAGES = "${PN}"
 INITSCRIPT_NAME_${PN} = "tee-supplicant"
 INITSCRIPT_PARAMS_${PN} = "start 10 1 2 3 4 5 . stop 90 0 6 ."
+
+FILES_${PN} += "\
+    /data/tee/ \
+"
Signature · 1 line
2.30.2
#11 lore raw

Re: [meta-arm] [PATCH 4/4] arm/optee-client: create the /data/tee/ directory needed by tee-supplicant

Quoted 9 lines · Yann Dirson

From: Yann Dirson <[email protected]>

With a writable rootfs, tee-supplicant will create this directory as needed, but on a readonly rootfs it's obviously not possible.

Getting a readonly-rootfs use-case fully working still require a proper writable filesystem to be mounted there, but how to do that is distro policy, and correct OP-TEE can be at least be checked by mounting a tmpfs there.

It might be better here to follow FHS and use a standard directory for the writable content (e.g. /var) instead. This should cover most distro configuration.

Quoted 10 lines
---
 meta-arm/recipes-security/optee/optee-client.inc | 6 ++++++
 1 file changed, 6 insertions(+)
meta-arm/recipes-security/optee/optee-client.inc +0 -0
index f697386..0198433 100644

meta-arm/recipes-security/optee/optee-client.inc do_install_append() { · line 28

Quoted 5 lines
meta-arm/recipes-security/optee/optee-client.inc +2 -0
@@ -24,6 +24,8 @@ do_install_append() {
     install -D -p -m0644 ${WORKDIR}/tee-supplicant.service ${D}${systemd_system_unitdir}/tee-supplicant.service
     install -D -p -m0755 ${WORKDIR}/tee-supplicant.sh ${D}${sysconfdir}/init.d/tee-supplicant
 
+    install -d -m755 ${D}/data/tee
+

You could give 'CFG_TEE_FS_PARENT_PATH=${localstatedir}/tee' to EXTRA_OEMAKE, for example.

Cheers,

Signature · 1 line
Ricardo Salveti
#12 lore raw

Re: [meta-arm] [PATCH 4/4] arm/optee-client: create the /data/tee/ directory needed by tee-supplicant

Quoted 8 lines · Ricardo Salveti
Quoted 6 lines · Yann Dirson

From: Yann Dirson <[email protected]>

With a writable rootfs, tee-supplicant will create this directory as needed, but on a readonly rootfs it's obviously not possible.

Quoted 7 lines
Quoted 3 lines

Getting a readonly-rootfs use-case fully working still require a proper writable filesystem to be mounted there, but how to do that is distro policy, and correct OP-TEE can be at least be checked by mounting a tmpfs there.

It might be better here to follow FHS and use a standard directory for the writable content (e.g. /var) instead. This should cover most distro configuration.

Right, that does make sense!

Quoted 23 lines
Quoted 11 lines
---
 meta-arm/recipes-security/optee/optee-client.inc | 6 ++++++
 1 file changed, 6 insertions(+)
meta-arm/recipes-security/optee/optee-client.inc +0 -0
index f697386..0198433 100644

meta-arm/recipes-security/optee/optee-client.inc do_install_append() { · line 28

Quoted 5 lines
meta-arm/recipes-security/optee/optee-client.inc +2 -0
@@ -24,6 +24,8 @@ do_install_append() {
     install -D -p -m0644 ${WORKDIR}/tee-supplicant.service ${D}${systemd_system_unitdir}/tee-supplicant.service
     install -D -p -m0755 ${WORKDIR}/tee-supplicant.sh ${D}${sysconfdir}/init.d/tee-supplicant
 
+    install -d -m755 ${D}/data/tee
+

You could give 'CFG_TEE_FS_PARENT_PATH=${localstatedir}/tee' to EXTRA_OEMAKE, for example.

Cheers,
--
Ricardo Salveti

Signature · 2 lines
Yann Dirson <[email protected]>
Blade / Shadow -- http://shadow.tech