public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Subject: [PATCH v4 09/11] Add recipe include for building custom OP-TEE
Date: Mon, 23 Nov 2020 08:53:57 +0100	[thread overview]
Message-ID: <11855ee285cd07ce17f526b44fd8347493033bde.1606118039.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1606118039.git.jan.kiszka@siemens.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

Analogously to TF-A, this adds an include file to be used in custom
Open Portable Trusted Execution Environment. The typical customization
points are OPTEE_PLATFORM and possibly a couple of
OPTEE_EXTRA_BUILDARGS. The to-be-packaged binaries can be defined via
OPTEE_BINARIES.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 meta/recipes-bsp/optee-os/files/debian/compat |  1 +
 .../optee-os/files/debian/control.tmpl        | 10 ++++
 meta/recipes-bsp/optee-os/files/debian/rules  | 19 ++++++++
 meta/recipes-bsp/optee-os/optee-os-custom.inc | 46 +++++++++++++++++++
 4 files changed, 76 insertions(+)
 create mode 100644 meta/recipes-bsp/optee-os/files/debian/compat
 create mode 100644 meta/recipes-bsp/optee-os/files/debian/control.tmpl
 create mode 100755 meta/recipes-bsp/optee-os/files/debian/rules
 create mode 100644 meta/recipes-bsp/optee-os/optee-os-custom.inc

diff --git a/meta/recipes-bsp/optee-os/files/debian/compat b/meta/recipes-bsp/optee-os/files/debian/compat
new file mode 100644
index 00000000..f599e28b
--- /dev/null
+++ b/meta/recipes-bsp/optee-os/files/debian/compat
@@ -0,0 +1 @@
+10
diff --git a/meta/recipes-bsp/optee-os/files/debian/control.tmpl b/meta/recipes-bsp/optee-os/files/debian/control.tmpl
new file mode 100644
index 00000000..60b39279
--- /dev/null
+++ b/meta/recipes-bsp/optee-os/files/debian/control.tmpl
@@ -0,0 +1,10 @@
+Source: ${PN}
+Section: admin
+Priority: optional
+Standards-Version: 3.9.6
+Build-Depends: ${DEBIAN_BUILD_DEPENDS}
+Maintainer: ISAR project <isar-users@googlegroups.com>
+
+Package: optee-os-${OPTEE_NAME}
+Architecture: ${DISTRO_ARCH}
+Description: ${DESCRIPTION}, firmware binaries
diff --git a/meta/recipes-bsp/optee-os/files/debian/rules b/meta/recipes-bsp/optee-os/files/debian/rules
new file mode 100755
index 00000000..d2e9900f
--- /dev/null
+++ b/meta/recipes-bsp/optee-os/files/debian/rules
@@ -0,0 +1,19 @@
+#!/usr/bin/make -f
+
+# Debian rules for custom OP-TEE OS build
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2020
+#
+# SPDX-License-Identifier: MIT
+
+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
+endif
+
+override_dh_auto_build:
+	CFLAGS= LDFLAGS= $(MAKE) $(PARALLEL_MAKE) PLATFORM=$(OPTEE_PLATFORM) \
+		$(OPTEE_EXTRA_BUILDARGS)
+
+%:
+	dh $@
diff --git a/meta/recipes-bsp/optee-os/optee-os-custom.inc b/meta/recipes-bsp/optee-os/optee-os-custom.inc
new file mode 100644
index 00000000..1bd51969
--- /dev/null
+++ b/meta/recipes-bsp/optee-os/optee-os-custom.inc
@@ -0,0 +1,46 @@
+# Custom OP-TEE OS build
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2020
+#
+# SPDX-License-Identifier: MIT
+
+inherit dpkg
+
+FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/files:"
+
+SRC_URI += "file://debian/"
+
+DESCRIPTION ?= "Custom OP-TEE OS"
+
+OPTEE_NAME ?= "${MACHINE}"
+OPTEE_PLATFORM ?= "unknown"
+OPTEE_EXTRA_BUILDARGS ?= ""
+OPTEE_BINARIES ?= "tee-pager_v2.bin"
+
+DEBIAN_BUILD_DEPENDS ?= "python3-pycryptodome:native, python3-pyelftools"
+
+PROVIDES += "optee-os-${OPTEE_NAME}"
+
+TEMPLATE_FILES = "debian/control.tmpl"
+TEMPLATE_VARS += "OPTEE_NAME DEBIAN_BUILD_DEPENDS"
+
+# split strip platform flavor, if any, from the specified platform string
+OPTEE_PLATFORM_BASE = "${@d.getVar('OPTEE_PLATFORM').split('-')[0]}"
+
+do_prepare_build() {
+    cp -r ${WORKDIR}/debian ${S}/
+
+    deb_add_changelog
+
+    rm -f ${S}/debian/optee-os-${OPTEE_NAME}.install
+    for binary in ${OPTEE_BINARIES}; do
+        echo "out/arm-plat-${OPTEE_PLATFORM_BASE}/core/$binary /usr/lib/optee-os/${OPTEE_NAME}/" >> \
+            ${S}/debian/optee-os-${OPTEE_NAME}.install
+    done
+}
+
+dpkg_runbuild_prepend() {
+    export OPTEE_PLATFORM="${OPTEE_PLATFORM}"
+    export OPTEE_EXTRA_BUILDARGS="${OPTEE_EXTRA_BUILDARGS}"
+}
-- 
2.26.2


  parent reply	other threads:[~2020-11-23  7:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-23  7:53 [PATCH v4 00/11] Support for building TF-A and OP-TEE, add STM32MP15x board Jan Kiszka
2020-11-23  7:53 ` [PATCH v4 01/11] meta-isar: Lift de0-nano-soc build to buster Jan Kiszka
2020-11-23  7:53 ` [PATCH v4 02/11] meta-isar: linux-mainline: Update to latest 5.4.70 Jan Kiszka
2020-11-23  7:53 ` [PATCH v4 03/11] meta-isar: u-boot: Update to 2020.10 Jan Kiszka
2020-11-23  7:53 ` [PATCH v4 04/11] meta-isar: u-boot: Factor our de0-nano-soc recipe Jan Kiszka
2020-11-23  7:53 ` [PATCH v4 05/11] meta-isar: example-raw: Purge securetty from target image Jan Kiszka
2020-11-23  7:53 ` [PATCH v4 06/11] Add STM32MP15x eval board Jan Kiszka
2020-11-23  7:53 ` [PATCH v4 07/11] Add recipe include for building custom Trusted Firmware A Jan Kiszka
2020-11-23  7:53 ` [PATCH v4 08/11] stm32mp15x: Switch to TF-A based boot Jan Kiszka
2020-11-23  7:53 ` Jan Kiszka [this message]
2020-11-23  7:53 ` [PATCH v4 10/11] meta-isar: u-boot-stm32mp15x: Add patches needed for OP-TEE usage Jan Kiszka
2020-11-23  7:53 ` [PATCH v4 11/11] meta-isar: Add OP-TEE to STM32MP15x board Jan Kiszka
2020-11-24 16:52 ` [PATCH v4 00/11] Support for building TF-A and OP-TEE, add " Baurzhan Ismagulov
2020-11-25  5:47   ` Jan Kiszka
2020-11-25 18:58     ` Baurzhan Ismagulov
2020-11-25 20:30       ` Jan Kiszka
2020-11-26 15:54 ` Anton Mikanovich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11855ee285cd07ce17f526b44fd8347493033bde.1606118039.git.jan.kiszka@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox