From 86a0906902be2f5fc75f1f633bfaab06b626ed83 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Wed, 25 Dec 2019 14:59:31 +0200 Subject: Add: script to run v-i image under Qemu with UEFI --- README.md | 21 +++++++++++++++++++++ bootvm | 23 +++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100755 bootvm 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 \ + "$@" -- cgit v1.2.1