payloads/external/iPXE: Allow building EFI target

Add a Kconfig to enable building iPXE for EFI target, which can be
executed from EDK2. If not selected, iPXE will be built for use with
legacy BIOS. Add support to the Makefile to build the EFI target.

Change-Id: I7f247a59a65aeb18a67475d4d543f519af88aeb9
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83385
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Michał Żygowski 2024-04-09 14:00:50 +02:00 committed by Matt DeVillier
commit 493e3d182e
2 changed files with 19 additions and 3 deletions

View file

@ -116,6 +116,14 @@ config IPXE_TRUST_CMD
digital signature of file prior loading it, and restrict to loading
trusted files only.
config IPXE_BUILD_EFI
bool "Build iPXE for EFI target"
depends on PAYLOAD_EDK2
default n
help
Build iPXE for EFI target, enabling it to be executed from EDK2. If not
selected, iPXE will be built for use with legacy BIOS.
endif # BUILD_IPXE
endmenu

View file

@ -11,6 +11,14 @@ project_name=iPXE
project_dir=ipxe
project_git_repo=https://git.ipxe.org/ipxe.git
ifeq ($(CONFIG_IPXE_BUILD_EFI),y)
IPXE_BUILD_TARGET := bin-x86_64-efi-sb/ipxe.efi
# Workaround problems with unrecognized ipxe/util/elf2efi relocations
PXE_MAKE_OPTS += EXTRA_CFLAGS="$(CFLAGS_x86_64) -fno-pic"
else
IPXE_BUILD_TARGET := bin/$(PXE_ROM_PCI_ID).rom
endif
all: build
$(project_dir):
@ -59,12 +67,12 @@ endif
build: config $(CONFIG_SCRIPT)
ifeq ($(CONFIG_HAS_SCRIPT),y)
echo " MAKE $(project_name) $(TAG-y) EMBED=$(CONFIG_SCRIPT)"
$(MAKE) -C $(project_dir)/src bin/$(PXE_ROM_PCI_ID).rom EMBED=$(CONFIG_SCRIPT)
$(MAKE) -C $(project_dir)/src $(IPXE_BUILD_TARGET) EMBED=$(CONFIG_SCRIPT) $(PXE_MAKE_OPTS)
else
echo " MAKE $(project_name) $(TAG-y)"
$(MAKE) -C $(project_dir)/src bin/$(PXE_ROM_PCI_ID).rom
$(MAKE) -C $(project_dir)/src $(IPXE_BUILD_TARGET) $(PXE_MAKE_OPTS)
endif
cp $(project_dir)/src/bin/$(PXE_ROM_PCI_ID).rom $(project_dir)/ipxe.rom
cp $(project_dir)/src/$(IPXE_BUILD_TARGET) $(project_dir)/ipxe.rom
ifeq ($(CONSOLE_SERIAL),yy)
cp "$(project_dir)/src/config/console.h.cb" "$(project_dir)/src/config/console.h"
cp "$(project_dir)/src/config/serial.h.cb" "$(project_dir)/src/config/serial.h"