Commit f2b469a2 authored by Alexander Graf's avatar Alexander Graf Committed by Colin Watson

mkimage: Simplify header size logic

For EFI images, we always have the following layout:

  [PE header]
  [padding]
  [first section (which also is the entry point)]

Currently there are 2 places where we define how big header+padding are:
in the .vaddr_offset member of our target image definition struct as well
as in code in grub_install_generate_image().

Remove the latter, so that we only have a single place to modify if we
need to change the padding.
Signed-off-by: 's avatarAlexander Graf <agraf@suse.de>
Reviewed-by: 's avatarLeif Lindholm <leif.lindholm@linaro.org>
Tested-by: 's avatarLeif Lindholm <leif.lindholm@linaro.org>

Origin: other, https://lists.gnu.org/archive/html/grub-devel/2018-12/msg00054.html
Bug-Debian: https://bugs.debian.org/919012
Last-Update: 2019-01-12

Patch-Name: mkimage-simplify-header-size-logic.patch
parent 0e3e215f
......@@ -1169,10 +1169,7 @@ grub_install_generate_image (const char *dir, const char *prefix,
int header_size;
int reloc_addr;
if (image_target->voidp_sizeof == 4)
header_size = EFI32_HEADER_SIZE;
else
header_size = EFI64_HEADER_SIZE;
header_size = image_target->vaddr_offset;
reloc_addr = ALIGN_UP (header_size + core_size,
image_target->section_align);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment