From 6fdbc3358a60f98ecedf7e01b143239b7015e5f1 Mon Sep 17 00:00:00 2001 From: Nathan O'Meara Date: Thu, 20 Jun 2024 12:20:22 -0400 Subject: [PATCH] Allow fallback to default loader when encountering errors on network boot Only certain errors trigger fallback to the default loader name. This change allows fallback when encountering `EFI_TFTP_ERROR` as well. And ideally would also handle `EFI_HTTP_ERROR` the same way, but that requires updating gnu-efi to a version newer than the shim-15.8 branch. This fixes the issue reported in https://github.com/rhboot/shim/issues/649 that prevents boot on some models of PC. Signed-off-by: Nathan O'Meara --- shim.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/shim.c b/shim.c index 87202f7ff..d652f5f90 100644 --- a/shim.c +++ b/shim.c @@ -1258,9 +1258,13 @@ EFI_STATUS init_grub(EFI_HANDLE image_handle) } // If the filename is invalid, or the file does not exist, - // just fallback to the default loader. + // just fallback to the default loader. Also fallback to the + // default loader if we get a TFTP error or HTTP error. if (!use_fb && (efi_status == EFI_INVALID_PARAMETER || - efi_status == EFI_NOT_FOUND)) { + efi_status == EFI_NOT_FOUND || + // TODO: Add EFI_HTTP_ERROR when gnu-efi is updated to a version that includes it + // efi_status == EFI_HTTP_ERROR || + efi_status == EFI_TFTP_ERROR)) { console_print( L"start_image() returned %r, falling back to default loader\n", efi_status);