grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] mkimage: arm64-efi: Align first section to page


From: Alexander Graf
Subject: [PATCH 2/2] mkimage: arm64-efi: Align first section to page
Date: Wed, 28 Nov 2018 15:31:07 +0100

I encountered a broken edk2 implementation in the wild (HP Envy x2)
which fails to load PE binaries that have a non-page-aligned first
section (read: header is < 4k).

Work around this by just aligning the text start to page granule on the
arm64-efi target.

With this patch applied, I can successfully run grub on my HP Envy x2
system.

Signed-off-by: Alexander Graf <address@hidden>
---
 util/mkimage.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/util/mkimage.c b/util/mkimage.c
index 05333a76a..bfdb0328a 100644
--- a/util/mkimage.c
+++ b/util/mkimage.c
@@ -605,7 +605,8 @@ static const struct grub_install_image_target_desc 
image_targets[] =
       .decompressor_uncompressed_size = TARGET_NO_FIELD,
       .decompressor_uncompressed_addr = TARGET_NO_FIELD,
       .section_align = GRUB_PE32_SECTION_ALIGNMENT,
-      .vaddr_offset = EFI64_HEADER_SIZE,
+      /* Needed for some broken edk2 implementations */
+      .vaddr_offset = 4096,
       .pe_target = GRUB_PE32_MACHINE_ARM64,
       .elf_target = EM_AARCH64,
     },
-- 
2.19.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]