hooks: Enable TPMv2 emulation
Provide a QEMU helper script to launch swtpm and add extra parameters to conf.qemu_arm64_na and conf.qemu_arm_na to provide an emulated TPMv2. Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
committed by
Simon Glass
parent
a282d5d3f4
commit
43b3127f26
23
test/hooks/bin/qemu.swtpm
Executable file
23
test/hooks/bin/qemu.swtpm
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: BSD-2
|
||||
#
|
||||
# This script launches swtpm to emulate a TPMv2.
|
||||
#
|
||||
# The parameter -t makes it unload when the connection to QEMU is
|
||||
# terminated.
|
||||
#
|
||||
# To make use of it add
|
||||
#
|
||||
# qemu_helper_script="swtpm"
|
||||
#
|
||||
# to the board script and the following arguments to qemu_extra_args
|
||||
#
|
||||
# -chardev socket,id=chrtpm,path=/tmp/tpm/swtpm-sock \
|
||||
# -tpmdev emulator,id=tpm0,chardev=chrtpm \
|
||||
# -device tpm-tis-device,tpmdev=tpm0
|
||||
#
|
||||
# U-Boot must be built with CONFIG_TPM2_MMIO=y.
|
||||
|
||||
mkdir -p /tmp/tpm
|
||||
swtpm socket -d -t --tpmstate dir=/tmp/tpm --tpm2 \
|
||||
--ctrl type=unixio,path=/tmp/tpm/swtpm-sock
|
||||
@@ -22,8 +22,9 @@
|
||||
|
||||
console_impl=qemu
|
||||
qemu_machine="virt"
|
||||
qemu_helper_script="swtpm"
|
||||
qemu_binary="qemu-system-aarch64"
|
||||
qemu_extra_args="-cpu cortex-a57 -nographic -netdev user,id=net0,tftp=${UBOOT_TRAVIS_BUILD_DIR} -device e1000,netdev=net0 -device virtio-rng-pci"
|
||||
qemu_extra_args="-cpu cortex-a57 -nographic -netdev user,id=net0,tftp=${UBOOT_TRAVIS_BUILD_DIR} -device e1000,netdev=net0 -device virtio-rng-pci -chardev socket,id=chrtpm,path=/tmp/tpm/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis-device,tpmdev=tpm0"
|
||||
qemu_kernel_args="-bios ${U_BOOT_BUILD_DIR}/u-boot.bin"
|
||||
reset_impl=none
|
||||
flash_impl=none
|
||||
|
||||
@@ -22,8 +22,9 @@
|
||||
|
||||
console_impl=qemu
|
||||
qemu_machine="virt"
|
||||
qemu_helper_script="swtpm"
|
||||
qemu_binary="qemu-system-arm"
|
||||
qemu_extra_args="-nographic -netdev user,id=net0,tftp=${UBOOT_TRAVIS_BUILD_DIR} -device e1000,netdev=net0 -device virtio-rng-pci"
|
||||
qemu_extra_args="-nographic -netdev user,id=net0,tftp=${UBOOT_TRAVIS_BUILD_DIR} -device e1000,netdev=net0 -device virtio-rng-pci -chardev socket,id=chrtpm,path=/tmp/tpm/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis-device,tpmdev=tpm0"
|
||||
qemu_kernel_args="-bios ${U_BOOT_BUILD_DIR}/u-boot.bin"
|
||||
reset_impl=none
|
||||
flash_impl=none
|
||||
|
||||
Reference in New Issue
Block a user