Skip to content

Instantly share code, notes, and snippets.



Last active Oct 12, 2020
What would you like to do?
swtpm / libtpms notes

swtpm notes

Info on how to build/use swtpm and libtpms. Pretty good doc at swtpm wiki.


libtpms and swtpm seem to be working their way into debian/ubuntu.

build / upload

This is how I built libtpms and swtpm for my ppa at ppa:smoser/swtpm.

Probably should set up a daily build or something. But for now, this will work.

Note that swtpm depends on libtpms, so you can't easily just build them both without adding libtpms to be accessible.

To build for ppa:

notnative() {
    # these are not native, but debian/source/fromat says so
    local dsf="debian/source/format"
    grep -q "native" "$dsf" || return 0
    echo "3.0 (quilt)" > "$dsf" 
    git commit -m "not native package" "$dsf"

setrel() {
    local rel="$1"
    sed -i "1s/\([^ ]\+\) \([^ ]\+\) \([^;]\+\);/\1 \2 $rel;/g" debian/changelog

wget -O libtpms_${libtpmsv}.orig.tar.gz \${libtpmsv}.tar.gz

# build libtpms
git clone
cd libtpms
git checkout v${libtpmsv}
setrel focal

debuild -S -nc 
dput $PPA ../libtpms_${libtpmsv}-1_source.changes

cd ..

# build swtpm
wget -O swtpm_${swtpmv}.orig.tar.gz \${swtpmv}.tar.gz
git clone
cd swtpm
git checkout v${swtpmv}
setrel focal

debuild -S -nc
dput $PPA ../libtpms_${libtpmsv}-1_source.changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment