Skip to content

Commit 51c34bb

Browse files
committed
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 <[email protected]>
1 parent fc03bd2 commit 51c34bb

File tree

6 files changed

+30
-2
lines changed

6 files changed

+30
-2
lines changed

Kconfig.zephyr

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,20 @@ config BUILD_OUTPUT_BIN
317317
Build a "raw" binary zephyr/zephyr.bin in the build directory.
318318
The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
319319

320+
config BUILD_OUTPUT_EFI
321+
bool "Build as an EFI application"
322+
default n
323+
depends on X86_64
324+
help
325+
Build as an EFI application.
326+
327+
This works by creating a "zephyr.efi" EFI binary containing a zephyr
328+
image extracted from a built zephyr.elf file. EFI applications are
329+
relocatable, and cannot be placed at specific locations in memory.
330+
Instead, the stub code will copy the embedded zephyr sections to the
331+
appropriate locations at startup, clear any zero-filled (BSS, etc...)
332+
areas, then jump into the 64 bit entry point.
333+
320334
config BUILD_OUTPUT_EXE
321335
bool "Build a binary in ELF format with .exe extension"
322336
help

boards/x86/ehl_crb/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Create an EFI image
2-
if(CONFIG_BOARD_EHL_CRB)
2+
if(CONFIG_BOARD_EHL_CRB AND CONFIG_BUILD_OUTPUT_EFI)
33
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
44
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/arch/x86/zefi/zefi.py
55
-c ${CMAKE_C_COMPILER}

boards/x86/ehl_crb/ehl_crb_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ CONFIG_UART_NS16550=y
1010
CONFIG_UART_CONSOLE=y
1111
CONFIG_X2APIC=y
1212
CONFIG_SMP=y
13+
CONFIG_KERNEL_VM_SIZE=0x80800000
14+
CONFIG_BUILD_OUTPUT_EFI=y

boards/x86/qemu_x86/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
if(CONFIG_BOARD_QEMU_X86_64 AND CONFIG_BUILD_OUTPUT_EFI)
2+
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
3+
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/arch/x86/zefi/zefi.py
4+
-c ${CMAKE_C_COMPILER}
5+
-o ${CMAKE_OBJCOPY}
6+
-f ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.elf
7+
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
8+
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
9+
)
10+
endif()

boards/x86/up_squared/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Create an EFI image
2-
if(CONFIG_BOARD_UP_SQUARED)
2+
if(CONFIG_BOARD_UP_SQUARED AND CONFIG_BUILD_OUTPUT_EFI)
33
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
44
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/arch/x86/zefi/zefi.py
55
-c ${CMAKE_C_COMPILER}

boards/x86/up_squared/up_squared_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ CONFIG_UART_CONSOLE=y
1111
CONFIG_X2APIC=y
1212
CONFIG_SMP=y
1313
CONFIG_MP_NUM_CPUS=2
14+
CONFIG_KERNEL_VM_SIZE=0x80800000
15+
CONFIG_BUILD_OUTPUT_EFI=y

0 commit comments

Comments
 (0)