Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] boot/edk2: add a new Kconfig option to pass arbitrary build options
@ 2025-06-30 18:58 Julien Olivain via buildroot
  2025-07-05 21:32 ` Romain Naour via buildroot
  2026-01-04 10:56 ` Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 5+ messages in thread
From: Julien Olivain via buildroot @ 2025-06-30 18:58 UTC (permalink / raw)
  To: buildroot; +Cc: Dick Olsson, Julien Olivain

EDK2 build may include extra options. Those are usually in the form
of "-D SOMEFLAG_ENABLE" and might be specific for a processor
architecture or a platform. For example:
"-D NETWORK_HTTP_BOOT_ENABLE", "-D NETWORK_TLS_ENABLE", ...

Those options are generally documented in their respective packages.
See for example:
https://github.com/tianocore/edk2/blob/master/OvmfPkg/README

This commit adds a new Kconfig string option to let the use define
arbitrary build flags.

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
 boot/edk2/Config.in | 15 +++++++++++++++
 boot/edk2/edk2.mk   |  1 +
 2 files changed, 16 insertions(+)

diff --git a/boot/edk2/Config.in b/boot/edk2/Config.in
index 635bb0100a..eda15df2a1 100644
--- a/boot/edk2/Config.in
+++ b/boot/edk2/Config.in
@@ -119,6 +119,21 @@ config BR2_TARGET_EDK2_OVMF_DEBUG_ON_SERIAL
 	  See OVMF README:
 	  https://github.com/tianocore/edk2/blob/master/OvmfPkg/README
 
+config BR2_TARGET_EDK2_EXTRA_BUILD_OPTS
+	string "Extra build options"
+	help
+	  EDK2 build may include extra options. Those are usually in
+	  the form of "-D SOMEFLAG_ENABLE" and might be specific for a
+	  processor architecture or a platform. For example: "-D
+	  NETWORK_HTTP_BOOT_ENABLE", "-D NETWORK_TLS_ENABLE", ...
+
+	  Those options are generally documented in their respective
+	  packages. See for example:
+	  https://github.com/tianocore/edk2/blob/master/OvmfPkg/README
+
+	  This configuration is an arbitrary string that will be
+	  passed to the build command.
+
 config BR2_TARGET_EDK2_FD_NAME
 	string
 	default "OVMF" if BR2_TARGET_EDK2_PLATFORM_OVMF_I386
diff --git a/boot/edk2/edk2.mk b/boot/edk2/edk2.mk
index 36bcbfc88b..57d45e5fca 100644
--- a/boot/edk2/edk2.mk
+++ b/boot/edk2/edk2.mk
@@ -146,6 +146,7 @@ EDK2_BUILD_ENV += \
 	GCC5_$(EDK2_ARCH)_PREFIX=$(TARGET_CROSS)
 
 EDK2_BUILD_OPTS += \
+	$(call qstrip,$(BR2_TARGET_EDK2_EXTRA_BUILD_OPTS)) \
 	-t GCC5 \
 	-n $(BR2_JLEVEL) \
 	-a $(EDK2_ARCH) \
-- 
2.50.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH 1/1] boot/edk2: add a new Kconfig option to pass arbitrary build options
  2025-06-30 18:58 [Buildroot] [PATCH 1/1] boot/edk2: add a new Kconfig option to pass arbitrary build options Julien Olivain via buildroot
