[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] mkimage: Simplify header size logic

From: Alexander Graf
Subject: [PATCH 1/2] mkimage: Simplify header size logic
Date: Wed, 28 Nov 2018 15:31:06 +0100

For EFI images, we always have the following layout:

  [PE header]
  [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: Alexander Graf <address@hidden>
 util/mkimage.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/util/mkimage.c b/util/mkimage.c
index b2f43fea6..05333a76a 100644
--- a/util/mkimage.c
+++ b/util/mkimage.c
@@ -1206,10 +1206,7 @@ grub_install_generate_image (const char *dir, const char 
        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,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]