bbc6a89
From c5841ba7f0d14c193f20854e7e55b4f7ce9207d5 Mon Sep 17 00:00:00 2001
bbc6a89
From: Leif Lindholm <leif.lindholm@linaro.org>
bbc6a89
Date: Thu, 3 Aug 2017 11:04:25 +0100
6f1e3d5
Subject: [PATCH 059/198] efi: Add GRUB_PE32_MAGIC definition
bbc6a89
bbc6a89
Add a generic GRUB_PE32_MAGIC definition for the PE 'MZ' tag and delete
bbc6a89
the existing one in arm64/linux.h.
bbc6a89
bbc6a89
Update arm64 Linux loader to use this new definition.
bbc6a89
bbc6a89
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
bbc6a89
---
bbc6a89
 grub-core/loader/arm64/linux.c | 2 +-
bbc6a89
 include/grub/arm64/linux.h     | 2 --
bbc6a89
 include/grub/efi/pe32.h        | 2 ++
bbc6a89
 3 files changed, 3 insertions(+), 3 deletions(-)
bbc6a89
bbc6a89
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
bbc6a89
index 3e2f9b742..a652ee908 100644
bbc6a89
--- a/grub-core/loader/arm64/linux.c
bbc6a89
+++ b/grub-core/loader/arm64/linux.c
bbc6a89
@@ -52,7 +52,7 @@ grub_arm64_uefi_check_image (struct grub_arm64_linux_kernel_header * lh)
bbc6a89
   if (lh->magic != GRUB_ARM64_LINUX_MAGIC)
bbc6a89
     return grub_error(GRUB_ERR_BAD_OS, "invalid magic number");
bbc6a89
 
bbc6a89
-  if ((lh->code0 & 0xffff) != GRUB_EFI_PE_MAGIC)
bbc6a89
+  if ((lh->code0 & 0xffff) != GRUB_PE32_MAGIC)
bbc6a89
     return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
bbc6a89
 		       N_("plain image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled"));
bbc6a89
 
bbc6a89
diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h
bbc6a89
index 1ea23696e..a981df5d1 100644
bbc6a89
--- a/include/grub/arm64/linux.h
bbc6a89
+++ b/include/grub/arm64/linux.h
bbc6a89
@@ -23,8 +23,6 @@
bbc6a89
 
bbc6a89
 #define GRUB_ARM64_LINUX_MAGIC 0x644d5241 /* 'ARM\x64' */
bbc6a89
 
bbc6a89
-#define GRUB_EFI_PE_MAGIC	0x5A4D
bbc6a89
-
bbc6a89
 /* From linux/Documentation/arm64/booting.txt */
bbc6a89
 struct grub_arm64_linux_kernel_header
bbc6a89
 {
bbc6a89
diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h
bbc6a89
index f79c36c02..7d44732d2 100644
bbc6a89
--- a/include/grub/efi/pe32.h
bbc6a89
+++ b/include/grub/efi/pe32.h
bbc6a89
@@ -45,6 +45,8 @@
bbc6a89
 
bbc6a89
 #define GRUB_PE32_MSDOS_STUB_SIZE	0x80
bbc6a89
 
bbc6a89
+#define GRUB_PE32_MAGIC			0x5a4d
bbc6a89
+
bbc6a89
 /* According to the spec, the minimal alignment is 512 bytes...
bbc6a89
    But some examples (such as EFI drivers in the Intel
bbc6a89
    Sample Implementation) use 32 bytes (0x20) instead, and it seems
bbc6a89
-- 
da63b36
2.14.3
bbc6a89