diff mbox series

[v2,07/14] efi: Add GRUB_PE32_MAGIC definition

Message ID 20170803100432.29913-8-leif.lindholm@linaro.org
State New
Headers show
Series efi: improved correctness, arm unification, and cleanup | expand

Commit Message

Leif Lindholm Aug. 3, 2017, 10:04 a.m. UTC
Add a generic GRUB_PE32_MAGIC definition for the PE 'MZ' tag and delete
the existing one in arm64/linux.h.

Update arm64 Linux loader to use this new definition.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

---
 grub-core/loader/arm64/linux.c | 2 +-
 include/grub/arm64/linux.h     | 2 --
 include/grub/efi/pe32.h        | 2 ++
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.11.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Comments

Vladimir 'phcoder' Serbinenko Aug. 3, 2017, 4:35 p.m. UTC | #1
LGTM

On Thu, Aug 3, 2017, 12:09 Leif Lindholm <leif.lindholm@linaro.org> wrote:

> Add a generic GRUB_PE32_MAGIC definition for the PE 'MZ' tag and delete

> the existing one in arm64/linux.h.

>

> Update arm64 Linux loader to use this new definition.

>

> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---

>  grub-core/loader/arm64/linux.c | 2 +-

>  include/grub/arm64/linux.h     | 2 --

>  include/grub/efi/pe32.h        | 2 ++

>  3 files changed, 3 insertions(+), 3 deletions(-)

>

> diff --git a/grub-core/loader/arm64/linux.c

> b/grub-core/loader/arm64/linux.c

> index cac94d53d..57ee43fac 100644

> --- a/grub-core/loader/arm64/linux.c

> +++ b/grub-core/loader/arm64/linux.c

> @@ -53,7 +53,7 @@ grub_arm64_uefi_check_image (struct

> grub_arm64_linux_kernel_header * lh)

>    if (lh->magic != GRUB_ARM64_LINUX_MAGIC)

>      return grub_error(GRUB_ERR_BAD_OS, "invalid magic number");

>

> -  if ((lh->code0 & 0xffff) != GRUB_EFI_PE_MAGIC)

> +  if ((lh->code0 & 0xffff) != GRUB_PE32_MAGIC)

>      return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,

>                        N_("plain image kernel not supported - rebuild with

> CONFIG_(U)EFI_STUB enabled"));

>

> diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h

> index 1ea23696e..a981df5d1 100644

> --- a/include/grub/arm64/linux.h

> +++ b/include/grub/arm64/linux.h

> @@ -23,8 +23,6 @@

>

>  #define GRUB_ARM64_LINUX_MAGIC 0x644d5241 /* 'ARM\x64' */

>

> -#define GRUB_EFI_PE_MAGIC      0x5A4D

> -

>  /* From linux/Documentation/arm64/booting.txt */

>  struct grub_arm64_linux_kernel_header

>  {

> diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h

> index f79c36c02..7d44732d2 100644

> --- a/include/grub/efi/pe32.h

> +++ b/include/grub/efi/pe32.h

> @@ -45,6 +45,8 @@

>

>  #define GRUB_PE32_MSDOS_STUB_SIZE      0x80

>

> +#define GRUB_PE32_MAGIC                        0x5a4d

> +

>  /* According to the spec, the minimal alignment is 512 bytes...

>     But some examples (such as EFI drivers in the Intel

>     Sample Implementation) use 32 bytes (0x20) instead, and it seems

> --

> 2.11.0

>

>

> _______________________________________________

> Grub-devel mailing list

> Grub-devel@gnu.org

> https://lists.gnu.org/mailman/listinfo/grub-devel

>
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
diff mbox series

Patch

diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
index cac94d53d..57ee43fac 100644
--- a/grub-core/loader/arm64/linux.c
+++ b/grub-core/loader/arm64/linux.c
@@ -53,7 +53,7 @@  grub_arm64_uefi_check_image (struct grub_arm64_linux_kernel_header * lh)
   if (lh->magic != GRUB_ARM64_LINUX_MAGIC)
     return grub_error(GRUB_ERR_BAD_OS, "invalid magic number");
 
-  if ((lh->code0 & 0xffff) != GRUB_EFI_PE_MAGIC)
+  if ((lh->code0 & 0xffff) != GRUB_PE32_MAGIC)
     return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
 		       N_("plain image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled"));
 
diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h
index 1ea23696e..a981df5d1 100644
--- a/include/grub/arm64/linux.h
+++ b/include/grub/arm64/linux.h
@@ -23,8 +23,6 @@ 
 
 #define GRUB_ARM64_LINUX_MAGIC 0x644d5241 /* 'ARM\x64' */
 
-#define GRUB_EFI_PE_MAGIC	0x5A4D
-
 /* From linux/Documentation/arm64/booting.txt */
 struct grub_arm64_linux_kernel_header
 {
diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h
index f79c36c02..7d44732d2 100644
--- a/include/grub/efi/pe32.h
+++ b/include/grub/efi/pe32.h
@@ -45,6 +45,8 @@ 
 
 #define GRUB_PE32_MSDOS_STUB_SIZE	0x80
 
+#define GRUB_PE32_MAGIC			0x5a4d
+
 /* According to the spec, the minimal alignment is 512 bytes...
    But some examples (such as EFI drivers in the Intel
    Sample Implementation) use 32 bytes (0x20) instead, and it seems