[PATCH 1/2] optee-ftpm: Migrate to a bbclass

6 views
Skip to first unread message

Jan Kiszka

unread,
Dec 12, 2025, 2:59:36 PM (5 days ago) Dec 12
to isar-users
From: Jan Kiszka <jan.k...@siemens.com>

"inherit optee-ftpm" is shorter and a more common pattern compared to
OE/yocto. Keep the original .inc file as transitional helper, issuing a
warning when it's used with a migration suggestion.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
.../optee-ftpm.bbclass} | 3 +-
meta/recipes-bsp/optee-ftpm/optee-ftpm.inc | 65 ++-----------------
2 files changed, 9 insertions(+), 59 deletions(-)
copy meta/{recipes-bsp/optee-ftpm/optee-ftpm.inc => classes-recipe/optee-ftpm.bbclass} (96%)

diff --git a/meta/recipes-bsp/optee-ftpm/optee-ftpm.inc b/meta/classes-recipe/optee-ftpm.bbclass
similarity index 96%
copy from meta/recipes-bsp/optee-ftpm/optee-ftpm.inc
copy to meta/classes-recipe/optee-ftpm.bbclass
index 2c854efc..ba017c5a 100644
--- a/meta/recipes-bsp/optee-ftpm/optee-ftpm.inc
+++ b/meta/classes-recipe/optee-ftpm.bbclass
@@ -6,13 +6,14 @@
#
# SPDX-License-Identifier: MIT
#
+
inherit dpkg

SUMMARY = "OP-TEE fTPM TA"
DESCRIPTION = "Firmware TPM as OP-TEE TCG TA, using Microsoft's TPM 2.0 reference implementation"
HOMEPAGE = "https://github.com/OP-TEE/optee_ftpm"

-FILESPATH:append := ":${FILE_DIRNAME}/files"
+FILESPATH:append = ":${LAYERDIR_core}/recipes-bsp/optee-ftpm/files"

SRC_URI += "file://debian"

