Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow fallback to default loader when encountering errors on network boot #666

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions shim.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@

#define OID_EKU_MODSIGN "1.3.6.1.4.1.2312.16.1.2"

// FIXME: Drop this when gnu-efi is updated to include de6f9259e8476495c78babbc25250a59de7f3942.
#ifndef EFI_HTTP_ERROR
#define EFI_HTTP_ERROR EFIERR(35)
#endif


static EFI_SYSTEM_TABLE *systab;
static EFI_HANDLE global_image_handle;
static EFI_LOADED_IMAGE *shim_li;
Expand Down Expand Up @@ -1258,9 +1264,12 @@ 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 ||
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);
Expand Down