@ -4,7 +4,10 @@
{ options , config , lib , pkgs , . . . }:
with lib ;
with import ../../lib/qemu-flags.nix { inherit pkgs ; } ;
let
qemu-common = import ../../lib/qemu-common.nix { inherit lib pkgs ; } ;
in
{
@ -12,8 +15,8 @@ with import ../../lib/qemu-flags.nix { inherit pkgs; };
systemd . services . backdoor =
{ wantedBy = [ " m u l t i - u s e r . t a r g e t " ] ;
requires = [ " d e v - h v c 0 . d e v i c e " " d e v - ${ qemuSerialDevice } . d e v i c e " ] ;
after = [ " d e v - h v c 0 . d e v i c e " " d e v - ${ qemuSerialDevice } . d e v i c e " ] ;
requires = [ " d e v - h v c 0 . d e v i c e " " d e v - ${ qemu-common . qemu SerialDevice } . d e v i c e " ] ;
after = [ " d e v - h v c 0 . d e v i c e " " d e v - ${ qemu-common . qemu SerialDevice } . d e v i c e " ] ;
script =
''
export USER = root
@ -30,7 +33,7 @@ with import ../../lib/qemu-flags.nix { inherit pkgs; };
cd /tmp
exec < /dev/hvc0 > /dev/hvc0
while ! exec 2 > /dev / $ { qemuSerialDevice } ; do sleep 0 .1 ; done
while ! exec 2 > /dev / $ { qemu-common . qemu SerialDevice } ; do sleep 0 .1 ; done
echo " c o n n e c t i n g t o h o s t . . . " > & 2
stty - F /dev/hvc0 raw - echo # prevent nl -> cr/nl conversion
echo
@ -42,7 +45,7 @@ with import ../../lib/qemu-flags.nix { inherit pkgs; };
# Prevent agetty from being instantiated on the serial device, since it
# interferes with the backdoor (writes to it will randomly fail
# with EIO). Likewise for hvc0.
systemd . services . " s e r i a l - g e t t y @ ${ qemuSerialDevice } " . enable = false ;
systemd . services . " s e r i a l - g e t t y @ ${ qemu-common . qemu SerialDevice } " . enable = false ;
systemd . services . " s e r i a l - g e t t y @ h v c 0 " . enable = false ;
# Only set these settings when the options exist. Some tests (e.g. those
@ -57,7 +60,7 @@ with import ../../lib/qemu-flags.nix { inherit pkgs; };
# we avoid defining consoles if not possible.
# TODO: refactor such that test-instrumentation can import qemu-vm
# or declare virtualisation.qemu.console option in a module that's always imported
consoles = [ qemuSerialDevice ] ;
consoles = [ qemu-common . qemu SerialDevice ] ;
package = lib . mkDefault pkgs . qemu_test ;
} ;
} ;
@ -88,7 +91,7 @@ with import ../../lib/qemu-flags.nix { inherit pkgs; };
# Panic if an error occurs in stage 1 (rather than waiting for
# user intervention).
boot . kernelParams =
[ " c o n s o l e = ${ qemuSerialDevice } " " p a n i c = 1 " " b o o t . p a n i c _ o n _ f a i l " ] ;
[ " c o n s o l e = ${ qemu-common . qemu SerialDevice } " " p a n i c = 1 " " b o o t . p a n i c _ o n _ f a i l " ] ;
# `xwininfo' is used by the test driver to query open windows.
environment . systemPackages = [ pkgs . xorg . xwininfo ] ;