[CentOS-virt] CentOS 7 / Xen 4.6 on UEFI system?

Tue Feb 27 16:02:30 UTC 2018
Chris Wik <chris at anu.net>

Wondering if anyone has managed to get Xen to boot from UEFI?

We have a relatively new server with a Supermicro X11SSH-F mainboard with an M.2 SSD. If we switch the boot mode to Legacy in the BIOS no boot devices show up. The vendor says this is because M.2 SSD is only supported in UEFI mode. We even tried installing some spinning SATA drives and a USB thumb drive but those don't show up as bootable either in legacy mode.

Trying to boot Xen 4.6 from the centos-release-xen repo results in:

Loading Xen 4.6.6-8.el7
error: can't find command 'multiboot'.
Loading Linux 4.9.75-29.el7.x86_64 ...
error: can't find command 'module'.
Loading initial ramdisk ...
error: can't find command 'module'.

Press any key to continue ...


From what I've read we need to compile xen.efi and boot it natively.

I found this: https://wiki.xenproject.org/wiki/Xen_EFI#Compiling_Xen_as_EFI

Which sugests binutils doesn't support PE (EFI), which looks to be the case with the stock version on CentOS 7, note missing i386pe from the list of supported emulations:

# ld -V
GNU ld version 2.25.1-32.base.el7_4.2 
  Supported emulations:
   elf_x86_64
   elf32_x86_64
   elf_i386
   i386linux
   elf_l1om
   elf_k1om

I downloaded binutils 2.30 from http://ftp.gnu.org/gnu/binutils/ and built it with:

yum -y groupinstall "Development Tools"
tar xzf binutils-2.30.tar.gz
cd binutils-2.30
./configure --enable-targets=x86_64-pep
make
make install

Now I have a version that supports i386pe:

# /usr/local/bin/ld -V
GNU ld (GNU Binutils) 2.30
  Supported emulations:
   elf_x86_64
   elf32_x86_64
   elf_i386
   elf_iamcu
   i386linux
   elf_l1om
   elf_k1om
   i386pep
   i386pe

However at this point I guess I need to rebuild Xen from source in order to obtain the xen.efi binary, and I'm not sure how to do that.

Am I on the right path? Any tips on how to recompile Xen to get xen.efi binary? Or am I barking up the wrong tree?

Thanks in advance for any advice.

Chris

--
Chris Wik
Anu Internet Services
www.cwik.ch | www.anu.net