From patchwork Mon Jan 28 13:35:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 156737 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3435521jaa; Mon, 28 Jan 2019 05:36:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN7aEdSqUzmOxbWK92/nsPlv9u8SjGGWTr/wRtMXqDf22LpF2MRaxz67fhayZ6z5LmxZRsX2 X-Received: by 2002:adf:eec9:: with SMTP id a9mr21496797wrp.242.1548682559923; Mon, 28 Jan 2019 05:35:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548682559; cv=none; d=google.com; s=arc-20160816; b=AODIF1Z0Th75A02wH056pyYQaPRveVmmB+jTieFbTLkXWrx2TBvjt0qsT/LIcnpiSP B8O9zvyJoZ6b8cKh4r6GSpv7I8AjeeJp+9GPHfjyc5FygPof2YovjZ2UrZ9AO1vyqkmm Jq5vwJ5yHqm1fSPXKX4Z1p2JnV6izh5Ln3p7iZBNtxHlYFXf0hF0pfMdT1Y4A4Pc9nq5 QiKqTka3tYU7H+GTq55yXCGuRynV3FKkf/M7RljTKM1p2+hYndV1ingClrOeRL8GokrY CtFWdxoGRj+bv1OTy2XO7hZRtO0difWw/El0Qatvc+hV+hOBROQg0DI/wfdeSQZPjvHa i0pA== 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=XFX8cB6d/hxrIdroQEPla+ZuaFljY2eFaDCqc+pX8aY=; b=CvJepr7Ocfw9Y7oupJ3KJ/ZW9JoAQTGw795o1uUN1YNan9m4qwLKt6Ign+xOg+rI3S 7k/SfsSfamd8pUgDn8oXnMBB7bbsjUzIB/fgMUhU6cOG3tKx3/8DwuqwqL8pa8EAAwrY tCCdRY67jJzZTiFdG1S7DwnMK8pr96kuq+6HEI+VqzZhKjMlqV+XE238b3kdubm33UEd 8JxrRkQ/73pe3SA4Gx5l55W1Kx3eBvXZXVvANSEYTO/9ZP9rK1/N/n8ZPTZU2t0GBlYi sngR0KUvBXrLgTSol2A7gUaPyp9YzfY0HWumgLkgUWCHTDubxhFgVPxTsHf/KLC+UB9Q wulw== 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 x7si39439733wrd.354.2019.01.28.05.35.59 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 28 Jan 2019 05:35:59 -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]:60321 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1go74w-00037W-TC for patch@linaro.org; Mon, 28 Jan 2019 08:35:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1go74i-00035a-FK for grub-devel@gnu.org; Mon, 28 Jan 2019 08:35:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1go74h-0000yx-Ka for grub-devel@gnu.org; Mon, 28 Jan 2019 08:35:44 -0500 Received: from mx2.suse.de ([195.135.220.15]:39746 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 1go74h-0000ME-9U for grub-devel@gnu.org; Mon, 28 Jan 2019 08:35:43 -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 9DBE3ACBF; Mon, 28 Jan 2019 13:35:29 +0000 (UTC) From: Alexander Graf To: grub-devel@gnu.org Subject: [PATCH v6 1/3] mkimage: Use EFI32_HEADER_SIZE define in arm-efi case Date: Mon, 28 Jan 2019 14:35:27 +0100 Message-Id: <20190128133529.82445-2-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190128133529.82445-1-agraf@suse.de> References: <20190128133529.82445-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 , Leif Lindholm , Daniel Kiper MIME-Version: 1.0 Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: "Grub-devel" The efi-arm case was defining its own header size calculation, even though it's 100% identical to the common EFI32_HEADER_SIZE definition. So let's clean it up to use the common define. Signed-off-by: Alexander Graf Reviewed-by: Daniel Kiper --- util/mkimage.c | 7 +------ 1 file changed, 1 insertion(+), 6 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..16af12e0c 100644 --- a/util/mkimage.c +++ b/util/mkimage.c @@ -602,12 +602,7 @@ static const struct grub_install_image_target_desc image_targets[] = .decompressor_uncompressed_size = TARGET_NO_FIELD, .decompressor_uncompressed_addr = TARGET_NO_FIELD, .section_align = GRUB_PE32_SECTION_ALIGNMENT, - .vaddr_offset = ALIGN_UP (GRUB_PE32_MSDOS_STUB_SIZE - + GRUB_PE32_SIGNATURE_SIZE - + sizeof (struct grub_pe32_coff_header) - + sizeof (struct grub_pe32_optional_header) - + 4 * sizeof (struct grub_pe32_section_table), - GRUB_PE32_SECTION_ALIGNMENT), + .vaddr_offset = EFI32_HEADER_SIZE, .pe_target = GRUB_PE32_MACHINE_ARMTHUMB_MIXED, .elf_target = EM_ARM, }, From patchwork Mon Jan 28 13:35:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 156736 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3435505jaa; Mon, 28 Jan 2019 05:35:58 -0800 (PST) X-Google-Smtp-Source: ALg8bN7AO7tMl6+XhBteKsO1mhbXQMBzOSLQ6OIEn/Jxm/mnsiePofM/HjkMRtrqDnbwNFz9i6zZ X-Received: by 2002:adf:f9cb:: with SMTP id w11mr21457521wrr.201.1548682558914; Mon, 28 Jan 2019 05:35:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548682558; cv=none; d=google.com; s=arc-20160816; b=NenyrvZPckhZ+wFfzhKXCwmbnN4Xxna3xQOpVa7t2qTUcfnUueokWPCtoZkLJOPOBH mG6nQj3n91zXgrzvrPj+RmBUqKHEAtQ4oHXjC9PFwQUvP9FeALFjgtYfOzHviHEJBwxK wdYCBFXrLgw/zT/6WeyrYCM06P6DBSNp/WdhUW0icnFAxIrbKZbJ0BvrlDzJ+7xHmEqj LPccQCAtU3s4atQ1cvmUXGrtzLx17gfVoP1WvWrqYi1VEX5EHiH08wcG6bZW61cngEmB sWhpTGwZS+4fwzj+UJF1iMhU9xlmAEn5MpTrexGkIJ1nMYNbwz/SyLSDuP9cVZJICuOe S9JA== 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=fxJ9pufsbU0rT/iujhjZ5F5z/O9n/eb3hTiqELuY3Ok=; b=f5G7FNc02ZS52aeOExcDUSHPS4LXMeCaPDdI+2UiK1m40zp5zsczf+VQ0nZqFdY6he sKsokWOAfoR9v3qQHHIJSB4I9HZkKx1NxtqBq7XuLBe0NBQjW3G1Hx+xob9Mt+beN5qL QE+tl+kQS5/BgfrxtnoPOevZQgXB+HlBg0nZm+PanW3tHb9arP0tPNs6BFLznFTrQKAZ 7qnEIIYWOVWcPx7yZIT9fBkJQu548voeoNgLJ/eAlA7kP5IRF+HQ9X1pKCLkExWY1RcP rj3Q/vSSm7zbqxUJInLKwRETXUP41G7ZtoyUqb7N4RSf9oepo/TQoa18EvUOodpa33Mc l2QA== 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 h17si79596136wrx.323.2019.01.28.05.35.58 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 28 Jan 2019 05:35:58 -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]:60319 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1go74v-00036q-Ss for patch@linaro.org; Mon, 28 Jan 2019 08:35:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1go74i-00035k-KL for grub-devel@gnu.org; Mon, 28 Jan 2019 08:35:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1go74h-0000zW-Mi for grub-devel@gnu.org; Mon, 28 Jan 2019 08:35:44 -0500 Received: from mx2.suse.de ([195.135.220.15]:39744 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 1go74h-0000MB-Br for grub-devel@gnu.org; Mon, 28 Jan 2019 08:35:43 -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 9BD62ABB1; Mon, 28 Jan 2019 13:35:29 +0000 (UTC) From: Alexander Graf To: grub-devel@gnu.org Subject: [PATCH v6 2/3] mkimage: Align efi sections on 4k boundary Date: Mon, 28 Jan 2019 14:35:28 +0100 Message-Id: <20190128133529.82445-3-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190128133529.82445-1-agraf@suse.de> References: <20190128133529.82445-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 , Leif Lindholm , Daniel Kiper MIME-Version: 1.0 Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: "Grub-devel" There is UEFI firmware popping up in the wild now that implements stricter permission checks using NX and write protect page table entry bits. This means that firmware now may fail to load binaries if its individual sections are not page aligned, as otherwise it can not ensure permission boundaries. So let's bump all efi section alignments up to 4k (EFI page size). That way we will stay compatible going forward. Unfortunately our internals can't deal very well with a mismatch of alignment between the virtual and file offsets, so we have to also pad our target binary a bit. Signed-off-by: Alexander Graf --- v4 -> v5: - Use GRUB_EFI_PAGE_SIZE - Add include to have above const defined v5 -> v6: - Fix comment --- include/grub/efi/pe32.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) -- 2.12.3 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h index 7d44732d2..207b0382e 100644 --- a/include/grub/efi/pe32.h +++ b/include/grub/efi/pe32.h @@ -20,6 +20,7 @@ #define GRUB_EFI_PE32_HEADER 1 #include +#include /* The MSDOS compatibility stub. This was copied from the output of objcopy, and it is not necessary to care about what this means. */ @@ -50,8 +51,14 @@ /* According to the spec, the minimal alignment is 512 bytes... But some examples (such as EFI drivers in the Intel Sample Implementation) use 32 bytes (0x20) instead, and it seems - to be working. For now, GRUB uses 512 bytes for safety. */ -#define GRUB_PE32_SECTION_ALIGNMENT 0x200 + to be working. + + However, there is firmware showing up in the field now with + page alignment constraints to guarantee that page protection + bits take effect. Because currently existing GRUB code can not + properly distinguish between in-memory and in-file layout, let's + bump all alignment to GRUB_EFI_PAGE_SIZE. */ +#define GRUB_PE32_SECTION_ALIGNMENT GRUB_EFI_PAGE_SIZE #define GRUB_PE32_FILE_ALIGNMENT GRUB_PE32_SECTION_ALIGNMENT struct grub_pe32_coff_header From patchwork Mon Jan 28 13:35:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 156738 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3436411jaa; Mon, 28 Jan 2019 05:36:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN5l0udBqH45G1oAYImzB8653hJXUjfQRqbvItCUHrGdvlT0DsK8umze3k5wl96Xta5Jcnbl X-Received: by 2002:adf:b6a1:: with SMTP id j33mr21783379wre.55.1548682611799; Mon, 28 Jan 2019 05:36:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548682611; cv=none; d=google.com; s=arc-20160816; b=bCa8bjb0Cfl5NpBVgX0kjMyS5C6Z3HvN0ZBCbWQcZYzc+4BcG1ZHPCPntWjxpXboc5 yAWXxAuZWR5MZ1EJuPfuT6yO+Ia599dG3wEseIglHp9Mpvh1iWWBOkkoU7YPtoy+72VZ bw1YO3buAZ3Qphvtsd0boLGidvInfyd3QgRXjjGHurV+i0AINBEpzPBZHrknhWlOoOr6 aNeBNqQmXBB9k1aPj5F/gW3SyIkkdt8zFnEfq5iGB0NdF7V7I79O11eV/7cHiQQub4MN ynQj8JbGG8r+ifu7KL9BaL4r/TAwYCRFoW9xo/ZNyCWOaZQ2m9FrNaSUS4qHwqJykPz0 SUcA== 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=4MmKCwUOJfIme9HqQZeXz4vB2ylwNuR32HZlqBzHxAM=; b=rbj10NmAcunVqSiuIUl52H+o0AP61qGrOU1mvvVruLJhrEcjqIFAuEOjxgYVEv4QIl mcLoqinpggIX23cmcuRAucffqD3gLc+4aWrupjRog9wjgH0ZjcO6+UTPE0+WTqVmGJVz MQ4wJ8BeRdc9B+P6gEZ6RwAD1IkIUW6JAEog7JAcIo++xiolj4vM3lp4j2LQeGHVGDwr RK357JS/25puHusFCwQuFUvxWEcBU/HqSk2A/hppVZCl/A7YelpBPIfXSdy/pM/LgHPC 3i5ILVMDYNx2L5maf27kj8Ia5JlLq2VTwHpL1aZkGb0DPa3fcJJraiGGp5/5OAoK6RrX 8m7A== 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 k11si79031762wrp.39.2019.01.28.05.36.51 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 28 Jan 2019 05:36: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]:60329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1go75m-0003vR-Pw for patch@linaro.org; Mon, 28 Jan 2019 08:36:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58628) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1go74i-00035q-R8 for grub-devel@gnu.org; Mon, 28 Jan 2019 08:35:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1go74h-000100-PP for grub-devel@gnu.org; Mon, 28 Jan 2019 08:35:44 -0500 Received: from mx2.suse.de ([195.135.220.15]:39750 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 1go74h-0000MI-Gq for grub-devel@gnu.org; Mon, 28 Jan 2019 08:35:43 -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 9CE39ABC3; Mon, 28 Jan 2019 13:35:29 +0000 (UTC) From: Alexander Graf To: grub-devel@gnu.org Subject: [PATCH v6 3/3] mkimage: Clarify file alignment in efi case Date: Mon, 28 Jan 2019 14:35:29 +0100 Message-Id: <20190128133529.82445-4-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190128133529.82445-1-agraf@suse.de> References: <20190128133529.82445-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 , Leif Lindholm , Daniel Kiper MIME-Version: 1.0 Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: "Grub-devel" There are a few spots in the PE generation code for EFI binaries that uses the section alignment rather than file alignment, even though the alignment is really only file bound. Replace those cases with the file alignment constant instead. Reported-by: Daniel Kiper Signed-off-by: Alexander Graf --- v5 -> v6: - Change EFIxxHEADER_SIZE macros too --- util/mkimage.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 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 16af12e0c..cf1a47c94 100644 --- a/util/mkimage.c +++ b/util/mkimage.c @@ -66,14 +66,14 @@ + sizeof (struct grub_pe32_coff_header) \ + sizeof (struct grub_pe32_optional_header) \ + 4 * sizeof (struct grub_pe32_section_table), \ - GRUB_PE32_SECTION_ALIGNMENT) + GRUB_PE32_FILE_ALIGNMENT) #define EFI64_HEADER_SIZE ALIGN_UP (GRUB_PE32_MSDOS_STUB_SIZE \ + GRUB_PE32_SIGNATURE_SIZE \ + sizeof (struct grub_pe32_coff_header) \ + sizeof (struct grub_pe64_optional_header) \ + 4 * sizeof (struct grub_pe32_section_table), \ - GRUB_PE32_SECTION_ALIGNMENT) + GRUB_PE32_FILE_ALIGNMENT) static const struct grub_install_image_target_desc image_targets[] = { @@ -1227,10 +1227,10 @@ grub_install_generate_image (const char *dir, const char *prefix, header_size = EFI64_HEADER_SIZE; reloc_addr = ALIGN_UP (header_size + core_size, - image_target->section_align); + GRUB_PE32_FILE_ALIGNMENT); pe_size = ALIGN_UP (reloc_addr + layout.reloc_size, - image_target->section_align); + GRUB_PE32_FILE_ALIGNMENT); pe_img = xmalloc (reloc_addr + layout.reloc_size); memset (pe_img, 0, header_size); memcpy ((char *) pe_img + header_size, core_img, core_size); @@ -1280,7 +1280,7 @@ grub_install_generate_image (const char *dir, const char *prefix, o->image_base = 0; o->section_alignment = grub_host_to_target32 (image_target->section_align); - o->file_alignment = grub_host_to_target32 (image_target->section_align); + o->file_alignment = grub_host_to_target32 (GRUB_PE32_FILE_ALIGNMENT); o->image_size = grub_host_to_target32 (pe_size); o->header_size = grub_host_to_target32 (header_size); o->subsystem = grub_host_to_target16 (GRUB_PE32_SUBSYSTEM_EFI_APPLICATION); @@ -1315,7 +1315,7 @@ grub_install_generate_image (const char *dir, const char *prefix, o->code_base = grub_cpu_to_le32 (header_size); o->image_base = 0; o->section_alignment = grub_host_to_target32 (image_target->section_align); - o->file_alignment = grub_host_to_target32 (image_target->section_align); + o->file_alignment = grub_host_to_target32 (GRUB_PE32_FILE_ALIGNMENT); o->image_size = grub_host_to_target32 (pe_size); o->header_size = grub_host_to_target32 (header_size); o->subsystem = grub_host_to_target16 (GRUB_PE32_SUBSYSTEM_EFI_APPLICATION);