summaryrefslogtreecommitdiff
path: root/netboot.c
diff options
context:
space:
mode:
authorJan Setje-Eilers <jan.setjeeilers@oracle.com>2024-07-12 17:07:45 -0700
committerPeter Jones <pjones@redhat.com>2025-02-18 10:21:19 -0500
commit2b49dc13aed3723c7c841c2788217ff7b0e821df (patch)
treee064ba50dd2994343a835767e5038cdab6d51474 /netboot.c
parentc57af36e673b34a9b24309f76f105371316c45be (diff)
downloadefi-boot-shim-2b49dc13aed3723c7c841c2788217ff7b0e821df.tar.gz
efi-boot-shim-2b49dc13aed3723c7c841c2788217ff7b0e821df.zip
Suppress file open failures for some netboot cases
Reading files during a netboot comes with the caveat that fetching files from a network does not support anything like listing a directory. In the past this has meant that we do not try to open optional files during a netboot. However at least the revocation.efi file is now tested during a netboot, which will print an error when it is not found. Since that error is spurious we should allow for those errors to be suppressed. This is also desirable since we will likely go looking for additional files in the near future. Signed-off-by: Jan Setje-Eilers <Jan.SetjeEilers@oracle.com>
Diffstat (limited to 'netboot.c')
-rw-r--r--netboot.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/netboot.c b/netboot.c
index a4cc7acd..46765427 100644
--- a/netboot.c
+++ b/netboot.c
@@ -368,7 +368,8 @@ status_from_error(UINT8 error_code)
}
}
-EFI_STATUS FetchNetbootimage(EFI_HANDLE image_handle UNUSED, VOID **buffer, UINT64 *bufsiz)
+EFI_STATUS FetchNetbootimage(EFI_HANDLE image_handle UNUSED, VOID **buffer,
+ UINT64 *bufsiz, int flags)
{
EFI_STATUS efi_status;
EFI_PXE_BASE_CODE_TFTP_OPCODE read = EFI_PXE_BASE_CODE_TFTP_READ_FILE;
@@ -376,7 +377,8 @@ EFI_STATUS FetchNetbootimage(EFI_HANDLE image_handle UNUSED, VOID **buffer, UINT
BOOLEAN nobuffer = FALSE;
UINTN blksz = 512;
- console_print(L"Fetching Netboot Image %a\n", full_path);
+ if (~flags & SUPPRESS_NETBOOT_OPEN_FAILURE_NOISE)
+ console_print(L"Fetching Netboot Image %a\n", full_path);
if (*buffer == NULL) {
*buffer = AllocatePool(4096 * 1024);
if (!*buffer)
@@ -399,7 +401,8 @@ try_again:
if (EFI_ERROR(efi_status)) {
if (pxe->Mode->TftpErrorReceived) {
- console_print(L"TFTP error %u: %a\n",
+ if (~flags & SUPPRESS_NETBOOT_OPEN_FAILURE_NOISE)
+ console_print(L"TFTP error %u: %a\n",
pxe->Mode->TftpError.ErrorCode,
pxe->Mode->TftpError.ErrorString);
@@ -412,7 +415,9 @@ try_again:
*
* https://github.com/tianocore/edk2/pull/6287
*/
- console_print(L"Unknown TFTP error, treating as file not found\n");
+ if (~flags & SUPPRESS_NETBOOT_OPEN_FAILURE_NOISE)
+ console_print(L"Unknown TFTP error, treating "
+ "as file not found\n");
efi_status = EFI_NOT_FOUND;
}