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

73 lines
2.5 KiB
Diff
Raw Normal View History

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