-
Notifications
You must be signed in to change notification settings - Fork 86
[next] Support virtualized TPM attachments to qemu VMS, plus refactor. #346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
chaitu236
merged 11 commits into
ni:nilrt/master/next
from
amstewart:feat/next/device-encryption
Jun 16, 2026
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
38f4440
runQemuVM.sh: use newer -drive opt syntax
87b69c5
runQemuVM.sh: add TPM emulation capabilities
2208e7b
scripts: refactor build.vms as a Makefile
9f02ddf
build-nilrt.Dockerfile: fix docker warnings
03da9e7
qemu: disable parallel make execution
jpautler c495fb6
qemu: fix ovmf grouped target rule to use explicit targets
jpautler d519ab0
qemu: force ovmf redeploy to recover from stale deploy directory
jpautler 6e89a95
qemu: detect KVM support inside the pyrex container
jpautler 8c4545b
qemu: restructure build outputs under bbdir
jpautler 04faf92
qemu: fix bbdeploy path to use tmp-glibc build directory
jpautler 8772acd
pipelines: run qemu-img within pyrex
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Makefile objects | ||
| nilrt-x64-qemu/ | ||
| nilrt-x64-qemu.zip | ||
| **/*.iso | ||
| **/*.qcow2 | ||
| **/*.img | ||
| **/*.fd | ||
| **/*.zip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
|
|
||
| .DEFAULT_GOAL := all | ||
| .DELETE_ON_ERROR: | ||
| .NOTPARALLEL: | ||
|
|
||
| # CUSTOMIZABLE PARAMETERS | ||
| DISK_SIZE_MB ?= 4096 | ||
| MEMORY_MB ?= 1024 | ||
| VM_NAME ?= nilrt-x64-qemu | ||
| PRIMARY_DISK = $(VM_NAME).qcow2 | ||
|
|
||
| # DIRECTORIES | ||
| bbdir ?= ../../../build | ||
| bbdeploy = $(bbdir)/tmp-glibc/deploy/images/x64 | ||
| builddir_tmp = $(bbdir)/$(VM_NAME)-tmp | ||
| builddir_zip_contents = $(builddir_tmp)/$(VM_NAME) | ||
|
|
||
| # BINARIES | ||
| BITBAKE ?= $(PYREX_RUN) bitbake | ||
| GENISOIMAGE ?= $(PYREX_RUN) genisoimage | ||
| PYREX_RUN ?= pyrex-run | ||
| QEMU_SYSTEM_X86_64 ?= $(PYREX_RUN) qemu-system-x86_64 | ||
| ZIP ?= zip | ||
|
|
||
|
|
||
| # ============================================================================== | ||
| # REAL TARGETS | ||
| # ============================================================================== | ||
|
|
||
| $(builddir_tmp)/ni_provisioning.answers : ni_provisioning.answers | ||
| mkdir -p $(@D) | ||
| cp $< $@ | ||
| chmod 0644 "$@" | ||
|
|
||
|
|
||
| $(builddir_tmp)/ni_provisioning.answers.iso : $(builddir_tmp)/ni_provisioning.answers | ||
| $(GENISOIMAGE) -quiet \ | ||
| -input-charset utf-8 \ | ||
| -full-iso9660-filenames \ | ||
| -o "$@" \ | ||
| "$<" | ||
| chmod 0644 "$@" | ||
|
|
||
|
|
||
| $(bbdeploy)/ovmf.code.fd $(bbdeploy)/ovmf.vars.fd &: | ||
| $(BITBAKE) -C deploy ovmf | ||
|
|
||
|
|
||
| $(builddir_zip_contents)/OVMF/%.fd : $(bbdeploy)/%.fd | ||
| mkdir -p $(@D) | ||
| cp $< $@ | ||
|
|
||
|
|
||
| $(builddir_zip_contents)/start-vm.% : start-vm.%.in | ||
| mkdir -p $(@D) | ||
| install -c $< $@ | ||
| sed -i "s%\$${PRIMARY_DISK}%$(PRIMARY_DISK)%g" "$@" | ||
| sed -i "s%\$${VM_MEM_SIZE_MB}%$(MEMORY_MB)%g" "$@" | ||
|
|
||
|
|
||
| recovery_iso = $(bbdeploy)/nilrt-recovery-media-x64.iso | ||
| $(recovery_iso) : | ||
| $(BITBAKE) nilrt-recovery-media | ||
|
|
||
|
|
||
| primary_disk_path = $(builddir_zip_contents)/$(PRIMARY_DISK) | ||
| vmdeps = \ | ||
| $(builddir_tmp)/ni_provisioning.answers \ | ||
| $(builddir_zip_contents)/OVMF/ovmf.code.fd \ | ||
| $(builddir_zip_contents)/OVMF/ovmf.vars.fd \ | ||
| $(builddir_zip_contents)/start-vm.bat \ | ||
| $(builddir_zip_contents)/start-vm.sh \ | ||
| $(recovery_iso) \ | ||
| $(builddir_tmp)/ni_provisioning.answers.iso | ||
| $(primary_disk_path) : $(vmdeps) | ||
| rm -f "$@" | ||
| $(PYREX_RUN) qemu-img create -f qcow2 "$@" "$(DISK_SIZE_MB)""M" | ||
| chmod 0644 "$@" | ||
| $(QEMU_SYSTEM_X86_64) \ | ||
| $$($(PYREX_RUN) sh -c "test -w /dev/kvm 2>/dev/null && echo -enable-kvm") \ | ||
| -cpu Nehalem,check=false \ | ||
| -smp cpus=1 \ | ||
| -m $(MEMORY_MB) \ | ||
| -nographic \ | ||
| -drive if=pflash,format=raw,readonly=on,file="$(builddir_zip_contents)/OVMF/ovmf.code.fd" \ | ||
| -drive if=pflash,format=raw,file="$(builddir_zip_contents)/OVMF/ovmf.vars.fd" \ | ||
| -drive file="$(primary_disk_path)",media=disk,index=0 \ | ||
| -drive file="$(recovery_iso)",media=cdrom,readonly=on,index=1 \ | ||
| -drive file="$(builddir_tmp)/ni_provisioning.answers.iso",media=cdrom,readonly=on,index=2 | ||
|
|
||
|
|
||
| $(bbdir)/$(VM_NAME).zip : $(primary_disk_path) $(vmdeps) $(recovery_iso) | ||
| rm -f "$@" | ||
| (cd "$(builddir_zip_contents)/.." && $(ZIP) --quiet --recurse-paths "$(abspath $@)" "$(notdir $(builddir_zip_contents))") | ||
| chmod 0644 "$@" | ||
|
|
||
|
|
||
|
|
||
| # ============================================================================== | ||
| # PHONY TARGETS | ||
| # ============================================================================== | ||
|
|
||
| all : $(bbdir)/$(VM_NAME).zip | ||
| .PHONY : all | ||
|
|
||
|
|
||
| clean : | ||
| rm -rf $(builddir_zip_contents) | ||
| rm -f $(bbdir)/$(VM_NAME).zip | ||
| rm -rf $(builddir_tmp) | ||
| .PHONY : clean | ||
|
|
||
|
|
||
| help : | ||
| @echo "NILRT VM Resources Makefile" | ||
| @echo "============================" | ||
| @echo "" | ||
| @echo "PURPOSE:" | ||
| @echo " This Makefile builds a QEMU VM package for testing NILRT images." | ||
| @echo " It creates a bootable VM with OVMF UEFI firmware, a primary disk," | ||
| @echo " and the NILRT recovery media pre-configured." | ||
| @echo "" | ||
| @echo "PREREQUISITES:" | ||
| @echo " You must source the ni-oe-init-build-env script from the project root" | ||
| @echo " before running this Makefile:" | ||
| @echo " $$ source ../../../ni-oe-init-build-env" | ||
| @echo "" | ||
| @echo "CUSTOMIZABLE PARAMETERS:" | ||
| @echo " DISK_SIZE_MB Size of the VM disk in megabytes (default: 4096)" | ||
| @echo " MEMORY_MB VM memory size in megabytes (default: 1024)" | ||
| @echo " VM_NAME Name of the VM directory and zip file (default: nilrt-x64-qemu)" | ||
| @echo " PRIMARY_DISK Name of the primary disk image (default: nilrt-x64-qemu.qcow2)" | ||
| @echo "" | ||
| @echo "USAGE:" | ||
| @echo " make Build the VM package (creates $(VM_NAME).zip)" | ||
| @echo " make clean Remove all generated files" | ||
| @echo " make help Display this help message" | ||
| @echo "" | ||
| @echo "EXAMPLE:" | ||
| @echo " $$ make DISK_SIZE_MB=8192 MEMORY_MB=2048" | ||
| @echo "" | ||
| .PHONY : help |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.