Skip to content

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

Draft
amstewart wants to merge 3 commits intoni:nilrt/master/scarthgapfrom
amstewart:dev/vms
Draft

Support virtualized TPM attachments to qemu VMS, plus refactor.#335
amstewart wants to merge 3 commits intoni:nilrt/master/scarthgapfrom
amstewart:dev/vms

Conversation

@amstewart
Copy link
Contributor

@amstewart amstewart commented Feb 3, 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 3 commits January 12, 2026 15:25
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>
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>
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>
@amstewart
Copy link
Contributor Author

This PR will break the AZDO build pipeline after it gets merged, because the VM artifacts will be created in a different location - though they are otherwise the same. I'll put in a change to the component Makefiles to account for this.

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