diff --git a/meta/recipes-bsp/optee-ftpm/optee-ftpm.inc b/meta/recipes-bsp/optee-ftpm/optee-ftpm.inc
index 2c854efc..992c9122 100644
--- a/meta/recipes-bsp/optee-ftpm/optee-ftpm.inc
+++ b/meta/recipes-bsp/optee-ftpm/optee-ftpm.inc
@@ -1,64 +1,13 @@
-# Copyright (c) Siemens AG, 2023-2025
+# Transitional include for optee-ftpm.bbclass
#
-# Authors:
-# Su Bao Cheng <baoch...@siemens.com>
-# Jan Kiszka <jan.k...@siemens.com>
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2025
#
# SPDX-License-Identifier: MIT
-#
-inherit dpkg
-
-SUMMARY = "OP-TEE fTPM TA"
-DESCRIPTION = "Firmware TPM as OP-TEE TCG TA, using Microsoft's TPM 2.0 reference implementation"
-HOMEPAGE = "https://github.com/OP-TEE/optee_ftpm"
-
-FILESPATH:append := ":${FILE_DIRNAME}/files"
-
-SRC_URI += "file://debian"
-
-OPTEE_NAME ?= "${MACHINE}"
-
-DEPENDS = "optee-os-tadevkit-${OPTEE_NAME}"
-DEBIAN_BUILD_DEPENDS ?= " \
- python3-cryptography:native, \
- optee-os-tadevkit-${OPTEE_NAME} \
- "
-
-TA_CPU ?= "unknown"
-TA_DEV_KIT_DIR ?= "unknown"
-OPTEE_FTPM_BUILD_ARGS_EXTRA ?= " "
-
-# Set to the subdir in WORKDIR containing the unpacked ms-tpm-20-ref sources
-# Leave empty for if still using ms-tpm-20-ref for OP-TEE TA integration
-MS_TPM_20_REF_DIR ?= ""
-
-OPTEE_FTPM_SRCDIR = "${@'Samples/ARM32-FirmwareTPM/optee_ta' if d.getVar('MS_TPM_20_REF_DIR') == '' else '.'}"
-OPTEE_FTPM_BINDIR = "${@'Samples/ARM32-FirmwareTPM/optee_ta/fTPM' if d.getVar('MS_TPM_20_REF_DIR') == '' else '.'}"
-
-TEMPLATE_FILES = "debian/rules.tmpl debian/control.tmpl"
-TEMPLATE_VARS += "DEBIAN_BUILD_DEPENDS \
- DEBIAN_COMPAT \
- OPTEE_FTPM_BUILD_ARGS_EXTRA \
- TA_CPU \
- TA_DEV_KIT_DIR \
- MS_TPM_20_REF_DIR \
- OPTEE_FTPM_SRCDIR \
- DEBIAN_STANDARDS_VERSION"
-
-do_prepare_build() {
- rm -rf "${S}/debian"
- cp -r "${WORKDIR}/debian" "${S}/"
-
- deb_add_changelog

- rm -f ${S}/debian/optee-ftpm-${OPTEE_NAME}.install
- echo "${OPTEE_FTPM_BINDIR}/out/bc50d971-d4c9-42c4-82cb-343fb7f37896.ta /usr/lib/optee-os/${OPTEE_NAME}/ta" > \
- ${S}/debian/optee-ftpm-${OPTEE_NAME}.install
- echo "${OPTEE_FTPM_BINDIR}/out/bc50d971-d4c9-42c4-82cb-343fb7f37896.stripped.elf /usr/lib/optee-os/${OPTEE_NAME}/ta" >> \
- ${S}/debian/optee-ftpm-${OPTEE_NAME}.install
+inherit optee-ftpm

- if [ -n "${MS_TPM_20_REF_DIR}" ] && [ -e "${WORKDIR}/${MS_TPM_20_REF_DIR}" ]; then
- rm -rf "${S}/${MS_TPM_20_REF_DIR}"
- cp -a "${WORKDIR}/${MS_TPM_20_REF_DIR}" "${S}/"
- fi
+do_warn_custom_inc() {
+ bbwarn "Please migrate from \"require recipes-bsp/optee-ftpm/optee-ftpm.inc\" to \"inherit optee-ftpm\""
}
+addtask warn_custom_inc before do_unpack
--
2.51.0

Jan Kiszka

unread,
Dec 12, 2025, 3:00:07 PM (5 days ago) Dec 12
to isar-users
From: Jan Kiszka <jan.k...@siemens.com>

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
.../optee-ftpm/optee-ftpm-stm32mp15x_0~230316+git.bb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta-isar/recipes-bsp/optee-ftpm/optee-ftpm-stm32mp15x_0~230316+git.bb b/meta-isar/recipes-bsp/optee-ftpm/optee-ftpm-stm32mp15x_0~230316+git.bb
index 53e2827c..215273c5 100644
--- a/meta-isar/recipes-bsp/optee-ftpm/optee-ftpm-stm32mp15x_0~230316+git.bb
+++ b/meta-isar/recipes-bsp/optee-ftpm/optee-ftpm-stm32mp15x_0~230316+git.bb
@@ -6,7 +6,7 @@
# SPDX-License-Identifier: MIT
#

-require recipes-bsp/optee-ftpm/optee-ftpm.inc
+inherit optee-ftpm

SRC_URI += " \
https://github.com/Microsoft/ms-tpm-20-ref/archive/${SRCREV}.tar.gz \
--
2.51.0

Jan Kiszka

unread,
Dec 12, 2025, 3:04:11 PM (5 days ago) Dec 12
to isar-users
From: Jan Kiszka <jan.k...@siemens.com>

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---

Could also go into https://patchwork.isar-build.org/project/isar/patch/168e42a3-0671-493d...@siemens.com/

RECIPE-API-CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)

diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index caeeb6e3..16fc0fe9 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -905,6 +905,7 @@ been migrated to classes. The following transitions were applied:
- `recipes-bsp/optee-os/optee-os-custom.inc` -> `optee-os.bbclass`
- `recipes-bsp/optee-os/optee-os-tadevkit-custom.inc` -> `optee-os-tadevkit.bbclass`
- `recipes-bsp/optee-client/optee-client-custom.inc` -> `optee-client.bbclass`
+ - `recipes-bsp/optee-ftpm/optee-ftpm.inc` -> `optee-ftpm.bbclass`
- `recipes-bsp/trusted-firmware-a/trusted-firmware-a-custom.inc` -> `trusted-firmware-a.bbclass`
- `recipes-bsp/barebox/barebox.inc` -> `barebox.bbclass`
- `recipes-initramfs/initramfs-hook/hook.inc` -> `initramfs-hook.bbclass`
--
2.51.0

Anton Mikanovich

unread,
2:05 AM (13 hours ago) 2:05 AM
to isar-...@googlegroups.com, Kiszka, Jan
12/12/2025 21:59, 'Jan Kiszka' via isar-users wrote:
> From: Jan Kiszka <jan.k...@siemens.com>
>
> "inherit optee-ftpm" is shorter and a more common pattern compared to
> OE/yocto. Keep the original .inc file as transitional helper, issuing a
> warning when it's used with a migration suggestion.
>
> Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
Applied all 3 patches to next, thanks.

P.S. This [PATCH 3/2] naming was little bit confusing.
Reply all
Reply to author
Forward
0 new messages