From patchwork Tue Nov 27 00:33:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 152101 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp580962ljp; Mon, 26 Nov 2018 16:31:56 -0800 (PST) X-Google-Smtp-Source: AJdET5e94Oj3yXNuLJha0n2HxOioMoFQ9SDZS9GWVUN8PUht3r5pwCb6x5X9OGThnP6ehdIk+Y09 X-Received: by 2002:a17:906:195b:: with SMTP id b27-v6mr22018368eje.220.1543278716007; Mon, 26 Nov 2018 16:31:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543278715; cv=none; d=google.com; s=arc-20160816; b=gKawWmHRcQX9hjhOn+kY2oNEaRZEfXy5VSkt4ddtnALkp+COBkxGQesWv+IevI2Ocs fXF2XI5CBADg4n5HaGls+5JoPvXjr+JUyvDL4IwRYMw8hvb/FLR2KB9oCiKHx5jn3wdp mY6ChCnZLKrsKjVabQuipE5xRhnbun29+AClb8HaimgFqeDa7x7MWEQ8esrTdv3fsqZo 50WkFB2vBXQm5DYooBq1XQIzpwSzK35C0sWRf1lZ0Y5UKQNHLMK3tig145tkIYhPrzXC PwQiOo6abj54rTiKDaumqxcVnCEW3twm4NpT9e4zrI+6E94o7E0gyWdTG7PZmNwhAuwX AuNA== 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:references:in-reply-to:message-id:date:to:from :dkim-signature; bh=fnSpeiYsnbrHKsziGx4HwWuxid8CsKk9vGKjVu5Rrv8=; b=uQvZgYyJXrf53RINJLgCn8K3BIBr7TwV7HYy8GDSmVgwLYlTfrtK2gISfmiamKiSJR Xt52iPt74YcPIfHWfuT4bljB//nd5t4OpHqasEnWxjkk1X3NMhGvMFo9JXutZcH7m2dW j7kSCV4C4/hmOcGgBZ0ZpcVB9srBoEBwaQ9lP1bHpBJKb3JxqlJfjIITgKwjx/44qwig hXuhG6SRxFUHb/IFP+Upzpl9Apg/yhcE0/WMIENQpgCQsMjRpqmGbD6tmTAARVuOmFtU 4p4fwHXBDc/9vh52xUcbif4WSwQbRrp9y79b9tYpBpVCwTv2kVYb+byAgf24GLjqJiYE zDIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MezThzaw; 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 4-v6si1091523ejy.85.2018.11.26.16.31.55; Mon, 26 Nov 2018 16:31:55 -0800 (PST) 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=MezThzaw; 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 73125C21DF8; Tue, 27 Nov 2018 00:31:29 +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_H2, 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 8636DC21DF3; Tue, 27 Nov 2018 00:31:24 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B8F7EC21D56; Tue, 27 Nov 2018 00:31:16 +0000 (UTC) Received: from mail-yb1-f195.google.com (mail-yb1-f195.google.com [209.85.219.195]) by lists.denx.de (Postfix) with ESMTPS id 58634C21DD9 for ; Tue, 27 Nov 2018 00:31:13 +0000 (UTC) Received: by mail-yb1-f195.google.com with SMTP id z2-v6so8340584ybj.2 for ; Mon, 26 Nov 2018 16:31:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=imGJX59B12v+gCZO6Q3jBeqEnhENMmP/U7XcROeKdBE=; b=MezThzawoqSCKO0pg6p/ZloN5MQefCSlDHllOO3UY2S066xd85OvFIeKIgkYNPloxt ZJF0XHlizCxIwQtkD8SDs+dVVLSYfyabTxf07kRZ4UxE8wcBLtTeOBm4k42NvvMl3QmU jfQA0y/BPZmvkgdjhAoRdt5SodpklVKL/527E= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=imGJX59B12v+gCZO6Q3jBeqEnhENMmP/U7XcROeKdBE=; b=TJXa4z7ZcpfDAdSojGcZsckyufkIEuX8q7sGy1/EYs57f/R2H1zThzicLA4e9QgsIC 88xWYtANKA459EGjOUh+rn3YQa4+4k/y7hqCJgroRSahWNnAf1C0k5HPCOB5eLcjNC3J csQUkgprsSvbnkb1sYAfbSSFKhFGXImorRMKrFT9WVM6eJj+KNizsozLPUGzB038f5gh Z/1bBcd2+Bx/5TR95BnLwtwvMxp5pl4VRmwCcevZUS85kqhEHposhilYAu9+69cw7ojd 029pZJZfvaF8njtmQn0Fm9/UroJCuWd1L3LHm5mGAH/jUyDKWjwJY8i/VujHMx/jklTz HaFg== X-Gm-Message-State: AA+aEWZjyCdsnYjc9LgAlfD90ujb0nsUx4+xVek9/oQYUfOhjaHXSuOU ijaKuX5OUJJGMX0iNExRn9E85w== X-Received: by 2002:a25:2317:: with SMTP id j23-v6mr24684278ybj.457.1543278671793; Mon, 26 Nov 2018 16:31:11 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id p203-v6sm606801ywb.34.2018.11.26.16.31.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Nov 2018 16:31:11 -0800 (PST) From: AKASHI Takahiro To: trini@konsulko.com, agraf@suse.de, xypron.glpk@gmx.de Date: Tue, 27 Nov 2018 09:33:51 +0900 Message-Id: <20181127003351.9242-2-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181127003351.9242-1-takahiro.akashi@linaro.org> References: <20181127003351.9242-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 1/1] 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: * load dtb dynamically even if its loacation (device) is not the same as BOOTEFI_NAME binary's, (reported by Alex) * invoke 'bootmgr' only if BOOTEFI_NAME binary does exit even though 'bootmgr' can and should work independently whether or not the binary exist, * in addition, invoke 'bootmgr' with dynamically-loaded dtb. This behavior is not expected. (reported by Alex) * always assume that a 'fdtfile' variable is defined, ("test -e ${devtype} ${devnum}:${distro_bootpart} "${prefix}${efi_fdtfile}" always returns true even if fdtfile is NULL with prefix=="/".) * redundantly check for 'fdt_addr_r' in boot_efi_binary In this patch, all the issues above are sorted out. Please note that the default behavior can be customized with: fdtfile: a dtb file name efi_dtb_prefixes: a list of paths for searching for a dtb file (this feature does work even without this patch.) Signed-off-by: AKASHI Takahiro --- include/config_distro_bootcmd.h | 38 +++++++++++++++++---------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 373fee78a999..256698309eb9 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -115,7 +115,7 @@ */ #define BOOTENV_EFI_SET_FDTFILE_FALLBACK \ "if test -z \"${fdtfile}\" -a -n \"${soc}\"; then " \ - "setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; " \ + "efi_fdtfile=${soc}-${board}${boardver}.dtb; " \ "fi; " #else #define BOOTENV_EFI_SET_FDTFILE_FALLBACK @@ -124,26 +124,20 @@ #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" \ + "load ${devtype} ${devnum}:${distro_bootpart} " \ + "${fdt_addr_r} ${prefix}${efi_fdtfile}; " \ + "if fdt addr ${fdt_addr_r}; then " \ + "efi_fdt_addr=${fdt_addr_r}; " \ + "fi;\0" \ \ "efi_dtb_prefixes=/ /dtb/ /dtb/current/\0" \ - "scan_dev_for_efi=" \ - "setenv efi_fdtfile ${fdtfile}; " \ + "set_efi_fdt_addr=" \ + "efi_fdtfile=${fdtfile}; " \ BOOTENV_EFI_SET_FDTFILE_FALLBACK \ "for prefix in ${efi_dtb_prefixes}; do " \ "if test -e ${devtype} " \ @@ -151,19 +145,26 @@ "${prefix}${efi_fdtfile}; then " \ "run load_efi_dtb; " \ "fi;" \ - "done;" \ + "done;\0" \ + \ + "scan_dev_for_efi=" \ "if test -e ${devtype} ${devnum}:${distro_bootpart} " \ "efi/boot/"BOOTEFI_NAME"; then " \ "echo Found EFI removable media binary " \ "efi/boot/"BOOTEFI_NAME"; " \ + "efi_fdt_addr=${fdtcontroladdr}; " \ + "if test -n \"${fdtfile}\"; then " \ + "run set_efi_fdt_addr; " \ + "fi; " \ "run boot_efi_binary; " \ "echo EFI LOAD FAILED: continuing...; " \ - "fi; " \ - "setenv efi_fdtfile\0" + "fi;\0" #define SCAN_DEV_FOR_EFI "run scan_dev_for_efi;" +#define BOOT_EFI_BOOT_MANAGER "bootefi bootmgr;" #else #define BOOTENV_SHARED_EFI #define SCAN_DEV_FOR_EFI +#define BOOT_EFI_BOOT_MANAGER #endif #ifdef CONFIG_SATA @@ -409,6 +410,7 @@ BOOT_TARGET_DEVICES(BOOTENV_DEV) \ \ "distro_bootcmd=" BOOTENV_SET_SCSI_NEED_INIT \ + BOOT_EFI_BOOT_MANAGER \ "for target in ${boot_targets}; do " \ "run bootcmd_${target}; " \ "done\0"