From 969842dd0b86922383b3b5e030650ad85da0e3a7 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Wed, 20 Apr 2022 07:28:31 +0000 Subject: Use QEMU's built-in edk2 binaries This saves the need to build OVMF separately, which has quite a long dependency chain. --- img/combined/run-vm.nix | 2 +- img/installer/run-vm.nix | 4 ++-- img/live/Makefile | 2 +- img/live/shell.nix | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/img/combined/run-vm.nix b/img/combined/run-vm.nix index e3419b2..893bc7d 100644 --- a/img/combined/run-vm.nix +++ b/img/combined/run-vm.nix @@ -16,9 +16,9 @@ writeShellScript "run-spectrum-installer-vm.sh" '' exec qemu-kvm -cpu host -m 4G -machine q35 -snapshot \ -display gtk,gl=on \ -device virtio-vga-gl \ - -bios ${OVMF.fd}/FV/OVMF.fd \ -device qemu-xhci \ -device usb-storage,drive=drive1,removable=true \ + -drive file=${qemu_kvm}/share/qemu/edk2-${stdenv.hostPlatform.qemuArch}-code.fd,format=raw,if=pflash,readonly=true \ -drive file=${image},id=drive1,format=raw,if=none,readonly=true \ -drive file=/proc/self/fd/3,format=raw,if=virtio '' diff --git a/img/installer/run-vm.nix b/img/installer/run-vm.nix index c39c5b6..ac6e928 100644 --- a/img/installer/run-vm.nix +++ b/img/installer/run-vm.nix @@ -5,7 +5,7 @@ let inherit (builtins) storeDir; - inherit (pkgs) OVMF coreutils qemu_kvm writeShellScript; + inherit (pkgs) coreutils qemu_kvm writeShellScript; inherit (pkgs.lib) makeBinPath escapeShellArg; eosimages = import ../combined/eosimages.nix { inherit pkgs; }; @@ -36,9 +36,9 @@ writeShellScript "run-spectrum-installer-vm.sh" '' -display gtk,gl=on \ -device virtio-vga-gl \ -virtfs local,mount_tag=store,path=/nix/store,security_model=none,readonly=true \ + -drive file=${qemu_kvm}/share/qemu/edk2-${stdenv.hostPlatform.qemuArch}-code.fd,format=raw,if=pflash,readonly=true \ -drive file=${eosimages},format=raw,if=virtio,readonly=true \ -drive file=/proc/self/fd/3,format=raw,if=virtio \ - -bios ${OVMF.fd}/FV/OVMF.fd \ -kernel ${installer.kernel} \ -initrd ${installer.initramfs} \ -append ${escapeShellArg installer.kernelParams} diff --git a/img/live/Makefile b/img/live/Makefile index 319895a..8f47028 100644 --- a/img/live/Makefile +++ b/img/live/Makefile @@ -61,11 +61,11 @@ clean: run: build/live.img $(QEMU_KVM) -m 4G \ - -bios $(OVMF_FD) \ -cpu host \ -display gtk,gl=on \ -device virtio-vga-gl \ -device qemu-xhci \ -device usb-storage,drive=drive1,removable=true \ + -drive file=$(OVMF_CODE),format=raw,if=pflash,readonly=true \ -drive file=build/live.img,id=drive1,format=raw,if=none,readonly=true .PHONY: run diff --git a/img/live/shell.nix b/img/live/shell.nix index f602c2a..b9f0246 100644 --- a/img/live/shell.nix +++ b/img/live/shell.nix @@ -8,5 +8,5 @@ with pkgs; (import ./. { inherit pkgs; }).overrideAttrs ({ nativeBuildInputs ? [], ... }: { nativeBuildInputs = nativeBuildInputs ++ [ qemu_kvm ]; - OVMF_FD = "${OVMF.fd}/FV/OVMF.fd"; + OVMF_CODE = "${qemu_kvm}/share/qemu/edk2-${stdenv.hostPlatform.qemuArch}-code.fd"; }) -- cgit 1.4.1