Dear OpenBSD developers!

I'm writing a boot loader, https://gitlab.com/bztsrc/simpleboot
It can already boot Linux kernels and Multiboot2 kernels,
and I was thinking about adding OpenBSD kernel support too.

For testing I've downloaded the minimal image from here:
https://cdn.openbsd.org/pub/OpenBSD/7.3/amd64/miniroot73.img

To my biggest surprise, in it the "boot" file's ELF header says:
$ readelf -h boot
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0

However it's entry point is clearly not 32-bit SysV ABI (but 16-bit real mode).
The same issue with the uncompressed "bsd" kernel file:
$ readelf -h bsd
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0

Although it's entry point isn't using 64-bit SysV ABI either (but prot mode with
special values on the stack). This is problematic for me because I do support
both 32-bit and 64-bit kernels with actual SysV ABI entry points, and now I
cannot distinguish OpenBSD from those.

My question is, would it be possible to use the ELFOSABI_OPENBSD value in
the ELF header of "boot" and "bsd" executable? If that's problematic for
whatever reason, then would it be possible to use 255 (the
ELFOSABI_STANDALONE define) instead? Or maybe ABI version 1? Frankly
anything other than UNIX SysV 0 would be fine, because they're not using
SysV ABI.

Thanks,
bzt

Reply via email to