[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#922251: live-build: support syslinux-efi as (additional) bootloader



Package: live-build
Version: 1:20180925
Severity: wishlist

Hi folks,

currently, live-build seems to only support EFI systems using the
grub-efi bootloader, but not for netboot or hdd images (effectively only
for iso images, I believe).

Syslinux also has an EFI version, that can be installed through
the syslinux-efi package. It would be useful for live-build to support
this. I need this for a client, so I'm planning to implement support in
the coming weeks. This report serves to track progress and discuss
the implementation.

I've done some experiments by adding syslinux-efi to an existing image
manually (not with a full live-build image, but with my own hdd image
that at least uses live-build for building the image, so should be
representative in this area). This shows that adding syslinux-efi is
fairly easy. The existing FAT partition can function as an ESP (EFI
System Partition) as it is now.

Installing the bootloader is a matter of dumping some files in the
EFI/BOOT directory. This lets the bootloader be detected as a fallback
bootloader, which is AFAIU intended for removable media. Syslinux needs
some additional files (ldlinux, additional modules, configuration) which
can live in that same directory.

Both 32-bit and 64-bit EFI can be supported at the same time, by
installing both versions of syslinux-efi (named bootx64.efi and
bootia32.efi respectively). One caveat is that syslinux needs different
.c32 modules for both architectures (though they are both named .c32 and
are explicitly referenced in the config file). This means either
duplicating the bootloader configuration file for 32 and 64 bit (which
hinders modifications to the config), or putting the modules in
subdirectories and using the PATH config directive to point to either
directive before including the common configuration. I have not tried
this latter approach but it is described here (though currently
syslinux.org seems to be unavailable, I tried the Google cache):

https://www.syslinux.org/archives/2014-August/022545.html

(subject: syslinux efi configuration file name proposal)

I've also tried to let the syslinux-efi config file include the normal
syslinux configuration file (or at least the bulk that is in live.cfg),
which seems to work just fine.

Since config sharing is easy and syslinux-efi is a matter of adding some
files to the existing image, it would make sense to add syslinux-efi by
default on normal syslinux hdd images (perhaps adding a new option to
disable this?). This also seems to hold for ISO9660 images, where
it seems isohybrid can include a small FAT filesystem with the
bootloader files. This might need some additional work to generate the
filesystem image and/or pass options when generating the iso. See:

https://www.syslinux.org/wiki/index.php?title=Isohybrid#UEFI


Using syslinux-efi exclusively (e.g. passing it to --bootloader and not
installing normal syslinux) might also be an extra option. However, I'm
not much interested in this case, so I will likely not implement it
(I'll try not to make it too hard to add it later).


In terms of code, this is probably best implemented in the existing
binary_syslinux script. The bulk of what needs to happen is essentially
copying bootloader files from config/bootloaders into binary, taking
care to resolve symlinks. I'm planning to put the code that does that
into a shell function, so it can be called at the current place and then
a second time for syslinux-efi later.

I think it would be good to copy files *from*
config/bootloaders/syslinux-efi-addon or something similar, to leave
config/bootloaders/syslinux-efi available for an EFI-only image. These
two directories would be identical in terms of syslinux binary files,
but the configurations would differ (the addon would include the normal
boot/syslinux/syslinux.cfg, while the standalone version would contain
the complete config).

I haven't really looked at the iso version yet (which is also not my
primary interest, but I think it would be good to handle as well).

Happy to hear any thoughts :-)

Gr.

Matthijs


Reply to: