[PATCH master] bootm: require EFI boot when running as payload
Ahmad Fatoum
a.fatoum at pengutronix.de
Tue Apr 14 06:59:35 PDT 2026
An EFI-stubbed ARM64 Linux kernel can be optionally started as EFI
application via its PE entry point or it can be directly executed with
the normal boot protocol.
To support both in barebox, we have a global.bootm.efi parameter that
allows choosing either:
- required: only boot EFI executables via EFI
- available: attempt EFI boot for EFI executables if barebox support
is available
- disabled: never attempt EFI boot
With barebox support here meaning CONFIG_EFI_LOADER being enabled.
This fails to account for configurations that have only
CONFIG_EFI_PAYLOAD and that are actually running as EFI payload.
For those, we should always require EFI boot for EFI executables as
stating a kernel from within an EFI environment without exiting boot
services is not a good idea.
Thus change the check to IS_ENABLED(CONFIG_EFI_LOADER) || efi_is_payload().
IS_ENABLED(CONFIG_EFI_PAYLOAD) would be incorrect as we can enable EFI
payload support, but start barebox directly, not via its own EFI stub.
Fixes: 6119a5b54ed1 ("bootm: add global.bootm.efi toggle")
Reported-by: Chali Anis <chalianis1 at gmail.com>
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
common/bootm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/bootm.c b/common/bootm.c
index d43079bb81da..82b0f0bd0563 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -845,7 +845,7 @@ bool bootm_efi_check_image(struct image_handler *handler,
* and fallback to normal boot otherwise.
*/
if (data->efi_boot == BOOTM_EFI_AVAILABLE) {
- if (IS_ENABLED(CONFIG_EFI_LOADER))
+ if (IS_ENABLED(CONFIG_EFI_LOADER) || efi_is_payload())
data->efi_boot = BOOTM_EFI_REQUIRED;
else
data->efi_boot = BOOTM_EFI_DISABLED;
--
2.47.3
More information about the barebox
mailing list