From: Heinrich Schuchardt <xypron.glpk@gmx.de>
Date: Sat, 16 Jan 2021 08:44:25 +0000 (+0100)
Subject: efi_loader: EFI_DEVICE_PATH_UTILITIES_PROTOCOL configurable
X-Git-Tag: v2025.01-rc5-pxa1908~2054^2~7
X-Git-Url: http://git.dujemihanovic.xyz/%22http:/kyber.dk/phpMyBuilder/static/%7B%7B%20.Permalink%20%7D%7D?a=commitdiff_plain;h=59593a52a3438d163904079ae9c5d4d7c69675bb;p=u-boot.git

efi_loader: EFI_DEVICE_PATH_UTILITIES_PROTOCOL configurable

Allow the EFI_DEVICE_PATH_UTILITIES_PROTOCOL to be disabled via
configuration.

On systems that are very tight on U-Boot image size we may want to disable
the protocol. As it is required to run the UEFI Shell enable it by default.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---

diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index 227cfa5ca4..038cdc9b6e 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -208,6 +208,13 @@ config EFI_DEVICE_PATH_TO_TEXT
 	  The device path to text protocol converts device nodes and paths to
 	  human readable strings.
 
+config EFI_DEVICE_PATH_UTIL
+	bool "Device path utilities protocol"
+	default y
+	help
+	  The device path utilities protocol creates and manipulates device
+	  paths and device nodes. It is required to run the EFI Shell.
+
 config EFI_DT_FIXUP
 	bool "Device tree fixup protocol"
 	depends on !GENERATE_ACPI_TABLE
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index a6355d240a..10b42e8847 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -28,7 +28,7 @@ obj-$(CONFIG_EFI_CAPSULE_FIRMWARE) += efi_firmware.o
 obj-y += efi_console.o
 obj-y += efi_device_path.o
 obj-$(CONFIG_EFI_DEVICE_PATH_TO_TEXT) += efi_device_path_to_text.o
-obj-y += efi_device_path_utilities.o
+obj-$(CONFIG_EFI_DEVICE_PATH_UTIL) += efi_device_path_utilities.o
 ifeq ($(CONFIG_GENERATE_ACPI_TABLE),)
 obj-y += efi_dt_fixup.o
 endif
diff --git a/lib/efi_loader/efi_root_node.c b/lib/efi_loader/efi_root_node.c
index 8383fce943..bfa57c97fc 100644
--- a/lib/efi_loader/efi_root_node.c
+++ b/lib/efi_loader/efi_root_node.c
@@ -58,9 +58,11 @@ efi_status_t efi_root_node_register(void)
 			 &efi_guid_device_path_to_text_protocol,
 			 (void *)&efi_device_path_to_text,
 #endif
+#ifdef CONFIG_EFI_DEVICE_PATH_UTIL
 			 /* Device path utilities protocol */
 			 &efi_guid_device_path_utilities_protocol,
 			 (void *)&efi_device_path_utilities,
+#endif
 #ifdef CONFIG_EFI_DT_FIXUP
 			 /* Device-tree fix-up protocol */
 			 &efi_guid_dt_fixup_protocol,