Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions BUILDING
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ Variables you could set to customize the build:
by firmware. It breaks loading non-default second-stage loaders when invoked
via that path, and requires using a binary named shim*.efi (or really anything
else).
- DISABLE_ALL_LOAD_OPTIONS
Disables load option parsing like DISABLE_REMOVABLE_LOAD_OPTIONS, but for all
devices, not just removable media.
- REQUIRE_TPM
if tpm logging or extends return an error code, treat that as a fatal error.
- ARCH
Expand Down
4 changes: 4 additions & 0 deletions Make.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ ifneq ($(origin DISABLE_REMOVABLE_LOAD_OPTIONS), undefined)
DEFINES += -DDISABLE_REMOVABLE_LOAD_OPTIONS
endif

ifneq ($(origin DISABLE_ALL_LOAD_OPTIONS), undefined)
DEFINES += -DDISABLE_ALL_LOAD_OPTIONS
endif

LIB_GCC = $(shell $(CC) $(ARCH_CFLAGS) -print-libgcc-file-name)
EFI_LIBS = -lefi -lgnuefi --start-group Cryptlib/libcryptlib.a Cryptlib/OpenSSL/libopenssl.a --end-group $(LIB_GCC)
FORMAT ?= --target efi-app-$(ARCH)
Expand Down
14 changes: 9 additions & 5 deletions shim.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,16 +481,19 @@ EFI_STATUS init_grub(EFI_HANDLE image_handle)
/*
* Check the load options to specify the second stage loader
*/
EFI_STATUS set_second_stage (EFI_HANDLE image_handle)
EFI_STATUS set_second_stage (__attribute__((unused)) EFI_HANDLE image_handle)
{
EFI_STATUS efi_status;
EFI_LOADED_IMAGE *li = NULL;

second_stage = (optional_second_stage) ? optional_second_stage : DEFAULT_LOADER;
load_options = NULL;
load_options_size = 0;

efi_status = BS->HandleProtocol(image_handle, &LoadedImageProtocol,
#ifndef DISABLE_ALL_LOAD_OPTIONS
/*
* to avoid errors when parsing the load options on some systems,
* or if it is not needed, the function can be completely disabled.
*/
EFI_LOADED_IMAGE *li = NULL;
EFI_STATUS efi_status = BS->HandleProtocol(image_handle, &LoadedImageProtocol,
(void **) &li);
if (EFI_ERROR(efi_status)) {
perror (L"Failed to get load options: %r\n", efi_status);
Expand All @@ -513,6 +516,7 @@ EFI_STATUS set_second_stage (EFI_HANDLE image_handle)
perror (L"Failed to get load options: %r\n", efi_status);
return efi_status;
}
#endif

return EFI_SUCCESS;
}
Expand Down