Received: from list by lists.gnu.org with archive (Exim 4.71) id 1gS0ry-0001pC-Bc for mharc-grub-devel@gnu.org; Wed, 28 Nov 2018 09:31:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gS0rw-0001ov-Ey for grub-devel@gnu.org; Wed, 28 Nov 2018 09:31:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gS0rt-0008MR-9a for grub-devel@gnu.org; Wed, 28 Nov 2018 09:31:12 -0500 Received: from mx2.suse.de ([195.135.220.15]:41152 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-0008M3-25 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 relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id DCC53B0E7; Wed, 28 Nov 2018 14:31:07 +0000 (UTC) From: Alexander Graf To: grub-devel@gnu.org Cc: leif.lindholm@linaro.org, Peter Jones , Jon Masters , Ard Biesheuvel , Nicolas Dechesne Subject: [PATCH 2/2] mkimage: arm64-efi: Align first section to page Date: Wed, 28 Nov 2018 15:31:07 +0100 Message-Id: <20181128143107.37583-3-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: , X-List-Received-Date: Wed, 28 Nov 2018 14:31:13 -0000 I encountered a broken edk2 implementation in the wild (HP Envy x2) which fails to load PE binaries that have a non-page-aligned first section (read: header is < 4k). Work around this by just aligning the text start to page granule on the arm64-efi target. With this patch applied, I can successfully run grub on my HP Envy x2 system. Signed-off-by: Alexander Graf --- util/mkimage.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/mkimage.c b/util/mkimage.c index 05333a76a..bfdb0328a 100644 --- a/util/mkimage.c +++ b/util/mkimage.c @@ -605,7 +605,8 @@ 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 = EFI64_HEADER_SIZE, + /* Needed for some broken edk2 implementations */ + .vaddr_offset = 4096, .pe_target = GRUB_PE32_MACHINE_ARM64, .elf_target = EM_AARCH64, }, -- 2.19.0