@ 2025-07-05 21:32 ` Romain Naour via buildroot
  2026-01-04 10:57   ` Thomas Petazzoni via buildroot
  2026-01-04 10:56 ` Thomas Petazzoni via buildroot
  1 sibling, 1 reply; 5+ messages in thread
From: Romain Naour via buildroot @ 2025-07-05 21:32 UTC (permalink / raw)
  To: Julien Olivain, buildroot; +Cc: Dick Olsson

Hello Julien, All,

Le 30/06/2025 à 20:58, Julien Olivain via buildroot a écrit :
> EDK2 build may include extra options. Those are usually in the form
> of "-D SOMEFLAG_ENABLE" and might be specific for a processor
> architecture or a platform. For example:
> "-D NETWORK_HTTP_BOOT_ENABLE", "-D NETWORK_TLS_ENABLE", ...
> 
> Those options are generally documented in their respective packages.
> See for example:
> https://github.com/tianocore/edk2/blob/master/OvmfPkg/README
> 
> This commit adds a new Kconfig string option to let the use define
> arbitrary build flags.
> 
> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
>  boot/edk2/Config.in | 15 +++++++++++++++
>  boot/edk2/edk2.mk   |  1 +
>  2 files changed, 16 insertions(+)
> 
> diff --git a/boot/edk2/Config.in b/boot/edk2/Config.in
> index 635bb0100a..eda15df2a1 100644
> --- a/boot/edk2/Config.in
> +++ b/boot/edk2/Config.in
> @@ -119,6 +119,21 @@ config BR2_TARGET_EDK2_OVMF_DEBUG_ON_SERIAL
>  	  See OVMF README:
>  	  https://github.com/tianocore/edk2/blob/master/OvmfPkg/README
>  
> +config BR2_TARGET_EDK2_EXTRA_BUILD_OPTS
> +	string "Extra build options"
> +	help
> +	  EDK2 build may include extra options. Those are usually in
> +	  the form of "-D SOMEFLAG_ENABLE" and might be specific for a
> +	  processor architecture or a platform. For example: "-D
> +	  NETWORK_HTTP_BOOT_ENABLE", "-D NETWORK_TLS_ENABLE", ...
> +
> +	  Those options are generally documented in their respective
> +	  packages. See for example:
> +	  https://github.com/tianocore/edk2/blob/master/OvmfPkg/README
> +
> +	  This configuration is an arbitrary string that will be
> +	  passed to the build command.
> +
>  config BR2_TARGET_EDK2_FD_NAME
>  	string
>  	default "OVMF" if BR2_TARGET_EDK2_PLATFORM_OVMF_I386
> diff --git a/boot/edk2/edk2.mk b/boot/edk2/edk2.mk
> index 36bcbfc88b..57d45e5fca 100644
> --- a/boot/edk2/edk2.mk
> +++ b/boot/edk2/edk2.mk
> @@ -146,6 +146,7 @@ EDK2_BUILD_ENV += \
>  	GCC5_$(EDK2_ARCH)_PREFIX=$(TARGET_CROSS)
>  
>  EDK2_BUILD_OPTS += \
> +	$(call qstrip,$(BR2_TARGET_EDK2_EXTRA_BUILD_OPTS)) \

Maybe we should use a loop here adding "-D" with the options provided by
BR2_TARGET_EDK2_EXTRA_BUILD_OPTS. Otherwise the user can add whatever he want
that could conflict with other build arguments.

I found an example of such extra options to disable PXE booting in qemu:
-D NETWORK_PXE_BOOT_ENABLE=FALSE

https://git.yoctoproject.org/meta-arm/diff/meta-arm/recipes-bsp/uefi/edk2-firmware_%25.bbappend?id=69121ff4e5b298dca16781f67f44f345e143667c

Best regards,
Romain


>  	-t GCC5 \
>  	-n $(BR2_JLEVEL) \
>  	-a $(EDK2_ARCH) \

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH 1/1] boot/edk2: add a new Kconfig option to pass arbitrary build options
  2025-06-30 18:58 [Buildroot] [PATCH 1/1] boot/edk2: add a new Kconfig option to pass arbitrary build options Julien Olivain via buildroot
  2025-07-05 21:32 ` Romain Naour via buildroot
@ 2026-01-04 10:56 ` Thomas Petazzoni via buildroot
  2026-01-04 13:52   ` Julien Olivain via buildroot
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-01-04 10:56 UTC (permalink / raw)
  To: Julien Olivain via buildroot; +Cc: Julien Olivain, Dick Olsson

On Mon, 30 Jun 2025 20:58:54 +0200
Julien Olivain via buildroot <buildroot@buildroot.org> wrote:

> EDK2 build may include extra options. Those are usually in the form
> of "-D SOMEFLAG_ENABLE" and might be specific for a processor
> architecture or a platform. For example:
> "-D NETWORK_HTTP_BOOT_ENABLE", "-D NETWORK_TLS_ENABLE", ...
> 
> Those options are generally documented in their respective packages.
> See for example:
> https://github.com/tianocore/edk2/blob/master/OvmfPkg/README
> 
> This commit adds a new Kconfig string option to let the use define
> arbitrary build flags.
> 
> Signed-off-by: Julien Olivain <ju.o@free.fr>

