diff --git a/nixos/modules/virtualisation/libvirtd.nix b/nixos/modules/virtualisation/libvirtd.nix index 58581eed74a1..10a38b99f871 100644 --- a/nixos/modules/virtualisation/libvirtd.nix +++ b/nixos/modules/virtualisation/libvirtd.nix @@ -15,7 +15,7 @@ let ''; qemuConfigFile = pkgs.writeText "qemu.conf" '' ${optionalString cfg.qemuOvmf '' - nvram = ["${pkgs.OVMF}/FV/OVMF_CODE.fd:${pkgs.OVMF}/FV/OVMF_VARS.fd"] + nvram = ["${pkgs.OVMF.fd}/FV/OVMF_CODE.fd:${pkgs.OVMF.fd}/FV/OVMF_VARS.fd"] ''} ${cfg.qemuVerbatimConfig} ''; diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index c75edfcd8cf6..a17e2c9ca471 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -126,7 +126,7 @@ let bootFlash=$out/bios.bin ${qemu}/bin/qemu-img create -f qcow2 $diskImage "40M" ${if cfg.useEFIBoot then '' - cp ${pkgs.OVMF-CSM}/FV/OVMF.fd $bootFlash + cp ${pkgs.OVMF-CSM.fd}/FV/OVMF.fd $bootFlash chmod 0644 $bootFlash '' else '' ''} diff --git a/nixos/tests/boot.nix b/nixos/tests/boot.nix index 3ea0df65c8b5..69ab4755e444 100644 --- a/nixos/tests/boot.nix +++ b/nixos/tests/boot.nix @@ -40,12 +40,12 @@ in { uefiCdrom = makeBootTest "uefi-cdrom" '' cdrom => glob("${iso}/iso/*.iso"), - bios => '${pkgs.OVMF}/FV/OVMF.fd' + bios => '${pkgs.OVMF.fd}/FV/OVMF.fd' ''; uefiUsb = makeBootTest "uefi-usb" '' usb => glob("${iso}/iso/*.iso"), - bios => '${pkgs.OVMF}/FV/OVMF.fd' + bios => '${pkgs.OVMF.fd}/FV/OVMF.fd' ''; netboot = let diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix index 3ab3c1bac48a..6dce6f407cda 100644 --- a/nixos/tests/installer.nix +++ b/nixos/tests/installer.nix @@ -63,7 +63,7 @@ let (if system == "x86_64-linux" then "-m 768 " else "-m 512 ") + (optionalString (system == "x86_64-linux") "-cpu kvm64 "); hdFlags = ''hda => "vm-state-machine/machine.qcow2", hdaInterface => "${iface}", '' - + optionalString (bootLoader == "systemd-boot") ''bios => "${pkgs.OVMF}/FV/OVMF.fd", ''; + + optionalString (bootLoader == "systemd-boot") ''bios => "${pkgs.OVMF.fd}/FV/OVMF.fd", ''; in '' $machine->start; diff --git a/pkgs/applications/virtualization/OVMF/default.nix b/pkgs/applications/virtualization/OVMF/default.nix index 608ae594a2e9..4f7ea37ca18b 100644 --- a/pkgs/applications/virtualization/OVMF/default.nix +++ b/pkgs/applications/virtualization/OVMF/default.nix @@ -15,6 +15,8 @@ in stdenv.mkDerivation (edk2.setup "OvmfPkg/OvmfPkg${targetArch}.dsc" { name = "OVMF-${version}"; + outputs = [ "out" "fd" ]; + # TODO: properly include openssl for secureBoot buildInputs = [nasm iasl] ++ stdenv.lib.optionals (secureBoot == true) [ openssl ]; @@ -48,6 +50,13 @@ stdenv.mkDerivation (edk2.setup "OvmfPkg/OvmfPkg${targetArch}.dsc" { build -D CSM_ENABLE -D FD_SIZE_2MB ${if secureBoot then "-DSECURE_BOOT_ENABLE=TRUE" else ""} ''; + postFixup = '' + mkdir -p $fd/FV + mv $out/FV/OVMF{,_CODE,_VARS}.fd $fd/FV + ''; + + dontPatchELF = true; + meta = { description = "Sample UEFI firmware for QEMU and KVM"; homepage = http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF; diff --git a/pkgs/applications/virtualization/xen/4.5.nix b/pkgs/applications/virtualization/xen/4.5.nix index 754f800afada..3fbdee981c45 100644 --- a/pkgs/applications/virtualization/xen/4.5.nix +++ b/pkgs/applications/virtualization/xen/4.5.nix @@ -167,7 +167,7 @@ callPackage (import ./generic.nix (rec { ++ optional (withSeabios) "--with-system-seabios=${seabios}" ++ optional (!withInternalSeabios && !withSeabios) "--disable-seabios" - ++ optional (withOVMF) "--with-system-ovmf=${OVMF}" + ++ optional (withOVMF) "--with-system-ovmf=${OVMF.fd}/FV/OVMF.fd" ++ optional (withInternalOVMF) "--enable-ovmf"; patches =