diff options
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | src/boot/efi/boot.c | 7 | ||||
-rw-r--r-- | src/boot/efi/console.c | 5 | ||||
-rw-r--r-- | src/boot/efi/meson.build | 8 | ||||
-rw-r--r-- | src/boot/efi/missing_efi.h | 57 | ||||
-rw-r--r-- | src/boot/efi/pe.c | 1 | ||||
-rw-r--r-- | src/boot/efi/shim.c | 3 | ||||
-rw-r--r-- | src/boot/efi/splash.c | 3 | ||||
-rw-r--r-- | src/boot/efi/util.c | 5 |
9 files changed, 22 insertions, 68 deletions
@@ -202,6 +202,7 @@ REQUIREMENTS: gcc, awk, sed, grep, and similar tools clang >= 10.0, llvm >= 10.0 (optional, required to build BPF programs from source code in C) + gnu-efi >= 3.0.5 (optional, required for systemd-boot) During runtime, you need the following additional dependencies: diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c index fcbf50fc0e..6c4ddb1939 100644 --- a/src/boot/efi/boot.c +++ b/src/boot/efi/boot.c @@ -26,10 +26,6 @@ #error systemd-boot requires compilation with GNU_EFI_USE_MS_ABI defined. #endif -#ifndef EFI_OS_INDICATIONS_BOOT_TO_FW_UI -#define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001ULL -#endif - #define TEXT_ATTR_SWAP(c) EFI_TEXT_ATTR(((c) & 0b11110000) >> 4, (c) & 0b1111) /* magic string to find in the binary image */ @@ -1266,7 +1262,6 @@ static void config_entry_bump_counters( _cleanup_freepool_ CHAR16* old_path = NULL, *new_path = NULL; _cleanup_(FileHandleClosep) EFI_FILE_HANDLE handle = NULL; - static const EFI_GUID EfiFileInfoGuid = EFI_FILE_INFO_ID; _cleanup_freepool_ EFI_FILE_INFO *file_info = NULL; UINTN file_info_size; EFI_STATUS err; @@ -1292,7 +1287,7 @@ static void config_entry_bump_counters( /* And rename the file */ StrCpy(file_info->FileName, entry->next_name); - err = handle->SetInfo(handle, (EFI_GUID*) &EfiFileInfoGuid, file_info_size, file_info); + err = handle->SetInfo(handle, &GenericFileInfo, file_info_size, file_info); if (EFI_ERROR(err)) { log_error_stall(L"Failed to rename '%s' to '%s', ignoring: %r", old_path, entry->next_name, err); return; diff --git a/src/boot/efi/console.c b/src/boot/efi/console.c index 88309484c7..6b71e1e02c 100644 --- a/src/boot/efi/console.c +++ b/src/boot/efi/console.c @@ -12,9 +12,6 @@ #define VERTICAL_MAX_OK 1080 #define VIEWPORT_RATIO 10 -#define EFI_SIMPLE_TEXT_INPUT_EX_GUID \ - &(const EFI_GUID) EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID - static inline void EventClosep(EFI_EVENT *event) { if (!*event) return; @@ -50,7 +47,7 @@ EFI_STATUS console_key_read(UINT64 *key, UINT64 timeout_usec) { assert(key); if (!checked) { - err = LibLocateProtocol((EFI_GUID*) EFI_SIMPLE_TEXT_INPUT_EX_GUID, (void **)&TextInputEx); + err = LibLocateProtocol(&SimpleTextInputExProtocol, (void **)&TextInputEx); if (EFI_ERROR(err) || BS->CheckEvent(TextInputEx->WaitForKeyEx) == EFI_INVALID_PARAMETER) /* If WaitForKeyEx fails here, the firmware pretends it talks this * protocol, but it really doesn't. */ diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build index 201a9a70f3..e6bb7d7c6a 100644 --- a/src/boot/efi/meson.build +++ b/src/boot/efi/meson.build @@ -93,6 +93,14 @@ if conf.get('ENABLE_EFI') == 1 and get_option('gnu-efi') != 'false' endif have_gnu_efi = gnu_efi_path_arch != '' and efi_libdir != '' + + if have_gnu_efi and not cc.has_header_symbol('efi.h', 'EFI_IMAGE_MACHINE_X64', + include_directories: include_directories(efi_incdir, efi_incdir / gnu_efi_path_arch)) + have_gnu_efi = false + if get_option('gnu-efi') == 'true' + error('gnu-efi support requested, but found headers are too old (3.0.5+ required)') + endif + endif else have_gnu_efi = false endif diff --git a/src/boot/efi/missing_efi.h b/src/boot/efi/missing_efi.h index e3e0b978ef..b0bd00365f 100644 --- a/src/boot/efi/missing_efi.h +++ b/src/boot/efi/missing_efi.h @@ -5,61 +5,12 @@ #include "macro-fundamental.h" -#ifndef EFI_RNG_PROTOCOL_GUID - -#define EFI_RNG_PROTOCOL_GUID \ - { 0x3152bca5, 0xeade, 0x433d, {0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44} } - -typedef EFI_GUID EFI_RNG_ALGORITHM; - -#define EFI_RNG_ALGORITHM_SP800_90_HASH_256_GUID \ - {0xa7af67cb, 0x603b, 0x4d42, {0xba, 0x21, 0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96} } - -#define EFI_RNG_ALGORITHM_SP800_90_HMAC_256_GUID \ - {0xc5149b43, 0xae85, 0x4f53, {0x99, 0x82, 0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7} } - -#define EFI_RNG_ALGORITHM_SP800_90_CTR_256_GUID \ - {0x44f0de6e, 0x4d8c, 0x4045, {0xa8, 0xc7, 0x4d, 0xd1, 0x68, 0x85, 0x6b, 0x9e} } - -#define EFI_RNG_ALGORITHM_X9_31_3DES_GUID \ - {0x63c4785a, 0xca34, 0x4012, {0xa3, 0xc8, 0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46} } - -#define EFI_RNG_ALGORITHM_X9_31_AES_GUID \ - {0xacd03321, 0x777e, 0x4d3d, {0xb1, 0xc8, 0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9} } - -#define EFI_RNG_ALGORITHM_RAW \ - {0xe43176d7, 0xb6e8, 0x4827, {0xb7, 0x84, 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61} } - -INTERFACE_DECL(_EFI_RNG_PROTOCOL); - -typedef -EFI_STATUS -(EFIAPI *EFI_RNG_GET_INFO) ( - IN struct _EFI_RNG_PROTOCOL *This, - IN OUT UINTN *RNGAlgorithmListSize, - OUT EFI_RNG_ALGORITHM *RNGAlgorithmList -); - -typedef -EFI_STATUS -(EFIAPI *EFI_RNG_GET_RNG) ( - IN struct _EFI_RNG_PROTOCOL *This, - IN EFI_RNG_ALGORITHM *RNGAlgorithm, OPTIONAL - IN UINTN RNGValueLength, - OUT UINT8 *RNGValue -); - -typedef struct _EFI_RNG_PROTOCOL { - EFI_RNG_GET_INFO GetInfo; - EFI_RNG_GET_RNG GetRNG; -} EFI_RNG_PROTOCOL; - -#endif - +/* gnu-efi 3.0.13 */ #ifndef EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \ { 0xdd9e7534, 0x7762, 0x4698, {0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa} } +#define SimpleTextInputExProtocol ((EFI_GUID)EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID) #define EFI_SHIFT_STATE_VALID 0x80000000 #define EFI_RIGHT_CONTROL_PRESSED 0x00000004 @@ -123,10 +74,12 @@ typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL { #endif +/* gnu-efi 3.0.14 */ #ifndef EFI_IMAGE_MACHINE_RISCV64 #define EFI_IMAGE_MACHINE_RISCV64 0x5064 #endif +/* gnu-efi 3.0.14 */ #ifndef EFI_DTB_TABLE_GUID #define EFI_DTB_TABLE_GUID \ { 0xb1b621d5, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0} } @@ -163,6 +116,7 @@ struct _EFI_DT_FIXUP_PROTOCOL { #endif +/* TCG EFI Protocol Specification */ #ifndef EFI_TCG_GUID #define EFI_TCG_GUID \ @@ -262,6 +216,7 @@ typedef struct _EFI_TCG { #endif +/* TCG EFI Protocol Specification */ #ifndef EFI_TCG2_GUID #define EFI_TCG2_GUID \ diff --git a/src/boot/efi/pe.c b/src/boot/efi/pe.c index 518f5e66d0..6aecfe4526 100644 --- a/src/boot/efi/pe.c +++ b/src/boot/efi/pe.c @@ -3,6 +3,7 @@ #include <efi.h> #include <efilib.h> +#include "missing_efi.h" #include "pe.h" #include "util.h" diff --git a/src/boot/efi/shim.c b/src/boot/efi/shim.c index 0ccb90773a..3ce6af42f9 100644 --- a/src/boot/efi/shim.c +++ b/src/boot/efi/shim.c @@ -31,7 +31,6 @@ struct ShimLock { EFI_STATUS __sysv_abi__ (*read_header) (void *data, UINT32 datasize, void *context); }; -#define SIMPLE_FS_GUID &(const EFI_GUID) SIMPLE_FILE_SYSTEM_PROTOCOL #define SHIM_LOCK_GUID \ &(const EFI_GUID) { 0x605dab50, 0xe046, 0x4300, { 0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23 } } @@ -119,7 +118,7 @@ static EFIAPI EFI_STATUS security_policy_authentication (const EFI_SECURITY_PROT if (!dev_path) return EFI_OUT_OF_RESOURCES; - status = BS->LocateDevicePath((EFI_GUID*) SIMPLE_FS_GUID, &dev_path, &h); + status = BS->LocateDevicePath(&FileSystemProtocol, &dev_path, &h); if (EFI_ERROR(status)) return status; diff --git a/src/boot/efi/splash.c b/src/boot/efi/splash.c index c27203eb8c..fa923e77f2 100644 --- a/src/boot/efi/splash.c +++ b/src/boot/efi/splash.c @@ -256,7 +256,6 @@ static EFI_STATUS bmp_to_blt( EFI_STATUS graphics_splash(const UINT8 *content, UINTN len, const EFI_GRAPHICS_OUTPUT_BLT_PIXEL *background) { EFI_GRAPHICS_OUTPUT_BLT_PIXEL pixel = {}; - static const EFI_GUID GraphicsOutputProtocolGuid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput = NULL; struct bmp_dib *dib; struct bmp_map *map; @@ -281,7 +280,7 @@ EFI_STATUS graphics_splash(const UINT8 *content, UINTN len, const EFI_GRAPHICS_O background = &pixel; } - err = LibLocateProtocol((EFI_GUID*) &GraphicsOutputProtocolGuid, (void **)&GraphicsOutput); + err = LibLocateProtocol(&GraphicsOutputProtocol, (void **)&GraphicsOutput); if (EFI_ERROR(err)) return err; diff --git a/src/boot/efi/util.c b/src/boot/efi/util.c index bbde2d8702..9128c507c8 100644 --- a/src/boot/efi/util.c +++ b/src/boot/efi/util.c @@ -570,7 +570,6 @@ EFI_STATUS get_file_info_harder( EFI_FILE_INFO **ret, UINTN *ret_size) { - static const EFI_GUID EfiFileInfoGuid = EFI_FILE_INFO_ID; UINTN size = OFFSETOF(EFI_FILE_INFO, FileName) + 256; _cleanup_freepool_ EFI_FILE_INFO *fi = NULL; EFI_STATUS err; @@ -584,14 +583,14 @@ EFI_STATUS get_file_info_harder( if (!fi) return EFI_OUT_OF_RESOURCES; - err = handle->GetInfo(handle, (EFI_GUID*) &EfiFileInfoGuid, &size, fi); + err = handle->GetInfo(handle, &GenericFileInfo, &size, fi); if (err == EFI_BUFFER_TOO_SMALL) { FreePool(fi); fi = AllocatePool(size); /* GetInfo tells us the required size, let's use that now */ if (!fi) return EFI_OUT_OF_RESOURCES; - err = handle->GetInfo(handle, (EFI_GUID*) &EfiFileInfoGuid, &size, fi); + err = handle->GetInfo(handle, &GenericFileInfo, &size, fi); } if (EFI_ERROR(err)) |