Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for booting as Xen dom0 on EFI systems #60485

Closed
wants to merge 3 commits into from

Conversation

@Shados
Copy link
Contributor

@Shados Shados commented Apr 30, 2019

Based on #12230, aims to fix #12225.

Progress
  • Get Xen EFI binaries to build on current nixpkgs versions:
    • 4.5.x (Is it worth spending time on this, given security support ended Jan 2018...?)
    • 4.8.x
    • 4.10.x
  • Support booting NixOS as Xen dom0 under EFI for:
    • grub2
    • systemd-boot/gummiboot
  • Tested using:
    • Nested virtualization within a qemu-kvm VM
    • Hardware (I hope to do this within the next day or two)
  • Confirmed the combined EFI/BIOS grub menu entry works under both
Notes, Issues, Questions
  • This boots Xen by having the bootloader chainload to Xen's EFI binary, which needs a xen.cfg file in the same directory as it, on the ESP, that contains paths to the kernel and initrd (also on the ESP) as well as the Xen and kernel command lines.
  • It is apparently possible to have grub2 boot a standard xen.gz using multiboot2/module2, but I could not get this to work (the VM reboots itself part-way through Xen's boot process). I have been able to find very little documentation on this method, as well as only two examples of people using this 'in the wild', so it is possible that this code-path has bit-rotted in the couple of years since it was implemented...
  • This basically assumes grub is only used for EFI booting on the system, not both EFI and BIOS booting -- all the Xen entries will use the Xen EFI binary if it is avaiable. I think this could be solved by using grub_platform within the menu entry to switch between the xen.efi and xen.gz methods?
  • A configuration that can boot Xen using either is still possible, using both BIOS-only grub + systemd-boot.
  • I don't much like Perl, and I'm not all that familiar with it, so the changes to install-grub.pl are probably due some extra scrutiny.
@Shados
Copy link
Contributor Author

@Shados Shados commented May 2, 2019

Added another commit, some updates:

  • Tested OK on actual hardware
  • Rewrote addEntry to include support for booting under either EFI or BIOS using Xen within the same menu entry (tested both)
  • Tested non-Xen booting still works fine (NixOS boot tests succeed, and I ran through the affected boot configurations manually OK)
  • Did some other minor improvements and bits of cleanup

I'll remove the [WIP] bit from the title now, only outstanding question I have is whether Xen 4.5 should get EFI support, or just be removed or marked broken. Is there a specific reason it's still in nixpkgs?

It would be nice to add NixOS tests for Xen booting, but from what I understand it would likely require some effort to get the test driver to talk to the Xen dom0 VM nested within the outer QEMU VM.

@Shados Shados changed the title [WIP] Add support for booting as Xen dom0 on EFI systems Add support for booting as Xen dom0 on EFI systems May 2, 2019
@Shados Shados force-pushed the Shados:xen-efi branch from c3edb61 to 6797da2 Aug 13, 2019
@nixos-discourse
Copy link

@nixos-discourse nixos-discourse commented Aug 14, 2019

This pull request has been mentioned on Nix community. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review-may-2019/3032/43

@danbst
Copy link
Contributor

@danbst danbst commented Aug 17, 2019

Can you add a test for this?

@Shados
Copy link
Contributor Author

@Shados Shados commented Aug 19, 2019

@danbst No, as per my previous comment:

It would be nice to add NixOS tests for Xen booting, but from what I understand it would likely require some effort to get the test driver to talk to the Xen dom0 VM nested within the outer QEMU VM.

From what I remember, apparently Linux just doesn't run drivers for any QEMU devices if it has detected that it is a Xen guest; it doesn't expect to be simultaneously a QEMU and Xen guest. This includes the driver for the virtio-serial device that the NixOS test driver uses to talk to the test VMs. @cleverca22 should know more.

@danbst
Copy link
Contributor

@danbst danbst commented Aug 20, 2019

If xen 4.5 is outstanding old and doesn't receive updates, then yes, lets remove it. Maybe in separate PR?

@danbst
Copy link
Contributor

@danbst danbst commented Aug 20, 2019

cc @oxij

@oxij
Copy link
Contributor

@oxij oxij commented Aug 20, 2019

@Shados Shados closed this Jan 10, 2020
@Shados Shados mentioned this pull request Jan 10, 2020
5 of 10 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants
You can’t perform that action at this time.