From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6883009067021762560 X-Received: by 2002:a2e:b5d4:: with SMTP id g20mr10903260ljn.406.1605981942007; Sat, 21 Nov 2020 10:05:42 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a19:6b0b:: with SMTP id d11ls2247479lfa.1.gmail; Sat, 21 Nov 2020 10:05:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJwh9lgnUW1Q5nBDdEFOk3ZvUU8M/pzE/Ce7AI0fHfL1vKLvxsmWpHyKCd30WyOvhRyECeSI X-Received: by 2002:a19:84c5:: with SMTP id g188mr11391260lfd.270.1605981940840; Sat, 21 Nov 2020 10:05:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605981940; cv=none; d=google.com; s=arc-20160816; b=Q11OT1BlFpaCTwE2hc4/tqsM0Kh5dJQfrUjINLuAVA0DAhSCAux94/v74Sj99viCus na/g3hYSsvTvg5HFpQ8qjZWs8jVlzYOJifiLJKhwRkaFb40DzbrlHV5D/awHLjxQg9nF HGy+O8SP+J5Q4Zb1UFXE7Fnv81SiE55wIZ6sD2caZ8Qzctkgu03kRXnX7lcWEw4KI58L KE1BlhbSA5JbYmXwOZ9gUX3XsVBTsKGPO61v+R1Effvl4s0DqUgRzFWgVZki6GeKDY6j l80gLBtIcIxdZWA7MbsRRC0+O6A27zohjfbC3Qlz6F2fgDoeceiylzz/+PtWatmjwmFk 5icA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:references:to:from:subject; bh=KqZgOrw4BPar3Lz3sV1LSbmJSA28a0M0R0OEe07SPOo=; b=0wn0QGEm9U0nsHHp/aWftXyU3qxV7sZXC4fhLOyoOMwz8TrClrKpvD93VU3L5xyAKV h7s9EgauTWaz9bu59/kiMaIzFIcnWY1AfLUKNYjWdcSyGk7mml7lMp4U2AS9KkTsnFpn y2QJ8HF0+Pmt2WBfYlDp1MR9jgW6tY43Is1wgg2dCk5JH1hZuLBZyHcdVNuGHdsaYAVd /HrqoL9mh5ZT5j99lNfWDd26RLWMfA5ey6Mfa2kfZk/oaYEIYzsmJZMdMQdkXvtgZn71 AK+66NBMjlnQDB+a8MosDk/W9dDwbCNwxQ8m9JEmff4co8mjyl6tXkKH/PkVYE0zlDVO zj5A== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id m18si214293lfr.11.2020.11.21.10.05.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Nov 2020 10:05:39 -0800 (PST) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.28 as permitted sender) client-ip=192.35.17.28; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id 0ALI5cB8032467 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 21 Nov 2020 19:05:38 +0100 Received: from [167.87.38.29] ([167.87.38.29]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id 0ALI5cx4016955 for ; Sat, 21 Nov 2020 19:05:38 +0100 Subject: [PATCH v3 09/11] Add recipe include for building custom OP-TEE From: Jan Kiszka To: isar-users References: <41a04af6ae13705c9cfebfb809f769e84acb7d15.1602755020.git.jan.kiszka@siemens.com> Message-ID: <77a51d4d-ebe7-1ca9-ec61-e56907b4d938@siemens.com> Date: Sat, 21 Nov 2020 19:05:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <41a04af6ae13705c9cfebfb809f769e84acb7d15.1602755020.git.jan.kiszka@siemens.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: pSO6JGrZWr0Y From: Jan Kiszka 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 --- Changes in v3: - account for platform flavors in OPTEE_PLATFORM 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 + +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