[syslinux] Multiboot BIOS / EFI32 / EFI64

Johann Obermayr johann.obermayr at sigmatek.at
Thu Jun 30 08:07:25 PDT 2022


Hello,

It work.
With one Disk , I can boot on PC with old BIOS Boot & new PC with EFI Boot.
First Partition is a EFI Boot Partition.
The problem is, that windows can’t set this partition as active.
Use other Tools. Or Linux 😊

We generate Flash Disk Images. This image can be used on different systems.

We must fix some bugs in our DiskImage create.
  Write MBR, Write ldlinux.bss as Partition Boot Record with correct data.
  And set partition as active.

With Yocto we build three for targets

do_compile_target() {
                echo "------------ do_compile do_compile_target ----------------"
                # Make sure the recompile is OK.
                # Though the ${B} should always exist, still check it before find and rm.
                [ -d "${B}" ] && find ${B} -name '.*.d' -type f -exec rm -f {} \;

                # Build bootloader for BIOS, EFI32, EFI64
                oe_runmake CC="${SL_CC} ${SL_CFLAGS} -DDEBUG_STDIO" LD="${LD}" LDFLAGS="${SL_LDFLAGS} -m elf_i386"     firmware="bios"
                oe_runmake CC="${SL_CC} ${SL_CFLAGS} -DDEBUG_STDIO" LD="${LD}" LDFLAGS="${SL_LDFLAGS} -m elf_i386"     firmware="efi32"
                oe_runmake CC="${SL_CC} ${SL_CFLAGS} -DDEBUG_STDIO" LD="${LD}" LDFLAGS="${SL_LDFLAGS} -m elf_x86_64"   firmware="efi64"

                # Build Target syslinux installer executable
                oe_runmake CC="${SL_CC} ${SL_CFLAGS}" LD="${LD}" LDFLAGS="${SL_LDFLAGS}" firmware="bios"  installer
}

python do_compile() {
    bb.build.exec_func("filter_flags", d)
    bb.build.exec_func("do_compile_target", d)
}

# our BOOT Partition structure
# Partition Type must be a FAT (EFI Bootloader)
#
# /EFI/
# /EFI/BOOT                                                     EFI32, EFI64 Bootloader + syslx64.cfg + syslia32.cfg
# /EFI/BOOT/x32                                            32 Bit Modules for EFI32 (*.c32)
# /EFI/BOOT/x64                                            64 Bit Modules for EFI64 (*.c32)
# /syslinux/                                       SYSLINUX Bootloader + syslinux.cfg
# /CONFIG/

in every directory are the needed *.c32 files.
With PATH we set the search directory for the *.c32 files.

$ cat syslinux.cfg
                #
                # BIOS configuration
                #

                PATH /syslinux

                # add empty lines
                SAY
                SAY Starting EFI64 ...

                # Include common config
                INCLUDE /CONFIG/common.cfg

so we have one common.cfg for all boot types

Best regards.
  Johann


Von: Loïc Grenié <loic.grenie at gmail.com>
Gesendet: Donnerstag, 30. Juni 2022 13:43
An: Johann Obermayr <johann.obermayr at sigmatek.at>
Betreff: Re: [syslinux] Multiboot BIOS / EFI32 / EFI64

     Hello,

On Wed Jun 29, 2022 at 14:39, Johann Obermayr wrote:
Hello,

I will make a boot disk, that can boot from older Hardware with BIOS boot & newer hardware with EFI boot.

My idea is:

Partition1: EFI Boot partition
   /EFI/BOOT/ BOOTia32.efi
   /EFI/BOOT/ BOOTx64.efi
  ...
  /syslinux/ldlinux.sys
  ...
Partition2: Linux System
...
...

Also set EFI Boot Partition as active.
Witch BIN file must I install on MBR ?
   I think mbr.bin ist the correct.
For PBR (Partition Bootrecord) I use ldlinux.bss.
But is this compatible with the EFI Boot FAT Partition ?

Is there a way to do this, or must I patch syslinux ?

     I'd be interested in the answer to your question. I can only suggest to try with
  qemu: qemu has a native bios and, apparently, ovmf allows you to boot an UEFI
  system.

      Good luck,

           Loïc


More information about the Syslinux mailing list