Received: from list by lists.gnu.org with archive (Exim 4.71) id 1gatsI-0002w7-3K for mharc-grub-devel@gnu.org; Sat, 22 Dec 2018 21:52:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gatsG-0002vd-0b for grub-devel@gnu.org; Sat, 22 Dec 2018 21:52:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gatsB-0006Jr-38 for grub-devel@gnu.org; Sat, 22 Dec 2018 21:52:15 -0500 Received: from mx2.suse.de ([195.135.220.15]:44730 helo=mx1.suse.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gatsA-0006IK-RL for grub-devel@gnu.org; Sat, 22 Dec 2018 21:52:10 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id BBD61AF31; Sun, 23 Dec 2018 02:52:08 +0000 (UTC) From: Alexander Graf To: grub-devel@gnu.org Cc: Leif Lindholm , Peter Jones , Jon Masters , Ard Biesheuvel Subject: [PATCH v2 1/2] mkimage: Simplify header size logic Date: Sun, 23 Dec 2018 03:52:06 +0100 Message-Id: <20181223025207.40755-2-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20181223025207.40755-1-agraf@suse.de> References: <20181223025207.40755-1-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 195.135.220.15 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2018 02:52:16 -0000 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: Alexander Graf --- util/mkimage.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/util/mkimage.c b/util/mkimage.c index 353bb1098..88b991764 100644 --- a/util/mkimage.c +++ b/util/mkimage.c @@ -1226,10 +1226,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); -- 2.12.3