I think I’m close to being able to cross-compile a NixOS VM for powerpc64le. On my repro-nixos-ppc64le-cross-vm
branch, I can run nix-build nixos/ -A vm -I nixos-config=./config.nix
. The resulting VM fails during stage 1 boot, because it needs to mount /dev/vda
which does not exist.
Am I simply missing a kernel module? On x86_64, the /dev/vda device is created by virtio_blk. Are there other options I need to enable in my kernel config?
config.nix
:
{ lib, pkgs, ... }:
{
imports = [
./nixos/modules/virtualisation/qemu-vm.nix
];
nixpkgs = {
crossSystem = lib.systems.examples.powernv;
#localSystem = { system = "x86_64-linux"; };
};
boot.kernelPackages = pkgs.linuxPackages_testing;
virtualisation.qemu.guestAgent.enable = false;
virtualisation.qemu.consoles = [ "ttyAMA0,115200n8" ];
#virtualisation.qemu.diskInterface = "scsi";
virtualisation.memorySize = 2048;
virtualisation.graphics = false;
virtualisation.useBootLoader = false;
boot.initrd.kernelModules = [ "virtio_pci" "virtio_blk" ];
boot.kernelModules = [ "virtio_blk" ];
documentation.enable = lib.mkForce false;
documentation.nixos.enable = lib.mkForce false;
}
VM stage 1 boot log:
<<< NixOS Stage 1 >>>
loading module virtio_balloon...
loading module virtio_console...
loading module virtio_rng...
loading module virtio_pci...
loading module virtio_blk...
loading module dm_mod...
running udev...
Starting version 247
kbd_mode: KDSKBMODE: Inappropriate ioctl for device
Gstarting device mapper and LVM...
hwclock: can't open '/dev/misc/rtc': No such file or directory
mke2fs 1.45.6 (20-Mar-2020)
The file /dev/vda does not exist and no size was specified.
waiting for device /dev/vda to appear.......................
Timed out waiting for device /dev/vda, trying to mount anyway.
mounting /dev/vda on /...
mount: mounting /dev/vda on /mnt-root/ failed: No such file or directory
An error occurred in stage 1 of the boot process, which must mount the
root filesystem on `/mnt-root' and then start stage 2. Press one
of the following keys:
r) to reboot immediately
*) to ignore the error and continue