From: Jan Kiszka <[email protected]>

This prepares for building Trusted Firmware A always as package, like we
already do for rpi4. The infrastructure is added as Isar path that will
be upstreamed soon.

TF-A will will be packaged per-machine, just like U-Boot. So already
prepare the corresponding PREFERRED_PROVIDER rule.

Signed-off-by: Jan Kiszka <[email protected]>
---
 conf/distro/jailhouse-demo.conf               |   1 +
 ...de-for-building-custom-Trusted-Firmw.patch | 127 ++++++++++++++++++
 kas.yml                                       |   4 +
 3 files changed, 132 insertions(+)
 create mode 100644 
isar-patches/0001-Add-recipe-include-for-building-custom-Trusted-Firmw.patch

diff --git a/conf/distro/jailhouse-demo.conf b/conf/distro/jailhouse-demo.conf
index eeb5ea3..9f0aa92 100644
--- a/conf/distro/jailhouse-demo.conf
+++ b/conf/distro/jailhouse-demo.conf
@@ -17,6 +17,7 @@ WKS_FILE ?= "${MACHINE}.wks"
 
 PREFERRED_VERSION_jailhouse-${KERNEL_NAME} ?= "0.12"
 
+PREFERRED_PROVIDER_trusted-firmware-a-${MACHINE} ?= 
"trusted-firmware-a-${MACHINE}"
 PREFERRED_PROVIDER_u-boot-${MACHINE} ?= "u-boot-${MACHINE}"
 
 USERS += "root"
diff --git 
a/isar-patches/0001-Add-recipe-include-for-building-custom-Trusted-Firmw.patch 
b/isar-patches/0001-Add-recipe-include-for-building-custom-Trusted-Firmw.patch
new file mode 100644
index 0000000..72b089f
--- /dev/null
+++ 
b/isar-patches/0001-Add-recipe-include-for-building-custom-Trusted-Firmw.patch
@@ -0,0 +1,127 @@
+From 6754548019e02c1dbf0d336d06dd14508eb1684c Mon Sep 17 00:00:00 2001
+From: Jan Kiszka <[email protected]>
+Date: Sun, 27 Sep 2020 12:08:45 +0200
+Subject: [PATCH] Add recipe include for building custom Trusted Firmware A
+
+Analogously to U-Boot, this adds an include file to be used in custom
+TF-A recipes. The typical customization points are TF_A_PLATFORM and
+possibly a couple of TF_A_EXTRA_BUILDARGS. The to-be-packaged binaries
+can be defined via TF_A_BINARIES.
+
+Debian has a binary package called "arm-trusted-firmware", targeting a
+couple of sunxi boards. We do not follow that legacy naming by intention
+and rather use the new official one. Debian will probably follow at some
+point.
+
+Signed-off-by: Jan Kiszka <[email protected]>
+---
+ .../trusted-firmware-a/files/debian/compat    |  1 +
+ .../files/debian/control.tmpl                 | 10 +++++
+ .../trusted-firmware-a/files/debian/rules     | 19 ++++++++
+ .../trusted-firmware-a-custom.inc             | 43 +++++++++++++++++++
+ 4 files changed, 73 insertions(+)
+ create mode 100644 meta/recipes-bsp/trusted-firmware-a/files/debian/compat
+ create mode 100644 
meta/recipes-bsp/trusted-firmware-a/files/debian/control.tmpl
+ create mode 100755 meta/recipes-bsp/trusted-firmware-a/files/debian/rules
+ create mode 100644 
meta/recipes-bsp/trusted-firmware-a/trusted-firmware-a-custom.inc
+
+diff --git a/meta/recipes-bsp/trusted-firmware-a/files/debian/compat 
b/meta/recipes-bsp/trusted-firmware-a/files/debian/compat
+new file mode 100644
+index 00000000..f599e28b
+--- /dev/null
++++ b/meta/recipes-bsp/trusted-firmware-a/files/debian/compat
+@@ -0,0 +1 @@
++10
+diff --git a/meta/recipes-bsp/trusted-firmware-a/files/debian/control.tmpl 
b/meta/recipes-bsp/trusted-firmware-a/files/debian/control.tmpl
+new file mode 100644
+index 00000000..7ffd189d
+--- /dev/null
++++ b/meta/recipes-bsp/trusted-firmware-a/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 <[email protected]>
++
++Package: trusted-firmware-a-${TF_A_NAME}
++Architecture: ${DISTRO_ARCH}
++Description: ${DESCRIPTION}, firmware binaries
+diff --git a/meta/recipes-bsp/trusted-firmware-a/files/debian/rules 
b/meta/recipes-bsp/trusted-firmware-a/files/debian/rules
+new file mode 100755
+index 00000000..70e1dd66
+--- /dev/null
++++ b/meta/recipes-bsp/trusted-firmware-a/files/debian/rules
+@@ -0,0 +1,19 @@
++#!/usr/bin/make -f
++
++# Debian rules for custom Trusted Firmware A 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) PLAT=$(TF_A_PLATFORM) \
++              $(TF_A_EXTRA_BUILDARGS)
++
++%:
++      dh $@
+diff --git a/meta/recipes-bsp/trusted-firmware-a/trusted-firmware-a-custom.inc 
b/meta/recipes-bsp/trusted-firmware-a/trusted-firmware-a-custom.inc
+new file mode 100644
+index 00000000..a065ce71
+--- /dev/null
++++ b/meta/recipes-bsp/trusted-firmware-a/trusted-firmware-a-custom.inc
+@@ -0,0 +1,43 @@
++# Custom Trusted Firmware A 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 Trusted Firmware A"
++
++TF_A_NAME ?= "${MACHINE}"
++TF_A_PLATFORM ?= "unknown"
++TF_A_EXTRA_BUILDARGS ?= ""
++TF_A_BINARIES ?= "bl31.bin"
++
++DEBIAN_BUILD_DEPENDS ?= ""
++
++PROVIDES += "trusted-firmware-a-${TF_A_NAME}"
++
++TEMPLATE_FILES = "debian/control.tmpl"
++TEMPLATE_VARS += "TF_A_NAME DEBIAN_BUILD_DEPENDS"
++
++do_prepare_build() {
++    cp -r ${WORKDIR}/debian ${S}/
++
++    deb_add_changelog
++
++    rm -f ${S}/debian/trusted-firmware-a-${TF_A_NAME}.install
++    for binary in ${TF_A_BINARIES}; do
++        echo "build/${TF_A_PLATFORM}/release/$binary 
/usr/lib/trusted-firmware-a/${TF_A_NAME}/" >> \
++            ${S}/debian/trusted-firmware-a-${TF_A_NAME}.install
++    done
++}
++
++dpkg_runbuild_prepend() {
++    export TF_A_PLATFORM="${TF_A_PLATFORM}"
++    export TF_A_EXTRA_BUILDARGS="${TF_A_EXTRA_BUILDARGS}"
++}
+-- 
+2.26.2
+
diff --git a/kas.yml b/kas.yml
index 6c3c987..8807257 100644
--- a/kas.yml
+++ b/kas.yml
@@ -24,6 +24,10 @@ repos:
     refspec: 93658f7a72679c89e14adc7bbdbf3f5d52b7ac0d
     layers:
       meta:
+    patches:
+      tf-a:
+        path: 
isar-patches/0001-Add-recipe-include-for-building-custom-Trusted-Firmw.patch
+        repo: jailhouse
 
 bblayers_conf_header:
   standard: |
-- 
2.26.2

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/68da147436149de570216ccb11a74489bed1328f.1601876389.git.jan.kiszka%40siemens.com.

Reply via email to