[syslinux] Changes to get CD to boot on EFI System.

Thomas Schmitt
Mon, 04 Apr 2016 14:59:33 -0000

Hi,

hpa wrote:
> I'm not sure which is the intent of the El Torito spec and perhaps more
> importantly, what reality looks like, w.r.t. UEFI - whether it expects
> that the boot image is a partition or an EFI executable.

El Torito says nothing about EFI, but UEFI 2.4 describes an El Torito
boot catalog entry with Platform Id 0xef (rather than 0 for x86 BIOS)
as equivalent of a EFI System partition entry (MBR type 0xef or GPT with
EFI Type GUID) if the device is an optical drive.
(UEFI 2.4, 9.3.6.2 "CD-ROM Media Device Path")

All known working boot images are FAT filesystem images with
/EFI/BOOT/BOOT*.EFI files as first stage of the boot loader.
The same boot image can be advertised as El Torito boot image (e.g. by
ISO producer program), as MBR partition (e.g. by isohybrid --uefi or
xorriso), or as GPT partitions (e.g. by grub-mkrescue + xorriso).

This works with GRUB2, goofiboot, and Didier's all-in-one kernel
as BOOT*.EFI file.

The smallest EFI boot image known to me is in Debian amd64 netinst ISOs
advertised by mjg's isohybrid --uefi layout:

  El Torito images   :   N  Pltf  B   Emul  Ld_seg  Hdpt  Ldsiz         LBA
  El Torito boot img :   1  BIOS  y   none  0x0000  0x00      4         976
  El Torito boot img :   2  UEFI  y   none  0x0000  0x00    832         996
  El Torito img path :   1  /isolinux/isolinux.bin
  El Torito img opts :   1  boot-info-table isohybrid-suitable
  El Torito img path :   2  /boot/grub/efi.img
  ...
  MBR partition table:   N Status  Type        Start       Blocks
  MBR partition      :   1   0x80  0x00            0       505856
  MBR partition      :   2   0x00  0xef         3984          832
  MBR partition path :   2  /boot/grub/efi.img

This boots with qemu-system-x86_64 via all four combinations of
  {BIOS, EFI} x {CD, HD}

EFI (OVMF in my case) boots by this very sparse content of
/boot/grub/efi.img :

  -rwxr-xr-x 1 root root 392192 Sep  6  2015 efi/boot/bootx64.efi
  -rwxr-xr-x 1 root root   1759 Apr  3 07:18 NvVars

bootx64.efi has just enough of GRUB2 to read the configuration which
is stored in /boot/grub of the ISO filesystem. One can spot at the
end of the bootx64.efi file these GRUB2 configuration lines:

  search --file --set=root /.disk/info
  set prefix=($root)/boot/grub
  source $prefix/x86_64-efi/grub.cfg

The meaning of "NvVars" is unclear to me. Program "file"
says
  NvVars: Sendmail frozen configuration  - version r
But google relates the file name to OVMF.


The failure symptom with SYSLINUX via EFI from CD-ROM is that it
immediately reboots, probably after displaying a message about
"Graphic" and a cursor underscore. (One needs a quick screen and
fast eyes.)


Have a nice day :)

Thomas