boards: x86: depend on CONFIG_BUILD_OUTPUT_EFI

Add a new Kconfig CONFIG_BUILD_OUTPUT_EFI and select that for boards
that want to generate an EFI application.
Make qemu_x86_64 also generate an EFI file, however do not enable this
by default yet.

Goal is to boot qemu using EFI to be able to test this path in the
future.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2021-01-26 06:58:30 -05:00
parent fc03bd2b86
commit 51c34bb609
6 changed files with 30 additions and 2 deletions

View file

@ -317,6 +317,20 @@ config BUILD_OUTPUT_BIN
Build a "raw" binary zephyr/zephyr.bin in the build directory.
The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
config BUILD_OUTPUT_EFI
bool "Build as an EFI application"
default n
depends on X86_64
help
Build as an EFI application.
This works by creating a "zephyr.efi" EFI binary containing a zephyr
image extracted from a built zephyr.elf file. EFI applications are
relocatable, and cannot be placed at specific locations in memory.
Instead, the stub code will copy the embedded zephyr sections to the
appropriate locations at startup, clear any zero-filled (BSS, etc...)
areas, then jump into the 64 bit entry point.
config BUILD_OUTPUT_EXE
bool "Build a binary in ELF format with .exe extension"
help

View file

@ -1,5 +1,5 @@
# Create an EFI image
if(CONFIG_BOARD_EHL_CRB)
if(CONFIG_BOARD_EHL_CRB AND CONFIG_BUILD_OUTPUT_EFI)
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/arch/x86/zefi/zefi.py
-c ${CMAKE_C_COMPILER}

View file

@ -10,3 +10,5 @@ CONFIG_UART_NS16550=y
CONFIG_UART_CONSOLE=y
CONFIG_X2APIC=y
CONFIG_SMP=y
CONFIG_KERNEL_VM_SIZE=0x80800000
CONFIG_BUILD_OUTPUT_EFI=y

View file

@ -0,0 +1,10 @@
if(CONFIG_BOARD_QEMU_X86_64 AND CONFIG_BUILD_OUTPUT_EFI)
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/arch/x86/zefi/zefi.py
-c ${CMAKE_C_COMPILER}
-o ${CMAKE_OBJCOPY}
-f ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.elf
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
endif()

View file

@ -1,5 +1,5 @@
# Create an EFI image
if(CONFIG_BOARD_UP_SQUARED)
if(CONFIG_BOARD_UP_SQUARED AND CONFIG_BUILD_OUTPUT_EFI)
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/arch/x86/zefi/zefi.py
-c ${CMAKE_C_COMPILER}

View file

@ -11,3 +11,5 @@ CONFIG_UART_CONSOLE=y
CONFIG_X2APIC=y
CONFIG_SMP=y
CONFIG_MP_NUM_CPUS=2
CONFIG_KERNEL_VM_SIZE=0x80800000
CONFIG_BUILD_OUTPUT_EFI=y