From patchwork Wed Nov 28 14:31:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 152270 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1160579ljp; Wed, 28 Nov 2018 06:31:32 -0800 (PST) X-Google-Smtp-Source: AFSGD/WjD+wWibvIAQyYwa1h3fL+xbPbGnmLEwsS+7na6rNAfzji4O+7n0Nexqb7d6KVfLyjsZhQ X-Received: by 2002:a25:b990:: with SMTP id r16-v6mr37086181ybg.74.1543415492373; Wed, 28 Nov 2018 06:31:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543415492; cv=none; d=google.com; s=arc-20160816; b=FI3HmITEQzP2B3e80wvzzXAEOla84OkgWto0fUAg9axwwi+DUSc2SwklHN64s2taas M+ZYrqFHBWjZ//5M4ErenOmUkvxGGTolSjD4mc+/CxaTVi8n4NL0A9pPZee72CcxXzbb o/wbH9WLQ/nPhTgHjKlXl4uPP+R32NRvF0RlkpiampOoBEvgljGA2lcUE/ujf2kPoq/y h0nlEGA/XCRjOtuM94Q5oapoYRLy6PNBTGKPmoTaMEWleIPxWduGqAxZjLyYL1+ZLOW9 4QOh2XGkbwwxJ9B181lNZrgqPIGgc4JHxHPIXJMrbl+2vDWaq9aWMERLNzsFGYU4YCcq HlLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from; bh=YGcDAWrxmuJrKgjO3xTe9jA3xeCHS/gE2TNPEeAI+/g=; b=rUicehuJVEU/YWIsLcHs1czVtyyPmArepsn6nfwT24JZYSIL/bKxVVisnmJlWvzuCx FKUd2Xh71tEjGNIDD/8co9CtZR5IlQKXJTpXIf/48sWeyMuljvhUowcqKdqObcvjnRvX yY2Z5ieYk7X/huRMge6Ce8SCIVBhMau8+GjvO7faejvjLUf5yUflZNrHooCHtlBqBQma Em54HzoZq9KhnqJ7TtoSzrPJcBom68xC04+Gv7fGj9aw2Ulik5iARqxcq8vJYJjSM2Gh OHdoeAaZbX6116+O4QNOALJWF7biu5Uvr6hdWbc0D8FDzFoHcJz3PwULTGwI6KZTsCCA sd8g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v4si5225896ywh.60.2018.11.28.06.31.31 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 28 Nov 2018 06:31:32 -0800 (PST) Received-SPF: pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org" Received: from localhost ([::1]:48052 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gS0sF-0001qq-IF for patch@linaro.org; Wed, 28 Nov 2018 09:31:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gS0rw-0001ox-FK for grub-devel@gnu.org; Wed, 28 Nov 2018 09:31:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gS0rt-0008MS-9Y for grub-devel@gnu.org; Wed, 28 Nov 2018 09:31:12 -0500 Received: from mx2.suse.de ([195.135.220.15]:41148 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 1gS0rt-0008M2-22 for grub-devel@gnu.org; Wed, 28 Nov 2018 09:31:09 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D4108B0E5; Wed, 28 Nov 2018 14:31:07 +0000 (UTC) From: Alexander Graf To: grub-devel@gnu.org Subject: [PATCH 1/2] mkimage: Simplify header size logic Date: Wed, 28 Nov 2018 15:31:06 +0100 Message-Id: <20181128143107.37583-2-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20181128143107.37583-1-agraf@suse.de> References: <20181128143107.37583-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: , Reply-To: The development of GNU GRUB Cc: Nicolas Dechesne , Jon Masters , leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: "Grub-devel" 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(-) -- 2.19.0 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel 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 *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);