From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/3] efi_loader: rework fdt handling in distro boot script
Date: Mon, 22 Oct 2018 16:22:28 +0900 [thread overview]
Message-ID: <20181022072227.GD11663@linaro.org> (raw)
In-Reply-To: <20181022044007.11796-2-takahiro.akashi@linaro.org>
On Mon, Oct 22, 2018 at 01:40:05PM +0900, AKASHI Takahiro wrote:
> 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 <takahiro.akashi@linaro.org>
> ---
> 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 \
The last-minute change may have introduced a problem.
By moving "bootmgr" from scan_dev_for_efi" to here,
grub fails to start a grub.cfg menu, saying
"error: no such device: /.disk/info."
Do you have any ideas?
-Takahiro Akashi
> "for target in ${boot_targets}; do " \
> "run bootcmd_${target}; " \
> "done\0"
> --
> 2.19.0
>
next prev parent reply other threads:[~2018-10-22 7:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-22 4:40 [U-Boot] [PATCH v2 0/3] efi_loader: improve boot sequence in distro_bootcmd AKASHI Takahiro
2018-10-22 4:40 ` [U-Boot] [PATCH v2 1/3] efi_loader: rework fdt handling in distro boot script AKASHI Takahiro
2018-10-22 7:22 ` AKASHI Takahiro [this message]
2018-10-22 7:42 ` Alexander Graf
2018-10-23 2:08 ` AKASHI Takahiro
2018-10-23 7:36 ` Alexander Graf
2018-10-23 8:01 ` AKASHI Takahiro
2018-10-22 4:40 ` [U-Boot] [PATCH v2 2/3] ARM: qemu-arm: rework Kconfig AKASHI Takahiro
2018-10-22 4:40 ` [U-Boot] [PATCH v2 3/3] ARM: qemu-arm: define fdt_addr_r AKASHI Takahiro
2018-10-24 10:43 ` Tuomas Tynkkynen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181022072227.GD11663@linaro.org \
--to=takahiro.akashi@linaro.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox