nixos/qemu-vm: add option to use a non-standard BIOS

I'd like to change the default on x86 platforms to qboot at some point, since it
saves a fair bit of startup time.
gstqt5
Jamie McClymont 2020-05-22 15:15:32 +12:00
parent 2defee2981
commit 55912f3535
4 changed files with 32 additions and 1 deletions

View File

@ -441,6 +441,18 @@ in
'';
};
virtualisation.bios =
mkOption {
default = null;
type = types.nullOr types.package;
description =
''
An alternate BIOS (such as <package>qboot</package>) with which to start the VM.
Should containin a file named <literal>bios.bin</literal>.
If <literal>null</literal>, QEMU's builtin SeaBIOS will be used.
'';
};
};
config = {
@ -521,6 +533,9 @@ in
(mkIf cfg.useEFIBoot [
"-pflash $TMPDIR/bios.bin"
])
(mkIf (cfg.bios != null) [
"-bios ${cfg.bios}/bios.bin"
])
(mkIf (!cfg.graphics) [
"-nographic"
])

View File

@ -273,6 +273,7 @@ in
prosody = handleTest ./xmpp/prosody.nix {};
prosodyMysql = handleTest ./xmpp/prosody-mysql.nix {};
proxy = handleTest ./proxy.nix {};
qboot = handleTestOn ["x86_64-linux" "i686-linux"] ./qboot.nix {};
quagga = handleTest ./quagga.nix {};
quorum = handleTest ./quorum.nix {};
rabbitmq = handleTest ./rabbitmq.nix {};

13
nixos/tests/qboot.nix Normal file
View File

@ -0,0 +1,13 @@
import ./make-test-python.nix ({ pkgs, ...} : {
name = "qboot";
machine = { ... }: {
virtualisation.bios = pkgs.qboot;
};
testScript =
''
start_all()
machine.wait_for_unit("multi-user.target")
'';
})

View File

@ -1,4 +1,4 @@
{ stdenv, meson, ninja, fetchFromGitHub }:
{ stdenv, meson, ninja, fetchFromGitHub, nixosTests }:
stdenv.mkDerivation {
name = "qboot-20200423";
@ -19,6 +19,8 @@ stdenv.mkDerivation {
hardeningDisable = [ "stackprotector" "pic" ];
passthru.tests = { qboot = nixosTests.qboot; };
meta = {
description = "A simple x86 firmware for booting Linux";
homepage = "https://github.com/bonzini/qboot";