diff options
author | Boris Sukholitko <boriss@gmail.com> | 2022-03-24 10:56:35 +0200 |
---|---|---|
committer | Boris Sukholitko <boriss@gmail.com> | 2022-03-25 17:38:19 +0300 |
commit | 6af3e61632c651db2dc1fe55ae48460006eda0ad (patch) | |
tree | cadcab0f8a640b88dfdd007b572c44ce013d4884 /nixos/modules/virtualisation | |
parent | 5ff499b854c9a574dbd7c3a2d4c27778d1d05a35 (diff) |
nixos/qemu-vm: allow booting VM with the custom kernel
While doing kernel development with the nixos testing infrastructure, it is useful to quickly compile the kernel on the side and boot it in the testing VM. This patch allows overriding the kernel through the environment variable. For example, the following: $ NIXPKGS_QEMU_KERNEL_testvm=$LINUX_SRC/arch/x86/boot/bzImage $VM/bin/nixos-test-driver runs testvm testing VM with the fresh kernel compiled in $LINUX_SRC. Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
Diffstat (limited to 'nixos/modules/virtualisation')
-rw-r--r-- | nixos/modules/virtualisation/qemu-vm.nix | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index 5143893589470..653bdc8f30169 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -854,7 +854,7 @@ in "-device virtio-gpu-pci" "-device usb-ehci,id=usb0" "-device usb-kbd" "-device usb-tablet" ]) (mkIf (!cfg.useBootLoader) [ - "-kernel ${config.system.build.toplevel}/kernel" + "-kernel \${NIXPKGS_QEMU_KERNEL_${config.system.name}:-${config.system.build.toplevel}/kernel}" "-initrd ${config.system.build.toplevel}/initrd" ''-append "$(cat ${config.system.build.toplevel}/kernel-params) init=${config.system.build.toplevel}/init regInfo=${regInfo}/registration ${consoles} $QEMU_KERNEL_PARAMS"'' ]) |