* util/grub-mkimage.c: Introduce new define EFI32_HEADER_SIZE.

This commit is contained in:
Francesco Lavra 2013-04-04 20:07:44 +02:00 committed by Vladimir 'phcoder' Serbinenko
parent aa42823871
commit c506fc3056
2 changed files with 13 additions and 12 deletions

View file

@ -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> 2013-04-04 Vladimir Serbinenko <phcoder@gmail.com>
Unify file copying setup across different install scripts. Add Unify file copying setup across different install scripts. Add

View file

@ -91,6 +91,13 @@ struct image_target_desc
grub_uint16_t pe_target; 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 \ #define EFI64_HEADER_SIZE ALIGN_UP (GRUB_PE32_MSDOS_STUB_SIZE \
+ GRUB_PE32_SIGNATURE_SIZE \ + GRUB_PE32_SIGNATURE_SIZE \
+ sizeof (struct grub_pe32_coff_header) \ + sizeof (struct grub_pe32_coff_header) \
@ -182,12 +189,7 @@ struct image_target_desc image_targets[] =
.decompressor_uncompressed_size = TARGET_NO_FIELD, .decompressor_uncompressed_size = TARGET_NO_FIELD,
.decompressor_uncompressed_addr = TARGET_NO_FIELD, .decompressor_uncompressed_addr = TARGET_NO_FIELD,
.section_align = GRUB_PE32_SECTION_ALIGNMENT, .section_align = GRUB_PE32_SECTION_ALIGNMENT,
.vaddr_offset = ALIGN_UP (GRUB_PE32_MSDOS_STUB_SIZE .vaddr_offset = EFI32_HEADER_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),
.pe_target = GRUB_PE32_MACHINE_I386, .pe_target = GRUB_PE32_MACHINE_I386,
.elf_target = EM_386, .elf_target = EM_386,
}, },
@ -1101,12 +1103,7 @@ generate_image (const char *dir, const char *prefix,
int reloc_addr; int reloc_addr;
if (image_target->voidp_sizeof == 4) if (image_target->voidp_sizeof == 4)
header_size = ALIGN_UP (GRUB_PE32_MSDOS_STUB_SIZE header_size = EFI32_HEADER_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);
else else
header_size = EFI64_HEADER_SIZE; header_size = EFI64_HEADER_SIZE;