7b0564ba57
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
73 lines
2.5 KiB
Diff
73 lines
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Andrea Bolognani <abologna@redhat.com>
|
|
Date: Tue, 19 Nov 2024 15:42:01 +0000
|
|
Subject: [PATCH] loader/efi: Fix RISC-V build
|
|
|
|
Some struct definitions are currently limited to 32-bit and
|
|
64-bit Arm architectures, but they actually apply to other
|
|
architectures as well, specifically 32-bit and 64-bit RISC-V
|
|
respectively.
|
|
|
|
Update the preprocessor checks guarding their definition, and
|
|
change their names to make them more accurate by replacing the
|
|
word "arm" with the word "efi".
|
|
|
|
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
|
---
|
|
grub-core/loader/efi/linux.c | 2 +-
|
|
include/grub/efi/efi.h | 12 ++++++------
|
|
2 files changed, 7 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
|
|
index 5889e3f36f8..ef55556f2d9 100644
|
|
--- a/grub-core/loader/efi/linux.c
|
|
+++ b/grub-core/loader/efi/linux.c
|
|
@@ -684,7 +684,7 @@ parse_pe_header (void *kernel, grub_uint64_t *total_size,
|
|
grub_uint32_t *alignment, grub_uint32_t *code_size)
|
|
{
|
|
struct linux_arch_kernel_header *lh = kernel;
|
|
- struct grub_armxx_linux_pe_header *pe;
|
|
+ struct grub_efixx_linux_pe_header *pe;
|
|
grub_uint16_t i;
|
|
struct grub_pe32_section_table *sections;
|
|
|
|
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
|
|
index 7eed1bd791d..81daf6bead1 100644
|
|
--- a/include/grub/efi/efi.h
|
|
+++ b/include/grub/efi/efi.h
|
|
@@ -36,28 +36,28 @@ struct linux_arch_kernel_header {
|
|
struct grub_pe_image_header pe_image_header;
|
|
};
|
|
|
|
-struct grub_arm_linux_pe_header
|
|
+struct grub_efi32_linux_pe_header
|
|
{
|
|
grub_uint32_t magic;
|
|
struct grub_pe32_coff_header coff;
|
|
struct grub_pe32_optional_header opt;
|
|
};
|
|
|
|
-struct grub_arm64_linux_pe_header
|
|
+struct grub_efi64_linux_pe_header
|
|
{
|
|
grub_uint32_t magic;
|
|
struct grub_pe32_coff_header coff;
|
|
struct grub_pe64_optional_header opt;
|
|
};
|
|
|
|
-#if defined(__arm__)
|
|
+#if defined(__arm__) || (defined(__riscv) && (__riscv_xlen == 32))
|
|
# define GRUB_PE32_PEXX_MAGIC GRUB_PE32_PE32_MAGIC
|
|
-# define grub_armxx_linux_pe_header grub_arm_linux_pe_header
|
|
+# define grub_efixx_linux_pe_header grub_efi32_linux_pe_header
|
|
#endif
|
|
|
|
-#if defined(__aarch64__)
|
|
+#if defined(__aarch64__) || (defined(__riscv) && (__riscv_xlen == 64))
|
|
# define GRUB_PE32_PEXX_MAGIC GRUB_PE32_PE64_MAGIC
|
|
-# define grub_armxx_linux_pe_header grub_arm64_linux_pe_header
|
|
+# define grub_efixx_linux_pe_header grub_efi64_linux_pe_header
|
|
#endif
|
|
|
|
#define GRUB_EFI_GRUB_VARIABLE_GUID \
|