From 2075d987ce39e9934a8ce368935a22cb4ae5dc7e Mon Sep 17 00:00:00 2001 From: Elms Date: Tue, 23 Feb 2021 10:06:04 -0800 Subject: [PATCH] README: Add swtpm build instructions and links QEMU uses swtpm over unix socket, but it is currently not packaged so is built from source. --- README.md | 18 +++++++++++++++++- scripts/swtpm_sim.test | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f472f36..da17ffa 100644 --- a/README.md +++ b/README.md @@ -222,7 +222,23 @@ sudo adduser yourusername tss This demonstrates using wolfTPM in QEMU to communicate using the linux kernel device "/dev/tpmX". You will need to install or build -[swtpm](https://github.com/stefanberger/swtpm). +[swtpm](https://github.com/stefanberger/swtpm). Below are a short +method to build. You may need to consult the instructions for +[libtpms](https://github.com/stefanberger/libtpms/wiki#compile-and-install-on-linux) +and +[swtpm](https://github.com/stefanberger/swtpm/wiki#compile-and-install-on-linux) + +``` +PREFIX=$PWD/inst +git clone git@github.com:stefanberger/libtpms.git +cd libtpms/ +./autogen.sh --with-openssl --with-tpm2 --prefix=$PREFIX && make install +cd .. +git clone git@github.com:stefanberger/swtpm.git +cd swtpm +PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig/ ./autogen.sh --with-openssl --with-tpm2 --prefix=$PREFIX && make install +cd .. +``` You can setup a basic linux installation. Other installation bases can be used. This step will take some time to install the base linux diff --git a/scripts/swtpm_sim.test b/scripts/swtpm_sim.test index 4d4e556..3ee5a1c 100755 --- a/scripts/swtpm_sim.test +++ b/scripts/swtpm_sim.test @@ -11,6 +11,7 @@ TOP_DIR=$(realpath $(dirname $0)/..) die() { echo $* >&2 + ps $swtpm_pid > /dev/null && kill $swtpm_pid exit 1 }