diff options
| -rw-r--r-- | recipes-tpm/swtpm/swtpm-wrappers.bb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/recipes-tpm/swtpm/swtpm-wrappers.bb b/recipes-tpm/swtpm/swtpm-wrappers.bb new file mode 100644 index 0000000..676c35e --- /dev/null +++ b/recipes-tpm/swtpm/swtpm-wrappers.bb | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | SUMMARY = "SWTPM - OpenEmbedded wrapper scripts for native swtpm tools" | ||
| 2 | LICENSE = "MIT" | ||
| 3 | DEPENDS = "swtpm-native tpm-tools-native" | ||
| 4 | |||
| 5 | inherit native | ||
| 6 | |||
| 7 | # The whole point of the recipe is to make files available | ||
| 8 | # for use after the build is done, so don't clean up... | ||
| 9 | RM_WORK_EXCLUDE += "${PN}" | ||
| 10 | |||
| 11 | do_create_wrapper () { | ||
| 12 | cat >${WORKDIR}/swtpm_setup_oe.sh <<EOF | ||
| 13 | #! /bin/sh | ||
| 14 | # | ||
| 15 | # Wrapper around swtpm_setup.sh which adds parameters required to | ||
| 16 | # run the setup as non-root directly from the native sysroot. | ||
| 17 | |||
| 18 | PATH="${bindir}:${base_bindir}:${sbindir}:${base_sbindir}:\$PATH" | ||
| 19 | export PATH | ||
| 20 | |||
| 21 | # tcsd only allows to be run as root or tss. Pretend to be root... | ||
| 22 | exec env ${FAKEROOTENV} ${FAKEROOTCMD} swtpm_setup.sh --config ${STAGING_DIR_NATIVE}/etc/swtpm_setup.conf "\$@" | ||
| 23 | EOF | ||
| 24 | |||
| 25 | cat >${WORKDIR}/swtpm_cuse_oe.sh <<EOF | ||
| 26 | #! /bin/sh | ||
| 27 | # | ||
| 28 | # Wrapper around swtpm_cuse which makes it easier to invoke | ||
| 29 | # the right binary. Has to be run as root with TPM_PATH set | ||
| 30 | # to a directory initialized as virtual TPM by swtpm_setup_oe.sh. | ||
| 31 | |||
| 32 | PATH="${bindir}:${base_bindir}:${sbindir}:${base_sbindir}:\$PATH" | ||
| 33 | export PATH | ||
| 34 | |||
| 35 | exec swtpm_cuse "\$@" | ||
| 36 | EOF | ||
| 37 | |||
| 38 | chmod a+rx ${WORKDIR}/*.sh | ||
| 39 | } | ||
| 40 | |||
| 41 | addtask do_create_wrapper before do_build after do_prepare_recipe_sysroot | ||
