Skip to content

Support virtualized TPM attachments to qemu VMS, plus refactor.#336

Draft
amstewart wants to merge 4 commits intoni:nilrt/master/scarthgapfrom
amstewart:dev/scarthgap/clevis
Draft

Support virtualized TPM attachments to qemu VMS, plus refactor.#336
amstewart wants to merge 4 commits intoni:nilrt/master/scarthgapfrom
amstewart:dev/scarthgap/clevis

Conversation

@amstewart
Copy link
Contributor

@amstewart amstewart commented Mar 2, 2026

Changes

  1. Fix a warning from QEMU about using an old syntax for marking a QEMU drive as read-only.
  2. Add a new option to the linux start-vm script (-t). When asserted, the script will create, initialize, and attach a virtualized TPM2.0 device to the VM using the swtpm distro package on the host machine.
  3. Refactor the QEMU VM creation process. Instead of using a build.vms.sh bash script, use a Makefile - where the logic is easeier to parse.
    • Also, use the ovmf recipe in OE-core to build the UEFI firmware, instead of using a static copy from somewhere.

Testing

  • Built VMs with the new Makefile and tested with them manually.

Process

Suggested Reviewers:

  • @ni/rtos

Alex Stewart added 4 commits March 2, 2026 15:53
QEMU throws an error when executing the start script like ...

```
qemu-system-x86_64: -drive if=pflash,format=raw,readonly,file=./OVMF/OVMF_CODE.fd: warning: short-form boolean option 'readonly' deprecated
Please use readonly=on instead
```

Use the new option syntax to satisfy the warning.

Signed-off-by: Alex Stewart <alex.stewart@emerson.com>
(cherry picked from commit 20c513a)
Signed-off-by: Alex Stewart <alex.stewart@emerson.com>
Using the swtpm package, linux users can emulate a TPM device - which is
useful when testing Secure Boot and NI Device Encryption workflows
locally.

Add a `-t` option to the QEMU start script that creates and attaches a
software TPM to the VM.

Signed-off-by: Alex Stewart <alex.stewart@emerson.com>
(cherry picked from commit e38c6f2)
Signed-off-by: Alex Stewart <alex.stewart@emerson.com>
The build.vms.sh pipeline script and associated vm-resources are
somewhat difficult to comprehend and also use a statically built OVMF
UEFI BIOS. In order to support TPM-based secure-boot/measured-boot
testing, we should use the OVMF output from OE. While we're here,
refactor the build.vms tooling to use a Makefile in a directory called
`qemu`, which is hopefully a little easier to maintain.

Signed-off-by: Alex Stewart <alex.stewart@emerson.com>
(cherry picked from commit d8f2efc)
Signed-off-by: Alex Stewart <alex.stewart@emerson.com>
Docker issues two warnings with the current Dockerfile.

1. Warns that the PYREX_IMAGE arg can have a blank value, resulting in
   an invalid Dockerfile. This is mostly fine, but change to let it use
   `pyrex-base` as a default, so that docker will stop complaining.
2. Warns that 'FROM' and 'as' on line 2 use different casing. So make
   them both uppercase.

Signed-off-by: Alex Stewart <alex.stewart@emerson.com>
(cherry picked from commit 0f6e0cc)
Signed-off-by: Alex Stewart <alex.stewart@emerson.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant