summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2019-12-25 14:59:31 +0200
committerLars Wirzenius <liw@liw.fi>2020-02-29 10:48:03 +0200
commit86a0906902be2f5fc75f1f633bfaab06b626ed83 (patch)
treeb2cdcc6804374e810514d01088faff3a09341e1a
parente2762720881ff3cfc91bf25605df0f3afcb3dccd (diff)
downloadv-i-86a0906902be2f5fc75f1f633bfaab06b626ed83.tar.gz
Add: script to run v-i image under Qemu with UEFI
-rw-r--r--README.md21
-rwxr-xr-xbootvm23
2 files changed, 44 insertions, 0 deletions
diff --git a/README.md b/README.md
index ad8ab48..7ed4641 100644
--- a/README.md
+++ b/README.md
@@ -77,6 +77,15 @@ To write the resulting v-i.img to a USB drive:
sudo dd if=v-i.img of=/dev/path/to/usb/drive/device status=progress oflag=direct
~~~
+Alternatively, use bmaptool (from bmap-tools), which does the same
+thing as dd but skips holes in sparse files, so it's more efficient
+for disk images:
+
+~~~sh
+bmaptool create v-i.img > v-i.bmap
+sudo bmaptool copy v-i.img /dev/path/to/usb/drive/device
+~~~
+
Plug in the USB drive to the laptop, boot off that. Log into the
installer as root (no password), and run
@@ -87,3 +96,15 @@ installer as root (no password), and run
Reboot laptop from its hard drive and you should have a bare bones
Debian system installed.
+
+Virtual test envionment
+-----------------------------------------------------------------------------
+
+You probably want to test with virtual machines instead of real
+hardware, for convenience.
+
+~~~sh
+apt install qemu-system
+qemu-img create ~/tmp/main.img 10G
+./bootvm ~/tmp/main.img 10G v-i.img
+~~~
diff --git a/bootvm b/bootvm
new file mode 100755
index 0000000..e2ffb5e
--- /dev/null
+++ b/bootvm
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# Based on: https://wiki.debian.org/SecureBoot/VirtualMachine
+
+set -eu
+
+main="$1"
+vi="$2"
+shift 2
+
+if ! [ -e OVFM_VARS.fd ]
+then
+ cp /usr/share/OVMF/OVMF_VARS.fd .
+fi
+
+kvm \
+ -m 2048 \
+ --machine pc-q35-2.5 \
+ -drive if=pflash,format=raw,readonly,file=/usr/share/OVMF/OVMF_CODE.fd \
+ -drive if=pflash,format=raw,file=./OVMF_VARS.fd \
+ -drive file="$vi",format=raw,index=0,media=disk \
+ -drive file="$main",format=raw,index=1,media=disk \
+ "$@"