I've been using syslinux (extlinux more precisely) for about 20 years.
Until now, following my very healthy principle "newer=crappier", I
managed to avoid 64-bit hardware because back in 2012 I gathered a little
stockpile of 32-bit hardware, and I can definitely say that all this time was a
wonderful ride.
But these days it's getting harder and harder to get anything done online
with older versions of browsers, and even Debian plans to ditch the 32-bit arch.
So I'm being forced to switch to newer (64-bit) hardware, meaning a newer
version of syslinux, meaning the UEFI-era versions of it.
I'm currently trying to figure a way to get my Linux OS installed on USB
Flash media - in a way that would be backwards-compatible with my existing
MBR/Non-UEFI setups.
And this brought me to the need to figure out a way to make syslinux
chainloading work, so far with no success.
###### What I've done so far: #######
I tried the following using syslinux versions 6.03/2015 and 6.04/2019.
The same thing happens in both cases.
I have a 64-bit machine, which has the CSM option in BIOS.
I disabled it and set it to only boot in pure UEFI mode.
I prepared a USB flash drive like this:
# partitioned using GPT
- created an ESP partition (FAT32, "boot,esp" flags in parted),
created an EFI/BOOT/ dir on it and copied the following files on it:
syslinux.efi
chain.c32
ldlinux.c32
ldlinux.e64
ldlinux.sys
libcom32.c32
libmenu.c32
libutil.c32
menu.c32
syslinux.cfg
("syslinux.efi" was taken from /usr/lib/SYSLINUX.EFI/efi64/ and
renamed to "bootx64.efi". All the other files are taken from
/usr/lib/syslinux/modules/efi64/)
NOTE: when using an "EFI/syslinux" dir for these files and the
"syslinux.efi" file name, the computer stubbornly refused to boot from
this partition, so I had to resort to the UEFI recommended "fallback"
method of "EFI/BOOT/ dir name, plus the "bootx64.efi" file name
for the 64-bit "syslinux.efi" file.
# created a second partition, formatted it as ext2 and ran extlinux -i on it to
make it bootable (i.e. working boot sector)
# I created contents for syslinux.cfg like this:
UI menu.c32
PROMPT 1
TIMEOUT 0
DEFAULT test
LABEL test
MENU LABEL Test
COM32 chain.c32
APPEND hd0 2
##### What I was expecting #####
- Motherboard booting
- a blue menu shows up with one menu item "Test"
- When ENTER pressed, chainloading should execute the boot sector on the second
partition and as a result get a message about no "syslinux.cfg" being
present
##### What actually happens #####
- Motherboard booting
- a blue menu shows up with one menu item "Test"
- When ENTER pressed, an "underscore" prompt ("_") shows up
a few rows below everything and the computer freezes like this.
So the first step (booting from the ESP partition) is a success, but the second
(chainloading the boot sector on the second partition) is a failure.
########################
So my question is this:
Am I missing anything here?
Are there maybe some extra files that I should copy to EFI/BOOT/ ?
As far as I can figure, "chain.c32" only needs the
"libcom32.c32" library and nothing else ...
Is the syslinux chainloading really supposed to work on GPT-partitioned media
with GPT partitions or not?
On the Syslinux Wiki page I found this weird statement:
"Chain loading requires the boot sector of the foreign operating system to
be stored in a file in the root directory of the filesystem."
So what now?
Am I to understand that for chainloading, it's not enough to specify the
drive and partition to chainload in clear? ("APPEND hd0 2")
Do I also have to extract the boot sector from that partition and save it
separately on the root of the partition? Makes no sense to me ...