[ipxe-devel] Build ipxe.efi with IMAGE_BZIMAGE fail

Christian Nilsson nikize at gmail.com
Thu Mar 23 23:06:22 UTC 2017


>From the error page that is shown in your error message
"If you are running a UEFI version of iPXE then only EFI binaries can
be loaded. PXE binaries such as pxelinux.0 use legacy BIOS calls and
can never work on UEFI.

If you are trying to load a Linux kernel (or other EFI binary) then
you can use iPXE to load it directly; there is no need to load
pxelinux.0 first."

BzImage is not supported from EFI and probably never will be due to
different reasons.
The fix is to use a Linux kernel built with CONFIG_EFI_STUB enabled,
and also make sure it is version 3.16 or later if you want to use
initrd (to avoid known bugs)


On Thu, Mar 23, 2017 at 3:22 PM, Ковалёв Сергей <SKovalev at ptsecurity.com> wrote:
> Hello.
>
>
>
> I have tried to boot linux kernel by providing bzImage from custom build to
> iPXE. But it failes with error “Could not select: Exec format error
> (http://ipxe.org/2e008081)”. In iPXE header I could see line “Features: DNS
> HTTP iSCSI TFTP SRP AoE EFI Menu”.
>
>
>
> So I have tried to enable bzImage support in iPXE. But faced with error:
>
> ar: creating bin-x86_64-efi/blib.a
>
>   [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(hidemem.o): In function `hide_region':
>
> /home/xxx/ipxe/src/arch/x86/interface/pcbios/hidemem.c:97: undefined
> reference to `_textdata'
>
> /home/xxx/ipxe/src/arch/x86/interface/pcbios/hidemem.c:98: undefined
> reference to `_etextdata'
>
> bin-x86_64-efi/blib.a(hidemem.o): In function `hide_etherboot':
>
> /home/xxx/ipxe/src/arch/x86/interface/pcbios/hidemem.c:158: undefined
> reference to `_textdata'
>
> /home/xxx/ipxe/src/arch/x86/interface/pcbios/hidemem.c:171: undefined
> reference to `_text16_memsz'
>
> /home/xxx/ipxe/src/arch/x86/interface/pcbios/hidemem.c:172: undefined
> reference to `_data16_memsz'
>
> ld: bin-x86_64-efi/ipxe.efi.tmp: hidden symbol `_textdata' isn't defined
>
> ld: final link failed: Bad value
>
> Makefile.housekeeping:1166: 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
>
>
>
> I build commit ce240c8c2d5d51841e3b261951b181961215de6b. My changes are:
>
> diff --git a/src/config/console.h b/src/config/console.h
>
> index 9f770d0..62a8c79 100644
>
> --- a/src/config/console.h
>
> +++ b/src/config/console.h
>
> @@ -34,7 +34,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
>
>   *
>
>   */
>
>
>
> -//#define      CONSOLE_SERIAL          /* Serial port console */
>
> +#define        CONSOLE_SERIAL          /* Serial port console */
>
> //#define      CONSOLE_FRAMEBUFFER     /* Graphical framebuffer console */
>
> //#define      CONSOLE_SYSLOG          /* Syslog console */
>
> //#define      CONSOLE_SYSLOGS         /* Encrypted syslog console */
>
> diff --git a/src/config/general.h b/src/config/general.h
>
> index fb1ac93..09c6e02 100644
>
> --- a/src/config/general.h
>
> +++ b/src/config/general.h
>
> @@ -107,7 +107,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
>
> //#define      IMAGE_MULTIBOOT         /* MultiBoot image support */
>
> //#define      IMAGE_PXE               /* PXE image support */
>
> //#define      IMAGE_SCRIPT            /* iPXE script image support */
>
> -//#define      IMAGE_BZIMAGE           /* Linux bzImage image support */
>
> +#define        IMAGE_BZIMAGE           /* Linux bzImage image support */
>
> //#define      IMAGE_COMBOOT           /* SYSLINUX COMBOOT image support */
>
> //#define      IMAGE_EFI               /* EFI image support */
>
> //#define      IMAGE_SDI               /* SDI image support */
>
>
>
> Could someone give me an advice?
>
>
>
> With best regards
>
> Sergey Kovalev
>
>
>
> P.S. I have successfully loaded kernel from Fedora 23 (file
> vmlinuz-4.4.9-300.fc23.x86_64) but I don’t why.
>
>
> _______________________________________________
> ipxe-devel mailing list
> ipxe-devel at lists.ipxe.org
> https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel
>



More information about the ipxe-devel mailing list