[syslinux] chainloading syslinux from an EFI partition to an ext4

Stoppa, Igor
Sat, 06 Jun 2015 10:19:28 -0000

Hi,
I am having troubles with chainloading and hopefully someone
can provide me with some guidance.

Here's what I am trying to do:

* the media is a USB key
* I have created a GPT on it
* I have created an EFI partition, where I have installed
   the EFI flavor of syslinux, the various .c32 files required for
   chainloading and the configuration file which tells syslinux
   what to chainload
* I have created an ext4 partition and instaleld the extsylinux
  flavor on it (which is the one I would like to chainload)

What works:
* the EFI bootloader is loaded and tries to load something
* the ext4 partition, when written directly to the whole block
  device /dev/sdc, boots and starts the kernel I have deployed in it

What doesn't work:
* the chainloading: all I get is an error message from the EFI
  bootloader, saying that it cannot find the magin on the MBR
  of the disk/partition I am trying to chainload into and it would
  treat it as raw.

I cannot completely rule out that I have misconfigured the
chainload target, but I have tried various combinations and none
works. All I have is the documentation of syslinux that states
drives are enumerated starting from 0 and partitions starting from 1

Why am I trying this bizarre (?) configuration:
eventually I would like to have the EFI bootloader to automatically
decide which partition to chainload.
I'm planning to have 2 OSes on the device:
* a master OS
* a recovery OS

Both are linux and each of them lives in an ext4 partition with its
own bootloader. I'm planning to decide which one to boot into,
based on various parameter, modifying the selection mechanism
currently used by syslinux.
Furthermore, I am trying to not have any write operation on the EFI
partition, since it's a FAT32 one and I consider it more fragile.

So I'd like to not put all the kernels/initrds in it, because when I
update one of the OSes, I would also have to update the corresponding
kernel in the EFI partition.

>From the documentation I gather that syslinux will only load a kernel
that is in the same partition, hence my choice of using chainloading.

About my other attempts: I saw that there are various mbr binaries for
syslinux. So I also tried to install gptmbr.bin on the GPT table, hoping it
would provide the missing magic, but my attempt didn't seem to make
any difference.


So, finally, my questions:
* am I trying to do something that is not supported?
* is there a better way to do it?
* is there something obviously wrong in my design/assumptions?

--
thanks, igor