From: Jan Kiszka <jan.kiszka@siemens.com>
To: baocheng.su@siemens.com, isar-users@googlegroups.com
Cc: felix.moessbauer@siemens.com, christian.storm@siemens.com,
quirin.gylstorff@siemens.com, baocheng_su@163.com,
henning.schild@siemens.com
Subject: Re: [PATCH v3 6/7] initramfs: Add recipe for tee-supplicant hook
Date: Mon, 17 Jul 2023 18:09:14 +0200 [thread overview]
Message-ID: <1090ef54-0007-4cb0-f285-cd6080fcf87f@siemens.com> (raw)
In-Reply-To: <20230705053340.1158024-7-baocheng.su@siemens.com>
On 05.07.23 07:33, baocheng.su@siemens.com wrote:
> From: Baocheng Su <baocheng.su@siemens.com>
>
> This adds the tee-supplicant hook so that the tee supplicant daemon is
> started at the initrd stage.
>
> The tee-supplicant daemon is used to provide service to trust
> applications running in optee, for example to provide RPMB access
> service for StMM or fTPM TAs.
>
> By running tee-supplicant at initrd stage, disk encryption based on fTPM
> is possible.
>
> stm32mp15x is used to demo the building of this hook, so add a new ci
> target for the initramfs image of stm32mp15x.
>
> Signed-off-by: Baocheng Su <baocheng.su@siemens.com>
> ---
> .../images/stm32mp15x-initramfs.bb | 14 ++++++++
> .../files/tee-supplicant.hook | 33 +++++++++++++++++++
> .../files/tee-supplicant.script | 33 +++++++++++++++++++
> .../initramfs-tee-supplicant-hook_0.1.bb | 27 +++++++++++++++
> testsuite/citest.py | 1 +
> 5 files changed, 108 insertions(+)
> create mode 100644 meta-isar/recipes-initramfs/images/stm32mp15x-initramfs.bb
> create mode 100644 meta/recipes-initramfs/initramfs-tee-supplicant-hook/files/tee-supplicant.hook
> create mode 100644 meta/recipes-initramfs/initramfs-tee-supplicant-hook/files/tee-supplicant.script
> create mode 100644 meta/recipes-initramfs/initramfs-tee-supplicant-hook/initramfs-tee-supplicant-hook_0.1.bb
>
> diff --git a/meta-isar/recipes-initramfs/images/stm32mp15x-initramfs.bb b/meta-isar/recipes-initramfs/images/stm32mp15x-initramfs.bb
> new file mode 100644
> index 0000000..211c201
> --- /dev/null
> +++ b/meta-isar/recipes-initramfs/images/stm32mp15x-initramfs.bb
> @@ -0,0 +1,14 @@
> +#
> +# Copyright (c) Siemens AG, 2023
> +#
> +# Authors:
> +# Su Bao Cheng <baocheng.su@siemens.com>
> +#
> +# SPDX-License-Identifier: MIT
> +#
> +
> +inherit initramfs
> +
> +INITRAMFS_INSTALL += " \
> + initramfs-tee-supplicant-hook \
> + "
> diff --git a/meta/recipes-initramfs/initramfs-tee-supplicant-hook/files/tee-supplicant.hook b/meta/recipes-initramfs/initramfs-tee-supplicant-hook/files/tee-supplicant.hook
> new file mode 100644
> index 0000000..0af277b
> --- /dev/null
> +++ b/meta/recipes-initramfs/initramfs-tee-supplicant-hook/files/tee-supplicant.hook
> @@ -0,0 +1,33 @@
> +#!/bin/sh
> +# Copyright (c) Siemens AG, 2023
> +#
> +# Authors:
> +# Su Bao Cheng <baocheng.su@siemens.com>
> +#
> +# SPDX-License-Identifier: MIT
> +#
> +PREREQ=""
> +prereqs()
> +{
> + echo "$PREREQ"
> +}
> +case $1 in
> +prereqs)
> + prereqs
> + exit 0
> + ;;
> +esac
> +
> +. /usr/share/initramfs-tools/hook-functions
> +
> +hook_error() {
> + echo "(ERROR): $2" >&2
> + exit 1
> +}
> +
> +# For stock debian bookworm arm64 kernel, these two .ko exist, but not built-in.
> +manual_add_modules tee
> +manual_add_modules optee
> +
> +copy_exec /usr/sbin/tee-supplicant || hook_error "/usr/sbin/tee-supplicant not found"
> +copy_exec /usr/bin/pgrep || hook_error "/usr/bin/pgrep not found"
> diff --git a/meta/recipes-initramfs/initramfs-tee-supplicant-hook/files/tee-supplicant.script b/meta/recipes-initramfs/initramfs-tee-supplicant-hook/files/tee-supplicant.script
> new file mode 100644
> index 0000000..bb6dcc1
> --- /dev/null
> +++ b/meta/recipes-initramfs/initramfs-tee-supplicant-hook/files/tee-supplicant.script
> @@ -0,0 +1,33 @@
> +#!/bin/sh
> +# Copyright (c) Siemens AG, 2023
> +#
> +# Authors:
> +# Su Bao Cheng <baocheng.su@siemens.com>
> +#
> +# SPDX-License-Identifier: MIT
> +#
> +PREREQ=""
> +prereqs()
> +{
> + echo "$PREREQ"
> +}
> +case $1 in
> +prereqs)
> + prereqs
> + exit 0
> + ;;
> +esac
> +
> +. /scripts/functions
> +
> +/usr/sbin/tee-supplicant -d
> +
> +# The tee-supplicant would take some time to be discovered, 10 seconds should be
> +# enough
> +wait_sec=10
> +until test $wait_sec -eq 0 || test -c "${FTPM_DEV}" ; do
> + wait_sec=$((wait_sec-1))
> + sleep 1
> +done
> +
> +/usr/bin/pgrep tee-supplicant > /dev/null || panic "Can't start the tee-supplicant daemon!"
> diff --git a/meta/recipes-initramfs/initramfs-tee-supplicant-hook/initramfs-tee-supplicant-hook_0.1.bb b/meta/recipes-initramfs/initramfs-tee-supplicant-hook/initramfs-tee-supplicant-hook_0.1.bb
> new file mode 100644
> index 0000000..3768b8e
> --- /dev/null
> +++ b/meta/recipes-initramfs/initramfs-tee-supplicant-hook/initramfs-tee-supplicant-hook_0.1.bb
> @@ -0,0 +1,27 @@
> +# Copyright (c) Siemens AG, 2023
> +#
> +# Authors:
> +# Su Bao Cheng <baocheng.su@siemens.com>
> +#
> +# SPDX-License-Identifier: MIT
> +#
> +
> +inherit dpkg-raw
> +
> +SRC_URI += " \
> + file://tee-supplicant.hook \
> + file://tee-supplicant.script \
> + "
> +
> +DEBIAN_DEPENDS = "initramfs-tools, tee-supplicant, procps"
> +
> +do_install[cleandirs] += " \
> + ${D}/usr/share/initramfs-tools/hooks \
> + ${D}/usr/share/initramfs-tools/scripts/local-bottom"
> +
> +do_install() {
> + install -m 0755 "${WORKDIR}/tee-supplicant.hook" \
> + "${D}/usr/share/initramfs-tools/hooks/tee-supplicant"
> + install -m 0755 "${WORKDIR}/tee-supplicant.script" \
> + "${D}/usr/share/initramfs-tools/scripts/local-bottom/tee-supplicant"
> +}
> diff --git a/testsuite/citest.py b/testsuite/citest.py
> index 17a9024..1aa2928 100755
> --- a/testsuite/citest.py
> +++ b/testsuite/citest.py
> @@ -214,6 +214,7 @@ class NoCrossTest(CIBaseTest):
> 'mc:bananapi-bullseye:isar-image-base',
> 'mc:nanopi-neo-bullseye:isar-image-base',
> 'mc:stm32mp15x-bullseye:isar-image-base',
> + 'mc:stm32mp15x-bullseye:stm32mp15x-initramfs',
Argh, this is why I get nothing of the initramfs in the final image. But
this is not helpful. We need the initramfs for the integrated image.
Jan
--
Siemens AG, Technology
Competence Center Embedded Linux
next prev parent reply other threads:[~2023-07-17 16:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-05 5:33 [PATCH v3 0/7] Add optee family and friends baocheng.su
2023-07-05 5:33 ` [PATCH v3 1/7] stm32mp15x: Bump optee-os to 3.21.0 baocheng.su
2023-07-05 5:33 ` [PATCH v3 2/7] Add recipe for optee TA devkit baocheng.su
2023-07-05 5:33 ` [PATCH v3 3/7] Add recipe for optee-client baocheng.su
2023-07-06 5:35 ` Uladzimir Bely
2023-07-06 6:56 ` Jan Kiszka
2023-07-12 12:17 ` Jan Kiszka
2023-07-05 5:33 ` [PATCH v3 4/7] Add recipe for optee examples baocheng.su
2023-07-05 5:33 ` [PATCH v3 5/7] Add recipe for optee ftpm baocheng.su
2023-07-12 12:16 ` Jan Kiszka
2023-07-05 5:33 ` [PATCH v3 6/7] initramfs: Add recipe for tee-supplicant hook baocheng.su
2023-07-17 16:09 ` Jan Kiszka [this message]
2023-07-05 5:33 ` [PATCH v3 7/7] initramfs: Add recipe for tee-ftpm hook baocheng.su
2023-07-11 6:43 ` [PATCH v3 0/7] Add optee family and friends Uladzimir Bely
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=1090ef54-0007-4cb0-f285-cd6080fcf87f@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=baocheng.su@siemens.com \
--cc=baocheng_su@163.com \
--cc=christian.storm@siemens.com \
--cc=felix.moessbauer@siemens.com \
--cc=henning.schild@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=quirin.gylstorff@siemens.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