From patchwork Fri Oct 12 05:07:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 148701 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp306756lji; Thu, 11 Oct 2018 22:06:37 -0700 (PDT) X-Google-Smtp-Source: ACcGV61rUlxPar3jCGpxD5njNfcLZTNmT7i9PUIMqLtufm7up5y51caNjAB5Kem2n4ctkpvBU87f X-Received: by 2002:a50:af22:: with SMTP id g31-v6mr6580972edd.106.1539320797793; Thu, 11 Oct 2018 22:06:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539320797; cv=none; d=google.com; s=arc-20160816; b=qxXw7kHIHXPY6G+ORA4Kah+TQqYL1KWnHHfhDjwhuVr0LdLgjS/TRA0l73GKgpgKfF q5bayLNt851TnKXGd9eL7r/+9YioRtw7kJcEska+KRlkljc3yd5B3hHHq/Q81GKwnJ8+ VWTF1pCPgVcvIrP+DyZaBcJrWCqVS8V+rGiqWXe8/um9HIz/VW5OfiHJi8oBi2/tZAAK j6ijN8Zcw0AoAtErueLoqECWgCQcwryqTXjd1+XtXRyBYLEZFjU5KkGvN4hUt9NHfMd+ pkorDYY4xuwaQmvV2YkP/bvV+mtn2ARSWezmP32HDsKcZaT+Wz1oDGknZL1I+UhgQYbo weXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:message-id:date:to:from:dkim-signature; bh=J/3U+X0bAE37GyG+EQ9s9fymX8Tp25TEmsp0JEGhfYk=; b=FdmRtGRc30eRbPk+AFblwHGWms99+jsOSAJoMvNk/Pe1jE3i8ONLDiLYRQUPQUA0gC JOSmj+/tBClkTwCZ0YrfCwpbDcBugzB5t+Nsza0N82UtLdkhArf4ujEuuaYWDbHnrMam p3cM0flUxzte/YaneTOobAEcT19+Ovm4hYR8e2xwgCvDTRGfUL+eU9nnZ4mZni0IMU/+ Rts+gUl5kvmyWG2d7lJBp6k+qTBRhIlSEVynDS6mrybYMOaNoq0VqwxgaeGyVvDYWPuy c4B4eYkj+/kagA8XUC4vNRTr+BGHC1cOueqibgM/QHxrP/l8DAbrya2eohko0JNbcz/V WTjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=iTOiTfM1; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id n4-v6si364500edd.424.2018.10.11.22.06.37; Thu, 11 Oct 2018 22:06:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=iTOiTfM1; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 0117EC21DB6; Fri, 12 Oct 2018 05:06:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id ECC8DC21C27; Fri, 12 Oct 2018 05:06:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8FC0BC21C27; Fri, 12 Oct 2018 05:06:32 +0000 (UTC) Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by lists.denx.de (Postfix) with ESMTPS id D5C51C21BE5 for ; Fri, 12 Oct 2018 05:06:31 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id 1-v6so5313528plv.7 for ; Thu, 11 Oct 2018 22:06:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nK0vtulEZGjrRPT5MMISfAEbN2pz7v6jN3hq/hRAF+w=; b=iTOiTfM12UFfrpg+zDWUsv+ffasgpqt6OrRowRZHkwwheszLUl8l0oKt5ZatAYlUwX YbRgGuTuL7FtSadflwB3+lSj9Z3noRO/ET0vzABe7t+Z9jS2FX8IE0Nd74d0yEGnZO+Z aSJLoj8ANx6TYEjtpbgkWsez1Xdviea4JAPFo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nK0vtulEZGjrRPT5MMISfAEbN2pz7v6jN3hq/hRAF+w=; b=U4OsZLag/UW3iapmdF+0AEzy75yyFlLXsp5HIvK7molEL69BsWQZHtZmsKJ9777vmh rgJUU6Z/XNyLWwQnUX8pU0elzMkU7E33w6xJw90idE8QDRKvv7wAv2vngKEB7WpkDiQb YEHZ08aIH+o6KqchrfT+OFFOF7CdpziWYL3NfTRRuVs1s+E8PXNADuV/uMLroScj81QC 4r90BtplM3Ku1U2LlLuMG9Vsc7ORHK0TdiUdLWOffYPXGhIAOxCMCwJUye7KoUTzisdg 4HFbwm7kBZvbC3aFJyrC5DhlWlGk7UCrXtrUql/pLjonA7yQisBjbLCuKyQ0X0yeXMh1 2tXg== X-Gm-Message-State: ABuFfog3uYu9SUi79X+XoWjsIKhcwCDJ4u9EtU7KX30qCcRpSRLLmwhK vfTSwTHMuUNISBXJmQlYa2WfYA== X-Received: by 2002:a17:902:b90c:: with SMTP id bf12-v6mr4447095plb.259.1539320790140; Thu, 11 Oct 2018 22:06:30 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id x17-v6sm140732pfn.59.2018.10.11.22.06.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Oct 2018 22:06:29 -0700 (PDT) From: AKASHI Takahiro To: trini@konsulko.com, agraf@suse.de Date: Fri, 12 Oct 2018 14:07:56 +0900 Message-Id: <20181012050757.6925-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 1/2] efi_loader: rework fdt handling in distro boot script X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The current scenario for default UEFI booting, scan_dev_for_efi, has several issues: * invoke 'bootmgr' only if BOOTEFI_NAME binary does exit even though 'bootmgr' can and should work independently whether or not the binary exist, * always assume that a 'fdtfile' variable is defined, * redundantly check for 'fdt_addr_r' in boot_efi_binary In this patch, all the issues above are sorted out. Signed-off-by: AKASHI Takahiro --- include/config_distro_bootcmd.h | 43 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 373fee78a999..76e12b7bf4ee 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -124,42 +124,41 @@ #define BOOTENV_SHARED_EFI \ "boot_efi_binary=" \ - "if fdt addr ${fdt_addr_r}; then " \ - "bootefi bootmgr ${fdt_addr_r};" \ - "else " \ - "bootefi bootmgr ${fdtcontroladdr};" \ - "fi;" \ "load ${devtype} ${devnum}:${distro_bootpart} " \ "${kernel_addr_r} efi/boot/"BOOTEFI_NAME"; " \ - "if fdt addr ${fdt_addr_r}; then " \ - "bootefi ${kernel_addr_r} ${fdt_addr_r};" \ - "else " \ - "bootefi ${kernel_addr_r} ${fdtcontroladdr};" \ - "fi\0" \ + "bootefi ${kernel_addr_r} ${efi_fdt_addr};\0" \ \ "load_efi_dtb=" \ "load ${devtype} ${devnum}:${distro_bootpart} " \ - "${fdt_addr_r} ${prefix}${efi_fdtfile}\0" \ + "${fdt_addr_r} ${prefix}${efi_fdtfile};" \ + "if fdt addr ${fdt_addr_r}; then " \ + "setenv efi_fdt_addr ${fdt_addr_r}; " \ + "else; " \ + "setenv efi_fdt_addr ${fdtcontroladdr}; " \ + "fi;\0" \ \ - "efi_dtb_prefixes=/ /dtb/ /dtb/current/\0" \ - "scan_dev_for_efi=" \ + "set_efi_fdt_addr=" \ "setenv efi_fdtfile ${fdtfile}; " \ BOOTENV_EFI_SET_FDTFILE_FALLBACK \ - "for prefix in ${efi_dtb_prefixes}; do " \ - "if test -e ${devtype} " \ - "${devnum}:${distro_bootpart} " \ - "${prefix}${efi_fdtfile}; then " \ - "run load_efi_dtb; " \ - "fi;" \ - "done;" \ + "if test x${efi_fdtfile} != x -a x{$fdt_addr_r} != x ; then " \ + "run load_efi_dtb; " \ + "else; " \ + "setenv efi_fdt_addr ${fdtcontroladdr}; " \ + "fi; " \ + "setenv efi_fdtfile\0" \ + \ + "efi_dtb_prefixes=/ /dtb/ /dtb/current/\0" \ + "scan_dev_for_efi=" \ + "run set_efi_fdt_addr; " \ + "bootefi bootmgr ${efi_fdt_addr};" \ "if test -e ${devtype} ${devnum}:${distro_bootpart} " \ "efi/boot/"BOOTEFI_NAME"; then " \ "echo Found EFI removable media binary " \ "efi/boot/"BOOTEFI_NAME"; " \ "run boot_efi_binary; " \ "echo EFI LOAD FAILED: continuing...; " \ - "fi; " \ - "setenv efi_fdtfile\0" + "fi; " \ + "setenv efi_fdt_addr\0" #define SCAN_DEV_FOR_EFI "run scan_dev_for_efi;" #else #define BOOTENV_SHARED_EFI