[syslinux] fixing debian's hd-media image

Ady Ady ady-sf at hotmail.com
Fri Nov 30 07:51:22 PST 2018

> > > I think add some lines around here:
> > >
> > > https://salsa.debian.org/installer-team/debian-installer/blob/master/build/config/x86.cfg#L113-115
> > >
> > > mcopy -i$(TEMP_BOOT) /usr/lib/syslinux/modules/bios/vesamenu.c32
> > > ::vesamenu.c32; \
> > > mcopy -i$(TEMP_BOOT) /usr/lib/syslinux/modules/bios/libcom32.c32
> > > ::libcom32.c32; \
> > > mcopy -i$(TEMP_BOOT) /usr/lib/syslinux/modules/bios/libutil.c32
> > > ::libutil.c32 ; \
> >
> >
> > I'm confused. Why exactly those (BIOS) files are supposed to be related
> > to your feature request? Could you please explain (what exactly is
> > triggering this thought)?
> This is the existing code to build hd-media/boot.img,
> It is where I think some lines need to be added to support uefi.

I have a proposal for you here (in the Syslinux mailing list): let's 
first find out _what_ exactly is required in order to boot in UEFI 
mode, and then you can take the info downstream. Whether "downstream" 
means your own personal customized boot.img, or D-I, or whatever else, 
that's another matter.

Considering that thought, for now let's forget about the above "mcopy" 
instructions and/or _how_ exactly "downstream" would achieve the "what" 
I just mentioned.

> 2 problems I have identified:
> If I don't put the above syslinux.cfg and go with what is on the d-i
> setup, this seems to hang it:
> default vesamenu.c32
> #comment that out, and I get to another problem that I haven't taken
> the time to track down yet.
> Does any of this look like a problem?

Yes, of course you don't have a menu, because you are using c32 files 
from the BIOS platform (those that came with the original boot.img), 
not from EFI64.

For this "troubleshooting", please forget about the original d-i setup 
(for now), as it is not relevant for what you want to achieve at this 
initial step.

For troubleshooting, you do _not_ want to create your "simple 
syslinux.cfg" for booting in UEFI mode in the root directory of the fs 
(of your USB).

Let me rephrase what I wrote in my prior email. You need to see the 
following files, in this exact location within the FAT(32) filesystem 
volume in your USB device (later we could move around some things, but 
for now, KISS):

* From the 'efi64' subdirectory for syslinux files, 'syslinux.efi' to:
_ /media/sdc/EFI/BOOT/BOOTX64.EFI

* From the 'efi64' subdirectory for syslinux files, 'ldlinux.e64' to:
_ /media/sdc/EFI/BOOT/LDLINUX.E64

* From boot.img (or from wherever you are taking your kernel+initrd) 
_ /media/sdc/linux
_ /media/sdc/initrd.gz

(that's the root of your FAT32 fs in your USB device, not 

For now, all the rest is not needed, and I might say it is not even 

In addition to those files that you will copy from those locations to 
that specific directories / filenames, you need to create one file:

Please note that the directory is _not_ the root of your fs but 
"./EFI/BOOT/" in the fs of the USB device. This directory is the same 
as where you already have 'BOOTX64.EFI' and 'LDLINUX.E64'.

The content of "/media/sdc/EFI/BOOT/SYSLINUX.CFG" should be:

###  EFI/BOOT/SYSLINUX.CFG  start ###
# Note that there are no special symbols
# and no spaces within the labels.
# IOW, labels should be one word with English letters when 
# Even better, make that "at most 8 English letters" when 
# Additionally, we will avoid naming labels using
# the name of any other files.
# E.g., if our kernel file is named 'linux'
# then no label should be 'linux'.

DEFAULT mylabel
SAY *** Press enter to boot the default label ***

LABEL mylabel
# Please note it is not "my label", no spaces within the label.
# Please note it is not "linux", as the kernel is already named 

LINUX /linux
# Please note it is not "KERNEL /linux" nor "LINUX linux".

INITRD /initrd.gz
# Please note it is not "INITRD initrd.gz",
# we use absolute paths here too.


Now, for troubleshooting, you do not want anything else in your USB 
device, other than those files I just mentioned. IOW, you want to be 
sure at this point that the only way to boot this device is by UEFI 
mode in the x64 platform, using syslinux.efi, and then it should boot 
your 'linux+initrd.gz' files in such mode. My suggestion would be to 
move anything irrelevant, for this initial troubleshooting, out of the 
USB device.

In particular, please avoid having "/syslinux.cfg" in (the root of) 
your USB device at this time.

I know, I know... We don't have a boot menu yet. Patience :).

For a boot menu, and only when the above configuration actually boots 
your kernel+initrd in UEFIx64 mode, we will add some additional 
Syslinux files from the 'efi64' subdirectory and we'll edit 
"/media/sdc/EFI/BOOT/SYSLINUX.CFG" accordingly.

Could you please confirm that the above setup actually works? If it 
fails in 
any way, we need to know that too.

If this setup works, we'll add complexity and a boot menu, and 
eventually we 
will also put back the BIOS stuff.


More information about the Syslinux mailing list