Create a Kconfig which indicates that EFI functionality is in use,
either as a client (EFI app / stub) or provider (EFI loader). This will
make it easier to share code between these two parts of U-Boot

Signed-off-by: Simon Glass <s...@chromium.org>
---

 doc/develop/uefi/u-boot_on_efi.rst |  6 +++---
 lib/efi/Kconfig                    | 12 ++++++++++++
 lib/efi_client/Kconfig             |  1 +
 lib/efi_loader/Kconfig             |  3 +++
 4 files changed, 19 insertions(+), 3 deletions(-)
 create mode 100644 lib/efi/Kconfig

diff --git a/doc/develop/uefi/u-boot_on_efi.rst 
b/doc/develop/uefi/u-boot_on_efi.rst
index a687eb3d691..7a1713f7588 100644
--- a/doc/develop/uefi/u-boot_on_efi.rst
+++ b/doc/develop/uefi/u-boot_on_efi.rst
@@ -46,9 +46,9 @@ First choose a board that has EFI support and obtain an EFI 
implementation
 for that board. It will be either 32-bit or 64-bit. Alternatively, you can
 opt for using QEMU [1] and the OVMF [2], as detailed below.
 
-To build U-Boot as an EFI application, enable CONFIG_EFI_CLIENT and 
CONFIG_EFI_APP.
-The efi-x86_app32 and efi-x86_app64 configs are set up for this. Just build
-U-Boot as normal, e.g.::
+To build U-Boot as an EFI application, enable CONFIG_EFI_CLIENT and
+CONFIG_EFI_APP. The efi-x86_app32 and efi-x86_app64 configs are set up for
+this. Just build U-Boot as normal, e.g.::
 
    make efi-x86_app32_defconfig
    make
diff --git a/lib/efi/Kconfig b/lib/efi/Kconfig
new file mode 100644
index 00000000000..fc6d5b6d6c2
--- /dev/null
+++ b/lib/efi/Kconfig
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Copyright 2025 Simon Glass <s...@chromium.org>
+#
+
+config EFI
+       bool
+       help
+         Indicates that EFI functionality is enabled, either via EFI_CLIENT or
+         EFI_LOADER
+
+         This is used to provide libraries shared by both.
diff --git a/lib/efi_client/Kconfig b/lib/efi_client/Kconfig
index b6446179b67..fec5b7e004c 100644
--- a/lib/efi_client/Kconfig
+++ b/lib/efi_client/Kconfig
@@ -5,6 +5,7 @@ config EFI_CLIENT
        bool "Support running U-Boot from EFI"
        depends on X86 || ARM
        imply X86_TSC_READ_BASE
+       select EFI
        help
          U-Boot can be started from EFI on certain platforms. This allows
          EFI to perform most of the system init and then jump to U-Boot for
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index 9c67cf55283..f5abcd51cae 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -16,6 +16,7 @@ config EFI_LOADER
        depends on !EFI_STUB || !X86 || X86_64 || EFI_STUB_32BIT
        depends on !EFI_APP
        default y if !ARM || SYS_CPU = armv7 || SYS_CPU = armv8
+       select EFI
        select CHARSET
        # We need to send DM events, dynamically, in the EFI block driver
        select DM_EVENT
@@ -610,4 +611,6 @@ endif
 
 source "lib/efi_client/Kconfig"
 
+source "lib/efi/Kconfig"
+
 endmenu
-- 
2.43.0

Reply via email to