From patchwork Mon Jan 14 15:27:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 155542 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3795986jaa; Mon, 14 Jan 2019 07:40:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN5zns+uTrZxyPLg66ksnjd2IK0Wg+i4e81G/3JtaddbEDKFuik5D3zpzb9POe5GTHBygGip X-Received: by 2002:adf:f1cb:: with SMTP id z11mr24467032wro.35.1547480451873; Mon, 14 Jan 2019 07:40:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547480451; cv=none; d=google.com; s=arc-20160816; b=FVyGNb27poa+WTMLjGnZSwZ4kkbEhVmIK1+JqwYgRA6oWlHUddoVNh+4ut2b2UYg+d 88bHv5BlNWbNuhYcDuP9B1Nn/465eqnW3FvImh7xc+KbReqqg4tUBe8dgNTu+1avSzW+ BPROth7GAICGPjlwCFMNX108zkLHn89ZF/lnjl/xDp5uzGIcxWekZ6ZE8o2/CgFTkVmb Yyo+mXPtjVFrhqkp5i+TV0GOQQ99pnSMeO+s1l2MGrJIm/01uC4O8TblMpGg5iozeKy0 BsZR1ZX+dXSvQM1N8KK5oY2AutzUKZHLfEMXvC/qEwtsO6+49Pv2D+zm1s9qaWfWLjkj UhCg== 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=Pgk1y8BdXjaVGAlbJ0ZhLRo+hzUBYVM9yLEG68HcaTA=; b=li7Puz0+HRlYYKxDwZH4JidgULzSdHEY5YN1IXOne5r+FmazJCCCklao97AF4rU8sM 7101eKk1IXmqDGwwCdanGUhAjhFb0JfsmbrDkuzrLITcU962/zIgHxClSD9InL+uL3dv o3nKgq+NjVEDEdFjgBM582QLUyYwewsEt516oj3kurhM9iAHdxhlVj3vZGfhHIBg8TAQ H1yLaQTaZC/zR3BjNwsme39WpE9SSBxZ7djJgumqOl7FAL6IkqgmdMEzPVMJC6+sFgaZ q3gHIWJ8PBdgAZ5uWKLQrRFWVHyVVaGtaaGmGmfHpwAXpTcp50h5YK6eKQPb5pdT39Wh SqeQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z16si18452735wmc.53.2019.01.14.07.40.51 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 14 Jan 2019 07:40:51 -0800 (PST) Received-SPF: pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org" Received: from localhost ([127.0.0.1]:56431 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj4M6-000733-TX for patch@linaro.org; Mon, 14 Jan 2019 10:40:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj495-0003MI-Lf for grub-devel@gnu.org; Mon, 14 Jan 2019 10:27:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj492-000893-5K for grub-devel@gnu.org; Mon, 14 Jan 2019 10:27:21 -0500 Received: from mx2.suse.de ([195.135.220.15]:36414 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 1gj491-00088g-Tr for grub-devel@gnu.org; Mon, 14 Jan 2019 10:27:20 -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 D25A5AF92; Mon, 14 Jan 2019 15:27:18 +0000 (UTC) From: Alexander Graf To: grub-devel@gnu.org Subject: [PATCH v3 1/4] mkimage: Simplify header size logic Date: Mon, 14 Jan 2019 16:27:15 +0100 Message-Id: <20190114152718.60629-2-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190114152718.60629-1-agraf@suse.de> References: <20190114152718.60629-1-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] 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: Jon Masters , Daniel Kiper , Leif Lindholm , 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 Reviewed-by: Daniel Kiper --- util/mkimage.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) -- 2.12.3 _______________________________________________ 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 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);