iPXE discussion forum
iPXE EFI build fails with PXE_STACK defined - Printable Version

+- iPXE discussion forum (https://forum.ipxe.org)
+-- Forum: iPXE user forums (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: iPXE EFI build fails with PXE_STACK defined (/showthread.php?tid=8024)



iPXE EFI build fails with PXE_STACK defined - shanept - 2016-04-20 04:21

I am trying to build an EFI version of iPXE for distribution to Apple laptops, so I may chainload PXE.

The command I am using is
Code:
make bin-x86_64-efi/ipxe.efi
. The build, after some time, halts with an error:

Code:
[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+0x25): 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+0x2b): 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+0x4a): 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+0x1e): relocation truncated to fit: R_X86_64_32 against symbol `rm_ss' defined in .bss.rm_ss section in bin-x86_64-efi/blib.a(librm.o)
bin-x86_64-efi/blib.a(librm.o): In function `r2p_pmode':
(.text.real_to_prot+0x27): relocation truncated to fit: R_X86_64_32 against symbol `rm_sp' defined in .bss.rm_sp section in bin-x86_64-efi/blib.a(librm.o)
bin-x86_64-efi/blib.a(librm.o): In function `prot_to_real':
(.text.prot_to_real+0x2): 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'
Makefile.housekeeping:1104: recipe for target 'bin-x86_64-efi/ipxe.efi.tmp' failed
make: *** [bin-x86_64-efi/ipxe.efi.tmp] Error 1
rm bin-x86_64-efi/version.ipxe.efi.o

The curious thing about this is that I can compile iPXE as an ISO completely fine, however the exact same code will not build as an EFI. The only change being that I have defined PXE_STACK in config/general.h

Code:
/*
* PXE support
*
*/
#define    PXE_STACK        /* PXE stack in iPXE - you want this! */
//#undef    PXE_MENU        /* PXE menu booting */

I am compiling the code against the current git master branch. Using gcc:
Code:
gcc (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
And on Ubuntu 15.10.


RE: iPXE EFI build fails with PXE_STACK defined - SebastianRoth - 2016-04-26 21:20

PXE_STACK and EFI don't go together. Make it '#undef PXE_STACK' or leave commented. Then try compiling again.

But you might want to change this option:
Code:
#define        CONSOLE_FRAMEBUFFER



RE: iPXE EFI build fails with PXE_STACK defined - MultimediaMan - 2016-04-26 22:43

That Framebuffer Directive did trip me up as well. Good callout.