Skip to content

Commit

Permalink
WIP: fix build-vm-with-bootloader
Browse files Browse the repository at this point in the history
  • Loading branch information
steveej committed May 10, 2018
1 parent da58afd commit 1630ea0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions nixos/modules/virtualisation/qemu-vm.nix
Expand Up @@ -98,6 +98,9 @@ let
-virtfs local,path=$TMPDIR/xchg,security_model=none,mount_tag=xchg \
-virtfs local,path=''${SHARED_DIR:-$TMPDIR/xchg},security_model=none,mount_tag=shared \
${if cfg.useBootLoader then ''
# FIXME(steveeJ): ensure the VM boots from second disk
# previously the second disk didn't have the virtio interface
# and was thus used for booting and didn't occupy a /dev/vd* node
${mkDiskIfaceDriveFlag "0" "file=$NIX_DISK_IMAGE,cache=writeback,werror=report"} \
${mkDiskIfaceDriveFlag "1" "file=$TMPDIR/disk.img,media=disk"} \
${if cfg.useEFIBoot then ''
Expand Down Expand Up @@ -141,8 +144,8 @@ let
'';
buildInputs = [ pkgs.utillinux ];
QEMU_OPTS = if cfg.useEFIBoot
then "-pflash $out/bios.bin -nographic -serial pty"
else "-nographic -serial pty";
then "-pflash $out/bios.bin -nographic"
else "-nographic";
}
''
# Create a /boot EFI partition with 40M and arbitrary but fixed GUIDs for reproducibility
Expand All @@ -157,7 +160,9 @@ let
--hybrid 2 \
--recompute-chs /dev/vda
. /sys/class/block/vda2/uevent
mknod /dev/vda2 b $MAJOR $MINOR
# FIXME(steveeJ): why was this required before? i
# Now it gives: mknod: /dev/vda2: File exists
# mknod /dev/vda2 b $MAJOR $MINOR
. /sys/class/block/vda/uevent
${pkgs.dosfstools}/bin/mkfs.fat -F16 /dev/vda2
export MTOOLS_SKIP_CHECK=1
Expand Down

2 comments on commit 1630ea0

@aszlig
Copy link

@aszlig aszlig commented on 1630ea0 May 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on this (preferably in the commit message)? Especially on which problem this is supposed to solve. Also, can you add this as a pull request once you're done?

@steveej
Copy link
Collaborator Author

@steveej steveej commented on 1630ea0 May 14, 2018 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.