similarity index 75%
rename from meta/recipes-initramfs/initramfs-tee-ftpm-hook/files/tee-ftpm.script
rename to meta/recipes-initramfs/initramfs-tee-ftpm-hook/files/local-top
@@ -1,4 +1,4 @@
-#!/bin/sh
+#
# Copyright (c) Siemens AG, 2023
#
# Authors:
@@ -7,22 +7,6 @@
# SPDX-License-Identifier: MIT
#
-set -e
-
-PREREQ="tee-supplicant"
-prereqs()
-{
- echo "$PREREQ"
-}
-case $1 in
-prereqs)
- prereqs
- exit 0
- ;;
-esac
-
-. /scripts/functions
-
FTPM_DEV=/dev/tpmrm0
# The tee-supplicant would take some time to be discovered, 30 seconds should
deleted file mode 100644
@@ -1,28 +0,0 @@
-#!/bin/sh
-# Copyright (c) Siemens AG, 2023
-#
-# Authors:
-# Su Bao Cheng <baocheng.su@siemens.com>
-#
-# SPDX-License-Identifier: MIT
-#
-
-set -e
-
-PREREQ="tee-supplicant"
-prereqs()
-{
- echo "$PREREQ"
-}
-case $1 in
-prereqs)
- prereqs
- exit 0
- ;;
-esac
-
-. /usr/share/initramfs-tools/hook-functions
-
-# The tpm_ftpm_tee.ko does not exist in any stock debian kernels, it could be
-# provided by customized kernel.
-manual_add_modules tpm_ftpm_tee
deleted file mode 100644
@@ -1,27 +0,0 @@
-# Copyright (c) Siemens AG, 2023
-#
-# Authors:
-# Su Bao Cheng <baocheng.su@siemens.com>
-#
-# SPDX-License-Identifier: MIT
-#
-
-inherit dpkg-raw
-
-SRC_URI += " \
- file://tee-ftpm.hook \
- file://tee-ftpm.script \
- "
-
-DEBIAN_DEPENDS = "initramfs-tools"
-
-do_install[cleandirs] += " \
- ${D}/usr/share/initramfs-tools/hooks \
- ${D}/usr/share/initramfs-tools/scripts/local-top"
-
-do_install() {
- install -m 0755 "${WORKDIR}/tee-ftpm.hook" \
- "${D}/usr/share/initramfs-tools/hooks/tee-ftpm"
- install -m 0755 "${WORKDIR}/tee-ftpm.script" \
- "${D}/usr/share/initramfs-tools/scripts/local-top/tee-ftpm"
-}
new file mode 100644
@@ -0,0 +1,15 @@
+# Copyright (c) Siemens AG, 2023-2024
+#
+# Authors:
+# Su Bao Cheng <baocheng.su@siemens.com>
+#
+# SPDX-License-Identifier: MIT
+#
+
+require recipes-initramfs/initramfs-hook/hook.inc
+
+SRC_URI += "file://local-top"
+
+HOOK_PREREQ = "tee-supplicant"
+HOOK_ADD_MODULES = "tpm_ftpm_tee"
+SCRIPT_PREREQ = "tee-supplicant"