From 9a383acaddb9403cc317d549b9bc34fd1305907a Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 30 Jan 2021 17:10:29 +0000 Subject: [PATCH 1/2] sd-boot: Make internal functions static --- src/boot/efi/boot.c | 2 +- src/boot/efi/random-seed.c | 2 +- src/boot/efi/splash.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c index 60305f07f9..e1a7dd1f32 100644 --- a/src/boot/efi/boot.c +++ b/src/boot/efi/boot.c @@ -2025,7 +2025,7 @@ static const UINT8 xbootldr_guid[16] = { 0xff, 0xc2, 0x13, 0xbc, 0xe6, 0x59, 0x62, 0x42, 0xa3, 0x52, 0xb2, 0x75, 0xfd, 0x6f, 0x71, 0x72 }; -EFI_DEVICE_PATH *path_parent(EFI_DEVICE_PATH *path, EFI_DEVICE_PATH *node) { +static EFI_DEVICE_PATH *path_parent(EFI_DEVICE_PATH *path, EFI_DEVICE_PATH *node) { EFI_DEVICE_PATH *parent; UINTN len; diff --git a/src/boot/efi/random-seed.c b/src/boot/efi/random-seed.c index eda9260ae0..895c85445e 100644 --- a/src/boot/efi/random-seed.c +++ b/src/boot/efi/random-seed.c @@ -142,7 +142,7 @@ static EFI_STATUS mangle_random_seed( return EFI_SUCCESS; } -EFI_STATUS acquire_system_token(VOID **ret, UINTN *ret_size) { +static EFI_STATUS acquire_system_token(VOID **ret, UINTN *ret_size) { _cleanup_freepool_ CHAR8 *data = NULL; EFI_STATUS err; UINTN size; diff --git a/src/boot/efi/splash.c b/src/boot/efi/splash.c index e166fec57a..552c45cff4 100644 --- a/src/boot/efi/splash.c +++ b/src/boot/efi/splash.c @@ -37,7 +37,7 @@ struct bmp_map { UINT8 reserved; } __attribute__((packed)); -EFI_STATUS bmp_parse_header(UINT8 *bmp, UINTN size, struct bmp_dib **ret_dib, +static EFI_STATUS bmp_parse_header(UINT8 *bmp, UINTN size, struct bmp_dib **ret_dib, struct bmp_map **ret_map, UINT8 **pixmap) { struct bmp_file *file; struct bmp_dib *dib; @@ -147,7 +147,7 @@ static VOID pixel_blend(UINT32 *dst, const UINT32 source) { *dst = (rb | g); } -EFI_STATUS bmp_to_blt(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *buf, +static EFI_STATUS bmp_to_blt(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *buf, struct bmp_dib *dib, struct bmp_map *map, UINT8 *pixmap) { UINT8 *in; From 47381f8f6403d46cd8a23617fe39b9b431a229c3 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 30 Jan 2021 17:21:48 +0000 Subject: [PATCH 2/2] sd-boot: Add missing includes Let's make all headers self-sufficient by including the necessary EFI headers in the headers themselves. --- src/boot/efi/disk.c | 1 + src/boot/efi/disk.h | 2 ++ src/boot/efi/graphics.h | 2 ++ src/boot/efi/linux.h | 2 ++ src/boot/efi/measure.h | 2 ++ src/boot/efi/pe.h | 2 ++ src/boot/efi/shim.h | 2 ++ src/boot/efi/splash.h | 2 ++ 8 files changed, 15 insertions(+) diff --git a/src/boot/efi/disk.c b/src/boot/efi/disk.c index 89508f86de..cc752956c3 100644 --- a/src/boot/efi/disk.c +++ b/src/boot/efi/disk.c @@ -3,6 +3,7 @@ #include #include +#include "disk.h" #include "util.h" EFI_STATUS disk_get_part_uuid(EFI_HANDLE *handle, CHAR16 uuid[static 37]) { diff --git a/src/boot/efi/disk.h b/src/boot/efi/disk.h index 551a9ae639..8e10bb7279 100644 --- a/src/boot/efi/disk.h +++ b/src/boot/efi/disk.h @@ -1,4 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once +#include + EFI_STATUS disk_get_part_uuid(EFI_HANDLE *handle, CHAR16 uuid[static 37]); diff --git a/src/boot/efi/graphics.h b/src/boot/efi/graphics.h index 116aae28c5..96f25d809a 100644 --- a/src/boot/efi/graphics.h +++ b/src/boot/efi/graphics.h @@ -5,4 +5,6 @@ */ #pragma once +#include + EFI_STATUS graphics_mode(BOOLEAN on); diff --git a/src/boot/efi/linux.h b/src/boot/efi/linux.h index b92c27c8b9..09be2de27b 100644 --- a/src/boot/efi/linux.h +++ b/src/boot/efi/linux.h @@ -1,6 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once +#include + #define SETUP_MAGIC 0x53726448 /* "HdrS" */ struct setup_header { diff --git a/src/boot/efi/measure.h b/src/boot/efi/measure.h index 19e148d922..e2873adae3 100644 --- a/src/boot/efi/measure.h +++ b/src/boot/efi/measure.h @@ -1,4 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once +#include + EFI_STATUS tpm_log_event(UINT32 pcrindex, const EFI_PHYSICAL_ADDRESS buffer, UINTN buffer_size, const CHAR16 *description); diff --git a/src/boot/efi/pe.h b/src/boot/efi/pe.h index 3e97d43f66..06a0fcd70c 100644 --- a/src/boot/efi/pe.h +++ b/src/boot/efi/pe.h @@ -1,6 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once +#include + EFI_STATUS pe_memory_locate_sections(CHAR8 *base, CHAR8 **sections, UINTN *addrs, UINTN *offsets, UINTN *sizes); EFI_STATUS pe_file_locate_sections(EFI_FILE *dir, CHAR16 *path, diff --git a/src/boot/efi/shim.h b/src/boot/efi/shim.h index 72ecf2ed97..e24fcdac54 100644 --- a/src/boot/efi/shim.h +++ b/src/boot/efi/shim.h @@ -9,6 +9,8 @@ */ #pragma once +#include + BOOLEAN shim_loaded(void); BOOLEAN secure_boot_enabled(void); diff --git a/src/boot/efi/splash.h b/src/boot/efi/splash.h index 0ba45a0370..b9f74ffbf2 100644 --- a/src/boot/efi/splash.h +++ b/src/boot/efi/splash.h @@ -1,4 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once +#include + EFI_STATUS graphics_splash(UINT8 *content, UINTN len, const EFI_GRAPHICS_OUTPUT_BLT_PIXEL *background);