nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0256-util-grub-mkimage.c-Introduce-new-define-EFI32_HEADE.patch

f96e0b
From acc679d013ced54cd51b285443bbadbb64ddc545 Mon Sep 17 00:00:00 2001
f96e0b
From: Francesco Lavra <francescolavra.fl@gmail.com>
f96e0b
Date: Thu, 4 Apr 2013 20:07:44 +0200
f96e0b
Subject: [PATCH 256/482] 	* util/grub-mkimage.c: Introduce new define
f96e0b
 EFI32_HEADER_SIZE.
f96e0b
f96e0b
---
f96e0b
 ChangeLog           |  4 ++++
f96e0b
 util/grub-mkimage.c | 21 +++++++++------------
f96e0b
 2 files changed, 13 insertions(+), 12 deletions(-)
f96e0b
f96e0b
diff --git a/ChangeLog b/ChangeLog
f96e0b
index 94f2631..f2c2d2f 100644
f96e0b
--- a/ChangeLog
f96e0b
+++ b/ChangeLog
f96e0b
@@ -1,3 +1,7 @@
f96e0b
+2013-04-04  Francesco Lavra  <francescolavra.fl@gmail.com>
f96e0b
+
f96e0b
+	* util/grub-mkimage.c: Introduce new define EFI32_HEADER_SIZE.
f96e0b
+
f96e0b
 2013-04-04  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
 
f96e0b
 	Unify file copying setup across different install scripts. Add
f96e0b
diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c
f96e0b
index 845abed..ecea5d4 100644
f96e0b
--- a/util/grub-mkimage.c
f96e0b
+++ b/util/grub-mkimage.c
f96e0b
@@ -91,6 +91,13 @@ struct image_target_desc
f96e0b
   grub_uint16_t pe_target;
f96e0b
 };
f96e0b
 
f96e0b
+#define EFI32_HEADER_SIZE ALIGN_UP (GRUB_PE32_MSDOS_STUB_SIZE		\
f96e0b
+				    + GRUB_PE32_SIGNATURE_SIZE		\
f96e0b
+				    + sizeof (struct grub_pe32_coff_header) \
f96e0b
+				    + sizeof (struct grub_pe32_optional_header) \
f96e0b
+				    + 4 * sizeof (struct grub_pe32_section_table), \
f96e0b
+				    GRUB_PE32_SECTION_ALIGNMENT)
f96e0b
+
f96e0b
 #define EFI64_HEADER_SIZE ALIGN_UP (GRUB_PE32_MSDOS_STUB_SIZE		\
f96e0b
 				    + GRUB_PE32_SIGNATURE_SIZE		\
f96e0b
 				    + sizeof (struct grub_pe32_coff_header) \
f96e0b
@@ -182,12 +189,7 @@ struct image_target_desc image_targets[] =
f96e0b
       .decompressor_uncompressed_size = TARGET_NO_FIELD,
f96e0b
       .decompressor_uncompressed_addr = TARGET_NO_FIELD,
f96e0b
       .section_align = GRUB_PE32_SECTION_ALIGNMENT,
f96e0b
-      .vaddr_offset = ALIGN_UP (GRUB_PE32_MSDOS_STUB_SIZE
f96e0b
-				+ GRUB_PE32_SIGNATURE_SIZE
f96e0b
-				+ sizeof (struct grub_pe32_coff_header)
f96e0b
-				+ sizeof (struct grub_pe32_optional_header)
f96e0b
-				+ 4 * sizeof (struct grub_pe32_section_table),
f96e0b
-				GRUB_PE32_SECTION_ALIGNMENT),
f96e0b
+      .vaddr_offset = EFI32_HEADER_SIZE,
f96e0b
       .pe_target = GRUB_PE32_MACHINE_I386,
f96e0b
       .elf_target = EM_386,
f96e0b
     },
f96e0b
@@ -1101,12 +1103,7 @@ generate_image (const char *dir, const char *prefix,
f96e0b
 	int reloc_addr;
f96e0b
 
f96e0b
 	if (image_target->voidp_sizeof == 4)
f96e0b
-	  header_size = ALIGN_UP (GRUB_PE32_MSDOS_STUB_SIZE
f96e0b
-				  + GRUB_PE32_SIGNATURE_SIZE
f96e0b
-				  + sizeof (struct grub_pe32_coff_header)
f96e0b
-				  + sizeof (struct grub_pe32_optional_header)
f96e0b
-				  + 4 * sizeof (struct grub_pe32_section_table),
f96e0b
-				  GRUB_PE32_SECTION_ALIGNMENT);
f96e0b
+	  header_size = EFI32_HEADER_SIZE;
f96e0b
 	else
f96e0b
 	  header_size = EFI64_HEADER_SIZE;
f96e0b
 
f96e0b
-- 
f96e0b
1.8.2.1
f96e0b