summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-04-20 07:28:31 +0000
committerAlyssa Ross <hi@alyssa.is>2022-04-20 07:29:31 +0000
commit969842dd0b86922383b3b5e030650ad85da0e3a7 (patch)
tree623405d12441a6c6ddf874809ba72ec3bd3b4975
parent4bf9f99dc3bb5e7a99060301dc4c2629db53b4b8 (diff)
downloadspectrum-969842dd0b86922383b3b5e030650ad85da0e3a7.tar
spectrum-969842dd0b86922383b3b5e030650ad85da0e3a7.tar.gz
spectrum-969842dd0b86922383b3b5e030650ad85da0e3a7.tar.bz2
spectrum-969842dd0b86922383b3b5e030650ad85da0e3a7.tar.lz
spectrum-969842dd0b86922383b3b5e030650ad85da0e3a7.tar.xz
spectrum-969842dd0b86922383b3b5e030650ad85da0e3a7.tar.zst
spectrum-969842dd0b86922383b3b5e030650ad85da0e3a7.zip
Use QEMU's built-in edk2 binaries
This saves the need to build OVMF separately, which has quite a long
dependency chain.
-rw-r--r--img/combined/run-vm.nix2
-rw-r--r--img/installer/run-vm.nix4
-rw-r--r--img/live/Makefile2
-rw-r--r--img/live/shell.nix2
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";
 })