Skip to content

Instantly share code, notes, and snippets.

@inclyc
Created September 9, 2023 10:20
Show Gist options
  • Save inclyc/7bc9c682b386af5d0f108d41f056c7e0 to your computer and use it in GitHub Desktop.
Save inclyc/7bc9c682b386af5d0f108d41f056c7e0 to your computer and use it in GitHub Desktop.
TPM for QEMU, command line
# TPM
TPMSTATE=${TPMSTATE:-"$XDG_RUNTIME_DIR/tpm0"}
mkdir -p $TPMSTATE
TPMCMD=(
swtpm
socket
-d
--tpmstate dir=$TPMSTATE,mode=0600
--tpm2
--ctrl type=unixio,path=${TPMSTATE}/swtpm-sock
--pid file=${TPMSTATE}/swtpm-pid
--log level=20,file=${TPMSTATE}/swtpm.log
)
"${TPMCMD[@]}"
cmd+=(
-chardev socket,id=chrtpm,path=${TPMSTATE}/swtpm-sock
-tpmdev emulator,id=tpm0,chardev=chrtpm
-device tpm-tis,tpmdev=tpm0
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment