From patchwork Mon May 2 11:17:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 12834141 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD3D7C433EF for ; Mon, 2 May 2022 11:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=o30tG1eb1q/hQlFRMVIm9Dl4fbfZvEDVk5n8knqwzhU=; b=WAITlLdhuENVlM Tdo0T/VL1tBq8YoLXl6Hg7HRf6ub896VD4zeKlw5D+03wj23OuF/34mryNJ0WSnOtzG0scnOgGgOn T9+/yhQJjNu4w2MdE543tL8IUJeilVuaCiUHFpAv0NI24HkyZVz1msZEwqANKZWWhdpA7avbHPQgB qLT1xf93PiVJWhqotBcDZz/7YWVOCcoLgMKIov2iiwPkS/c7JxOrsNaWeSANWA4R1zA1Trce5Kzta ed3VImXjGnkebKVRxcU0hwvrwJutFKTIyaptZlnPgxUh3IY/fMncDPwio2ygsF0RWY2x9KIGm/dBn YATaUQmd7dsJqDcAOY9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlU4D-000uyG-RL; Mon, 02 May 2022 11:18:14 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlU3V-000ukB-J7 for linux-arm-kernel@lists.infradead.org; Mon, 02 May 2022 11:17:31 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EFD4F6128D; Mon, 2 May 2022 11:17:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B402EC385B2; Mon, 2 May 2022 11:17:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651490248; bh=KdTG5ILW+BimV/rUokcRVUnKrnKVJkh0mRI8hwDxv9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nY3YeUh8wq/b7ruMqOaCgr+Td8NbU3vfs7xE26erkktuhf80/mBaLpY+hFB1S/n1a moxQYIUGqIlPHq8GojuWdeb/EbyfandoaZzVRlhqNj3D0/gMB2o5bT40O9ooWkxAff 9isDKWAm2SJs8bOlppVHFII36BSTNyIGAktodVcydUTvMj7+rsGt1EG7n3dJRxbCI4 50L1yLmLXRIOp/isyK6Nf2BzD0bnXVNuKYbUUKLthwjPm8rZH08giIaKTHZI0qhEjw /sx622IM3TBihssx4RNtul9RKQpM65kH7IdprfeLDmwHtJd+2+aPDYhlnnStEbVMql XR9Tx+wFiu/hg== From: Ard Biesheuvel To: linux-efi@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: catalin.marinas@arm.com, will@kernel.org, Ard Biesheuvel , Arnd Bergmann , Huacai Chen Subject: [RFC PATCH 4/4] arm64: efi: enable generic EFI compressed boot Date: Mon, 2 May 2022 13:17:10 +0200 Message-Id: <20220502111710.4093567-5-ardb@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220502111710.4093567-1-ardb@kernel.org> References: <20220502111710.4093567-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1967; h=from:subject; bh=KdTG5ILW+BimV/rUokcRVUnKrnKVJkh0mRI8hwDxv9c=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBib721YQFXgTQ9rqQ5/5YC4MqDvd8W4LTztnbWv0qD +YGJ/PaJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYm+9tQAKCRDDTyI5ktmPJK92DA Cmdai5hwUZeWh8eqa1ig9Jiloi7qFITUH0u7nxxbmrhJwnJmPgdZbQOaXbmEpPcOt77JaoihxwAbYU ee4zh+LH0b8crlPyZyMFFwNBR4RQy8jOl257Un58tUHGtvfa/zOPAWaXKI0xaoKJ2kXn7ZODrDaRIk C92VrPPu8EJKJ8jhd4ytCbKi2NECM9EIHMGkMEtC6cQAWYgsSIEIHIXkNagThjDkw5VESOUsO4KmTL MImvTIxzCloCXUaLt425tAwxS5lh6Du9BxgUnynu+r2mES5cYRyKhyRQcpkFE7xIc0t1yCwnV6gYUN kUwQ1zcyyBhd/1j4N36mYNv54zH5DRXj1bK2JHq8Od16LFoYj6k0KXk2xK9ZgMHgevcBdoo76mWt2k suAj+Ctz0MNBX9Nz0EcG2h3P5qEN/4wktE2jWF2TI/kFegCuicNU/S1nd7nZYCBvTXvL6/LFDmZQQb Fg1B+gNcUdX1awONYrDDSzR8NQ8/VYNi53yUems0BjFvE= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220502_041729_893827_7302A35D X-CRM114-Status: GOOD ( 10.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Wire up the generic EFI zboot support for arm64. Signed-off-by: Ard Biesheuvel --- arch/arm64/Makefile | 5 +++++ arch/arm64/boot/Makefile | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 2f1de88651e6..c9580f78439f 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -162,6 +162,11 @@ Image: vmlinux Image.%: Image $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ +ifneq ($(CONFIG_EFI_ZBOOT),) +zImage.efi: Image + $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ +endif + install: install-image := Image zinstall: install-image := Image.gz install zinstall: diff --git a/arch/arm64/boot/Makefile b/arch/arm64/boot/Makefile index ebe80faab883..81500267ab79 100644 --- a/arch/arm64/boot/Makefile +++ b/arch/arm64/boot/Makefile @@ -16,7 +16,7 @@ OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S -targets := Image Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo +targets := Image Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo zImage.efi $(obj)/Image: vmlinux FORCE $(call if_changed,objcopy) @@ -35,3 +35,18 @@ $(obj)/Image.lzma: $(obj)/Image FORCE $(obj)/Image.lzo: $(obj)/Image FORCE $(call if_changed,lzo) + +OBJCOPYFLAGS_Image.gz.o := -O elf64-littleaarch64 -I binary \ + --rename-section .data=.gzdata,load,alloc,readonly,contents +$(obj)/Image.gz.o: $(obj)/Image.gz FORCE + $(call if_changed,objcopy) + +ZBOOT_DEPS := memcpy.o memset.o strnlen.o +$(obj)/zImage.efi.elf: $(obj)/Image.gz.o $(addprefix $(objtree)/arch/arm64/lib/,$(ZBOOT_DEPS)) + $(Q)$(LD) -T $(srctree)/drivers/firmware/efi/libstub/zboot.lds \ + -o $@ $^ $(objtree)/drivers/firmware/efi/libstub/lib.a \ + --defsym=pe_machine_type=0xaa64 + +$(obj)/zImage.efi: OBJCOPYFLAGS := -O binary +$(obj)/zImage.efi: $(obj)/zImage.efi.elf FORCE + $(call if_changed,objcopy)