[syslinux] sanbooting FreeBSD ISO under UEFI

Rick Miller
2017-01-23T14:17:05Z

Hi all,

I currently use iPXE to load memdisk and, subsequently, a FreeBSD disk
image to perform an OS installation to disk.  This works great in BIOS, but
upcoming requirements make UEFI a prerequisite.  Because memdisk is not
UEFI-aware, new UEFI-aware media is necessary.  The current plan is to
integrate the installation scripts (currently in the hard drive image) into
a bootable FreeBSD ISO (something I?ve previous experience with) and
instead of loading it via memdisk, load it directly from iPXE using
`sanboot` (or similar).

Unfortunately, I have been unable to get iPXE to sanboot an ISO.  It errors
citing ?Operation not permitted?.  The current working theory is that the
necessary features aren?t enabled in the current UEFI-aware iPXE program.
This has lead me to the general.h[2] header file where many of the image
types are disabled, including IMAGE_PXE, which seems to be the image type
necessary for PXE booting.  However, uncommenting and building the
resulting code via:

# pwd
/ipxe/src
# make bin-x86_64-efi/ipxe.efi

produces the following error:

  [AR] bin-x86_64-efi/blib.a
ar: creating bin-x86_64-efi/blib.a
  [HOSTCC] util/elf2efi64
  [VERSION] bin-x86_64-efi/version.ipxe.efi.o
  [LD] bin-x86_64-efi/ipxe.efi.tmp
bin-x86_64-efi/blib.a(librm.o): In function `pm_esp':
(.data.pm_esp+0x0): relocation truncated to fit: R_X86_64_32 against symbol
`_estack' defined in .stack section in bin-x86_64-efi/blib.a(stack.o)
bin-x86_64-efi/blib.a(librm.o): In function `real_to_prot':
(.text16.real_to_prot+0x1): relocation truncated to fit: R_X86_64_PC16
against symbol `enable_a20' defined in .text16.early section in
bin-x86_64-efi/blib.a(liba20.o)
bin-x86_64-efi/blib.a(librm.o): In function `real_to_prot':
(.text16.real_to_prot+0x8): relocation truncated to fit: R_X86_64_16
against symbol `rm_ds' defined in .text16.data.rm_ds section in
bin-x86_64-efi/blib.a(librm.o)
bin-x86_64-efi/blib.a(librm.o): In function `real_to_prot':
(.text16.real_to_prot+0x22): relocation truncated to fit: R_X86_64_16
against `.bss16.rm_virt_addrs'
bin-x86_64-efi/blib.a(librm.o): In function `real_to_prot':
(.text16.real_to_prot+0x2e): relocation truncated to fit: R_X86_64_16
against `.bss16.rm_virt_addrs'
bin-x86_64-efi/blib.a(librm.o): In function `real_to_prot':
(.text16.real_to_prot+0x33): relocation truncated to fit: R_X86_64_16
against `.bss16.rm_virt_addrs'
bin-x86_64-efi/blib.a(librm.o): In function `real_to_prot':
(.text16.real_to_prot+0x39): relocation truncated to fit: R_X86_64_16
against `.data16.gdt'
bin-x86_64-efi/blib.a(librm.o): In function `real_to_prot':
(.text16.real_to_prot+0x58): relocation truncated to fit: R_X86_64_32
against `.text.real_to_prot'
bin-x86_64-efi/blib.a(librm.o): In function `r2p_pmode':
(.text.real_to_prot+0x10): relocation truncated to fit: R_X86_64_32 against
`.data.pm_esp'
bin-x86_64-efi/blib.a(librm.o): In function `r2p_pmode':
(.text.real_to_prot+0x17): relocation truncated to fit: R_X86_64_32 against
symbol `idtr32' defined in .data.idtr32 section in
bin-x86_64-efi/blib.a(librm_mgmt.o)
bin-x86_64-efi/blib.a(librm.o): In function `r2p_pmode':
(.text.real_to_prot+0x1f): additional relocation overflows omitted from the
output
bin-x86_64-efi/blib.a(pxe_entry.o): In function `pxe_segments':
(.text16.data+0x26): undefined reference to `_data16_memsz'
bin-x86_64-efi/blib.a(pxe_entry.o): In function `pxe_segments':
(.text16.data+0x2e): undefined reference to `_data16_memsz'
bin-x86_64-efi/blib.a(pxe_entry.o): In function `pxe_segments':
(.text16.data+0x36): undefined reference to `_text16_memsz'
bin-x86_64-efi/blib.a(pxe_entry.o): In function `pxe_segments':
(.text16.data+0x3e): undefined reference to `_text16_memsz'
bin-x86_64-efi/blib.a(pxe_entry.o): In function `pxenv':
(.text16.data+0x76): undefined reference to `_data16_memsz'
bin-x86_64-efi/blib.a(pxe_entry.o): In function `pxenv':
(.text16.data+0x82): undefined reference to `_data16_memsz'
bin-x86_64-efi/blib.a(pxe_entry.o): In function `pxenv':
(.text16.data+0x86): undefined reference to `_text16_memsz'
make: *** [bin-x86_64-efi/ipxe.efi.tmp] Error 1
rm bin-x86_64-efi/version.ipxe.efi.o

Are there additional options, such as PXE_STACK, that are required when
booting a FreeBSD ISO from iPXE under UEFI, but perhaps disabled that might
mitigate this error or perhaps this feature is unavailable under UEFI?


[1] http://ipxe.org/efi/vision
[2] https://git.ipxe.org/ipxe.git/blob/HEAD:/src/config/general.h

--
Take care
Rick Miller