diff options
author | Lars Wirzenius <liw@liw.fi> | 2023-12-16 11:39:15 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2023-12-23 09:31:27 +0200 |
commit | de5d8d5fab64db3a96211cd0036902dc10248ef4 (patch) | |
tree | e18f2fbd1f0093eb71b021c35a32565c8e1a0dc0 | |
parent | c938e3defd64537d3a658330c517c97e4ffcc884 (diff) | |
download | ambient-build-vm-de5d8d5fab64db3a96211cd0036902dc10248ef4.tar.gz |
feat: add script to test that an image works at all
This is for debugging an image.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Sponsored-by: author
-rwxr-xr-x | try-boot.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/try-boot.sh b/try-boot.sh new file mode 100755 index 0000000..eef7b8a --- /dev/null +++ b/try-boot.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -euo pipefail + +img="$1" + +QVMF_FD="/usr/share/ovmf/OVMF.fd" + +tmp="$(mktemp -d)" +trap 'rm -rf "$tmp"' EXIT + +mkdir "$tmp/run-ci" +cat <<EOF >"$tmp/run-ci/run-ci" +echo xyzzy +EOF +chmod +x "$tmp/run-ci/run-ci" +tar -C "$tmp/run-ci" -cf "$tmp/run-ci.tar" . + +rm -f log0 log1 +cp "$QVMF_FD" "$tmp/vars" + +kvm \ + -m 1024 \ + -smp cpus=1 \ + -display none \ + -serial file:log0 \ + -serial file:log1 \ + -drive if=pflash,format=raw,unit=0,file="$tmp/vars" \ + -drive format=qcow2,if=virtio,file="$img" \ + -drive format=raw,if=virtio,file="$tmp/run-ci.tar",readonly=on \ + -nodefaults |