diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2018-02-01 09:34:41 +0100 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2018-02-01 09:36:23 +0100 |
commit | 2fb4606f38deefa76da5d853645739f2faa315de (patch) | |
tree | de1003a2a8487fe792903ac3e295292d15608b3e /nixos/modules/testing | |
parent | f0048025807b7f451a295e7b009c58e0c2282d70 (diff) | |
parent | be4c6311f3bc808cacff94e5e11240a7c37cbf9c (diff) | |
download | nixlib-2fb4606f38deefa76da5d853645739f2faa315de.tar nixlib-2fb4606f38deefa76da5d853645739f2faa315de.tar.gz nixlib-2fb4606f38deefa76da5d853645739f2faa315de.tar.bz2 nixlib-2fb4606f38deefa76da5d853645739f2faa315de.tar.lz nixlib-2fb4606f38deefa76da5d853645739f2faa315de.tar.xz nixlib-2fb4606f38deefa76da5d853645739f2faa315de.tar.zst nixlib-2fb4606f38deefa76da5d853645739f2faa315de.zip |
Merge branch 'master' into staging
Haskell rebuild. Hydra: ?compare=1430378
Diffstat (limited to 'nixos/modules/testing')
-rw-r--r-- | nixos/modules/testing/test-instrumentation.nix | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/nixos/modules/testing/test-instrumentation.nix b/nixos/modules/testing/test-instrumentation.nix index 9b4136223c0f..41dec2af9ed4 100644 --- a/nixos/modules/testing/test-instrumentation.nix +++ b/nixos/modules/testing/test-instrumentation.nix @@ -4,13 +4,10 @@ { config, lib, pkgs, ... }: with lib; +with import ../../lib/qemu-flags.nix { inherit pkgs; }; let kernel = config.boot.kernelPackages.kernel; - # FIXME: figure out a common place for this instead of copy pasting - serialDevice = if pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64 then "ttyS0" - else if pkgs.stdenv.isArm || pkgs.stdenv.isAarch64 then "ttyAMA0" - else throw "Unknown QEMU serial device for system '${pkgs.stdenv.system}'"; in { @@ -28,8 +25,8 @@ in systemd.services.backdoor = { wantedBy = [ "multi-user.target" ]; - requires = [ "dev-hvc0.device" "dev-${serialDevice}.device" ]; - after = [ "dev-hvc0.device" "dev-${serialDevice}.device" ]; + requires = [ "dev-hvc0.device" "dev-${qemuSerialDevice}.device" ]; + after = [ "dev-hvc0.device" "dev-${qemuSerialDevice}.device" ]; script = '' export USER=root @@ -46,7 +43,7 @@ in cd /tmp exec < /dev/hvc0 > /dev/hvc0 - while ! exec 2> /dev/${serialDevice}; do sleep 0.1; done + while ! exec 2> /dev/${qemuSerialDevice}; do sleep 0.1; done echo "connecting to host..." >&2 stty -F /dev/hvc0 raw -echo # prevent nl -> cr/nl conversion echo @@ -55,10 +52,10 @@ in serviceConfig.KillSignal = "SIGHUP"; }; - # Prevent agetty from being instantiated on ${serialDevice}, since it - # interferes with the backdoor (writes to ${serialDevice} will randomly fail + # 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."serial-getty@${serialDevice}".enable = false; + systemd.services."serial-getty@${qemuSerialDevice}".enable = false; systemd.services."serial-getty@hvc0".enable = false; boot.initrd.preDeviceCommands = @@ -94,7 +91,7 @@ in # Panic if an error occurs in stage 1 (rather than waiting for # user intervention). boot.kernelParams = - [ "console=${serialDevice}" "panic=1" "boot.panic_on_fail" ]; + [ "console=${qemuSerialDevice}" "panic=1" "boot.panic_on_fail" ]; # `xwininfo' is used by the test driver to query open windows. environment.systemPackages = [ pkgs.xorg.xwininfo ]; |