[Buildroot] [PATCH 1/3] boot/edk2: add custom version option

Vincent Stehlé vincent.stehle at arm.com
Fri Apr 11 17:29:42 UTC 2025


Add a custom version option, to enable easily specifying an official EDK
II version to use. This is similar to what is done in other packages,
such as linux, uboot, optee_os or arm-trusted-firmware.

Move the default version definition from edk2 makefile to the config
menu to support that. We keep the same latest version by default to
preserve current behaviour.

Also, add a check of the custom version option validity in edk2
makefile.

Signed-off-by: Vincent Stehlé <vincent.stehle at arm.com>
Cc: Dick Olsson <hi at senzilla.io>
---
 boot/edk2/Config.in | 26 ++++++++++++++++++++++++++
 boot/edk2/edk2.mk   | 16 +++++++++++++++-
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/boot/edk2/Config.in b/boot/edk2/Config.in
index 4e6e7d122c..35314047e3 100644
--- a/boot/edk2/Config.in
+++ b/boot/edk2/Config.in
@@ -18,6 +18,32 @@ config BR2_TARGET_EDK2
 
 if BR2_TARGET_EDK2
 
+choice
+	prompt "EDK2 version"
+	default BR2_TARGET_EDK2_LATEST
+	help
+	  Select the specific EDK2 version you want to use
+
+config BR2_TARGET_EDK2_LATEST
+	bool "edk2-stable202411"
+
+config BR2_TARGET_EDK2_CUSTOM_VERSION
+	bool "Custom version"
+	help
+	  This option allows to use a specific official version
+
+endchoice
+
+config BR2_TARGET_EDK2_CUSTOM_VERSION_VALUE
+	string "EDK2 version"
+	depends on BR2_TARGET_EDK2_CUSTOM_VERSION
+
+config BR2_TARGET_EDK2_VERSION
+	string
+	default "edk2-stable202411" if BR2_TARGET_EDK2_LATEST
+	default BR2_TARGET_EDK2_CUSTOM_VERSION_VALUE \
+	        if BR2_TARGET_EDK2_CUSTOM_VERSION
+
 choice
 	prompt "Platform"
 	default BR2_TARGET_EDK2_PLATFORM_OVMF_I386 if BR2_i386
diff --git a/boot/edk2/edk2.mk b/boot/edk2/edk2.mk
index 3941d01883..dfe64e24bb 100644
--- a/boot/edk2/edk2.mk
+++ b/boot/edk2/edk2.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-EDK2_VERSION = edk2-stable202411
+EDK2_VERSION = $(call qstrip,$(BR2_TARGET_EDK2_VERSION))
 EDK2_SITE = https://github.com/tianocore/edk2
 EDK2_SITE_METHOD = git
 EDK2_LICENSE = BSD-2-Clause-Patent
@@ -184,4 +184,18 @@ define EDK2_INSTALL_IMAGES_CMDS
 	cp -f $(@D)/Build/$(EDK2_BUILD_DIR)/$(EDK2_BUILD_TYPE)_GCC5/FV/*.fd $(BINARIES_DIR)
 endef
 
+ifeq ($(BR2_TARGET_EDK2)$(BR_BUILDING),yy)
+
+#
+# Check custom version option
+#
+ifeq ($(BR2_TARGET_EDK2_CUSTOM_VERSION),y)
+ifeq ($(call qstrip,$(BR2_TARGET_EDK2_CUSTOM_VERSION_VALUE)),)
+$(error No custom edk2 version specified. \
+	Check your BR2_TARGET_EDK2_CUSTOM_VERSION_VALUE setting)
+endif
+endif
+
+endif # BR2_TARGET_EDK2 and BR_BUILDING
+
 $(eval $(generic-package))
-- 
2.47.2



More information about the buildroot mailing list