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