From e56da6a4642c843d7ba88f513840da7d473eecec Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Fri, 24 Nov 2017 14:31:50 +0200 Subject: nixos/qemu-vm: Use different serial port on ARM/AArch64 --- nixos/modules/virtualisation/qemu-vm.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'nixos/modules/virtualisation/qemu-vm.nix') diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index 3f10180cd1c..770e5fb848a 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -21,6 +21,11 @@ let "aarch64-linux" = "${qemu}/bin/qemu-system-aarch64 -enable-kvm -machine virt -cpu host"; }.${pkgs.stdenv.system}; + # 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}'"; + vmName = if config.networking.hostName == "" then "noname" @@ -29,7 +34,7 @@ let cfg = config.virtualisation; qemuGraphics = if cfg.graphics then "" else "-nographic"; - kernelConsole = if cfg.graphics then "" else "console=ttyS0"; + kernelConsole = if cfg.graphics then "" else "console=${serialDevice}"; ttys = [ "tty1" "tty2" "tty3" "tty4" "tty5" "tty6" ]; # Shell script to start the VM. -- cgit 1.4.1