From patchwork Fri Oct 2 18:03:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 54454 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id 5EC0423009 for ; Fri, 2 Oct 2015 18:06:04 +0000 (UTC) Received: by lana8 with SMTP id a8sf19490240lan.1 for ; Fri, 02 Oct 2015 11:06:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :date:message-id:subject:from:to:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:cc:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=UgZuUbFaG/xUwtrbdeEKy0CAkscYIpFbTWXVRWR/YtE=; b=TgIQC3lZ1ft+mS6zdo8MrhKjaIL2/k1zxi/iODzWiCzXR71/ghhL5liDsJMCyKGTCB Rs315anxjTBfVaEialHr5OrLFKIc4jhQlENy8M5rwAU9t0o2xfyv5uNhdYPd47GUTXJ9 BWG5Z8NgSx1z2Rlzmu3+gpLvSCEvJRwQHU1NXUlGUoXQ/ZsAAnOE68slavXNXlSb/n8n Jp6bJhUs6Qy/VXSOfXln9YADm1wvV/iF+xBNxwbbQdHhUxH64HbWFg8XrfwTnFB0XGa3 NqTM1GEuT5/vpomW7C51LAPWX2tdmmstM+Ix13DfsQgeu9DH54yfpPT44LtfVyyp27AR z/ZQ== X-Gm-Message-State: ALoCoQmmFD3LzQZWLxR1UcvxQWVfwocYNK6/y8eXuwDDM5bUU3b7lNXRKv0YDbjvatH485yYPUDL X-Received: by 10.112.138.170 with SMTP id qr10mr2930010lbb.4.1443809163281; Fri, 02 Oct 2015 11:06:03 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.19.223 with SMTP id 92ls262438lft.101.gmail; Fri, 02 Oct 2015 11:06:03 -0700 (PDT) X-Received: by 10.112.129.202 with SMTP id ny10mr5961343lbb.112.1443809163141; Fri, 02 Oct 2015 11:06:03 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id r136si6967521lfr.149.2015.10.02.11.06.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Oct 2015 11:06:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by labzv5 with SMTP id zv5so97274218lab.1 for ; Fri, 02 Oct 2015 11:06:03 -0700 (PDT) X-Received: by 10.25.86.213 with SMTP id k204mr4122940lfb.36.1443809162966; Fri, 02 Oct 2015 11:06:02 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1387645lbq; Fri, 2 Oct 2015 11:06:01 -0700 (PDT) X-Received: by 10.181.13.241 with SMTP id fb17mr204934wid.45.1443809161237; Fri, 02 Oct 2015 11:06:01 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id h3si14720542wjw.15.2015.10.02.11.06.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Oct 2015 11:06:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zi4gx-0008KT-Ub; Fri, 02 Oct 2015 18:04:23 +0000 Received: from mail-io0-f177.google.com ([209.85.223.177]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zi4gu-0007sK-E1 for linux-arm-kernel@lists.infradead.org; Fri, 02 Oct 2015 18:04:22 +0000 Received: by ioii196 with SMTP id i196so128253733ioi.3 for ; Fri, 02 Oct 2015 11:03:58 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.107.169.234 with SMTP id f103mr17511848ioj.130.1443809038000; Fri, 02 Oct 2015 11:03:58 -0700 (PDT) Received: by 10.36.37.11 with HTTP; Fri, 2 Oct 2015 11:03:57 -0700 (PDT) In-Reply-To: References: <1443719063-6832-1-git-send-email-ard.biesheuvel@linaro.org> <1443719063-6832-10-git-send-email-ard.biesheuvel@linaro.org> Date: Fri, 2 Oct 2015 20:03:57 +0200 Message-ID: Subject: Re: [PATCH 9/9] ARM: add UEFI stub support From: Ard Biesheuvel To: Ryan Harkin X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151002_110420_597785_358BA627 X-CRM114-Status: GOOD ( 26.17 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.223.177 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.223.177 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Cc: Mark Rutland , "linux-efi@vger.kernel.org" , Russell King - ARM Linux , Catalin Marinas , Will Deacon , Leif Lindholm , Roy Franz , Matt Fleming , Mark Salter , Grant Likely , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 On 2 October 2015 at 18:29, Ryan Harkin wrote: > Hi Ard/Roy, > > On 1 October 2015 at 18:04, Ard Biesheuvel > wrote: >> >> From: Roy Franz >> >> This patch adds EFI stub support for the ARM Linux kernel. >> >> The EFI stub operates similarly to the x86 and arm64 stubs: it is a >> shim between the EFI firmware and the normal zImage entry point, and >> sets up the environment that the zImage is expecting. This includes >> optionally loading the initrd and device tree from the system partition >> based on the kernel command line. >> >> Signed-off-by: Roy Franz >> Signed-off-by: Ard Biesheuvel >> --- >> arch/arm/Kconfig | 19 +++ >> arch/arm/boot/compressed/Makefile | 5 +- >> arch/arm/boot/compressed/efi-header.S | 130 ++++++++++++++++++++ >> arch/arm/boot/compressed/efi-stub.c | 89 ++++++++++++++ >> arch/arm/boot/compressed/head.S | 54 +++++++- >> arch/arm/boot/compressed/vmlinux.lds.S | 7 ++ >> arch/arm/include/asm/efi.h | 23 ++++ >> drivers/firmware/efi/libstub/Makefile | 12 ++ >> 8 files changed, 336 insertions(+), 3 deletions(-) >> >> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig >> index e4b7d6cfd8eb..6d7fd83c2ee4 100644 >> --- a/arch/arm/Kconfig >> +++ b/arch/arm/Kconfig >> @@ -2061,6 +2061,25 @@ config AUTO_ZRELADDR >> 0xf8000000. This assumes the zImage being placed in the first >> 128MB >> from start of memory. >> >> +config EFI_STUB >> + bool >> + >> +config EFI >> + bool "UEFI runtime support" >> + depends on OF && !CPU_BIG_ENDIAN && MMU && AUTO_ZRELADDR && >> !XIP_KERNEL >> + select UCS2_STRING >> + select EFI_PARAMS_FROM_FDT >> + select EFI_STUB >> + select EFI_ARMSTUB >> + select EFI_RUNTIME_WRAPPERS > > > Should we make this "default y" like ARM64? I think so. > > It is not necessarily something that should be enabled by default, imo. The distro kernels will probably enabled it, which is good enough for me. >> + ---help--- >> + This option provides support for runtime services provided >> + by UEFI firmware (such as non-volatile variables, realtime >> + clock, and platform reset). A UEFI stub is also provided to >> + allow the kernel to be booted as an EFI application. This >> + is only useful for kernels that may run on systems that have >> + UEFI firmware. >> + >> endmenu >> >> menu "CPU Power Management" >> diff --git a/arch/arm/boot/compressed/Makefile >> b/arch/arm/boot/compressed/Makefile >> index 3f9a9ebc77c3..0e5624d6215d 100644 >> --- a/arch/arm/boot/compressed/Makefile >> +++ b/arch/arm/boot/compressed/Makefile >> @@ -167,9 +167,12 @@ if [ $(words $(ZRELADDR)) -gt 1 -a >> "$(CONFIG_AUTO_ZRELADDR)" = "" ]; then \ >> false; \ >> fi >> >> +efi-obj-$(CONFIG_EFI_STUB) := $(obj)/efi-stub.o $(obj)/efi-banner.o \ > > > When I try to compile the kernel from your branch, I get: > > make[2]: *** No rule to make target 'arch/arm/boot/compressed/efi-banner.o', > needed by 'arch/arm/boot/compressed/vmlinux'. Stop. > > Did I miss something or is this a problem? > It was I who missed something: I have been reshuffling some bits, and this fell through the cracks. I didn't spot it since I apparently did not try to rebuild it cleanly. I would like to get rid of the linux_banner reference in the stub completely, and I posted a patch here In the mean time, could you try with this folded in? -------------------8<-------------------- -------------------8<-------------------- Thanks for testing! diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index 0e5624d6215d..a6aa7f9123a2 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -170,6 +170,10 @@ fi efi-obj-$(CONFIG_EFI_STUB) := $(obj)/efi-stub.o $(obj)/efi-banner.o \ $(objtree)/drivers/firmware/efi/libstub/lib.a +$(obj)/efi-banner.o: OBJCOPYFLAGS=-j .rodata +$(obj)/efi-banner.o: $(objtree)/init/version.o FORCE + $(call if_changed,objcopy) + $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) \ $(bswapsdi2) $(efi-obj-y) FORCE diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c index a7e87cd582f2..f45a6f715e73 100644 --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c @@ -16,6 +16,8 @@ #include "efistub.h" +extern __attribute__((__visibility__("hidden"))) const char linux_banner[]; + efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, unsigned long orig_fdt_size, void *fdt, int new_fdt_size, char *cmdline_ptr,