Sounds good to me, but one question:

>  EDK2_BUILD_OPTS += \
> +	$(call qstrip,$(BR2_TARGET_EDK2_EXTRA_BUILD_OPTS)) \

Shouldn't this go...

>  	-t GCC5 \
>  	-n $(BR2_JLEVEL) \
>  	-a $(EDK2_ARCH) \

... at the end of all options, so that BR2_TARGET_EDK2_EXTRA_BUILD_OPTS
can potentially be used to override whatever option is passed by Buildroot?

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH 1/1] boot/edk2: add a new Kconfig option to pass arbitrary build options
  2025-07-05 21:32 ` Romain Naour via buildroot
@ 2026-01-04 10:57   ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-01-04 10:57 UTC (permalink / raw)
  To: Romain Naour via buildroot; +Cc: Romain Naour, Julien Olivain, Dick Olsson

Hello Romain,

On Sat, 5 Jul 2025 23:32:17 +0200
Romain Naour via buildroot <buildroot@buildroot.org> wrote:

> >  EDK2_BUILD_OPTS += \
> > +	$(call qstrip,$(BR2_TARGET_EDK2_EXTRA_BUILD_OPTS)) \  
> 
> Maybe we should use a loop here adding "-D" with the options provided by
> BR2_TARGET_EDK2_EXTRA_BUILD_OPTS. Otherwise the user can add whatever he want
> that could conflict with other build arguments.

No, I disagree here. If there's an option to pass extra options I
expect it to pass all my extra options, as-is with no magic. Including
if that means that I can shoot myself in the foot by passing
conflicting options.

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH 1/1] boot/edk2: add a new Kconfig option to pass arbitrary build options
  2026-01-04 10:56 ` Thomas Petazzoni via buildroot
@ 2026-01-04 13:52   ` Julien Olivain via buildroot
  0 siblings, 0 replies; 5+ messages in thread
From: Julien Olivain via buildroot @ 2026-01-04 13:52 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: Julien Olivain via buildroot, Dick Olsson

Hi Thomas,

On 04/01/2026 11:56, Thomas Petazzoni wrote:
> On Mon, 30 Jun 2025 20:58:54 +0200
> Julien Olivain via buildroot <buildroot@buildroot.org> wrote:
> 
>> EDK2 build may include extra options. Those are usually in the form
>> of "-D SOMEFLAG_ENABLE" and might be specific for a processor
>> architecture or a platform. For example:
>> "-D NETWORK_HTTP_BOOT_ENABLE", "-D NETWORK_TLS_ENABLE", ...
>> 
>> Those options are generally documented in their respective packages.
>> See for example:
>> https://github.com/tianocore/edk2/blob/master/OvmfPkg/README
>> 
>> This commit adds a new Kconfig string option to let the use define
>> arbitrary build flags.
>> 
>> Signed-off-by: Julien Olivain <ju.o@free.fr>
> 
> Sounds good to me, but one question:
> 
>>  EDK2_BUILD_OPTS += \
>> +	$(call qstrip,$(BR2_TARGET_EDK2_EXTRA_BUILD_OPTS)) \
> 
> Shouldn't this go...
> 
>>  	-t GCC5 \
>>  	-n $(BR2_JLEVEL) \
>>  	-a $(EDK2_ARCH) \
> 
> ... at the end of all options, so that BR2_TARGET_EDK2_EXTRA_BUILD_OPTS
> can potentially be used to override whatever option is passed by 
> Buildroot?

I agree this would be better. I've sent a v2 including your suggestion:
https://patchwork.ozlabs.org/project/buildroot/patch/20260104134755.1786447-1-ju.o@free.fr/

Best regards,

Julien.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-04 14:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-30 18:58 [Buildroot] [PATCH 1/1] boot/edk2: add a new Kconfig option to pass arbitrary build options Julien Olivain via buildroot
2025-07-05 21:32 ` Romain Naour via buildroot
2026-01-04 10:57   ` Thomas Petazzoni via buildroot
2026-01-04 10:56 ` Thomas Petazzoni via buildroot
2026-01-04 13:52   ` Julien Olivain via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox