All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leif Lindholm <leif.lindholm@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 14/16] efi_loader: Add distro boot script for removable media
Date: Tue, 2 Feb 2016 17:52:29 +0000	[thread overview]
Message-ID: <20160202175229.GE10351@bivouac.eciton.net> (raw)
In-Reply-To: <1454381114-22547-15-git-send-email-agraf@suse.de>

On Tue, Feb 02, 2016 at 03:45:12AM +0100, Alexander Graf wrote:
> UEFI defines a simple boot protocol for removable media. There we should look
> at the EFI (first GPT FAT) partition and search for /efi/boot/bootXXX.efi with
> XXX being different between different platforms (x86, x64, arm, aa64, ...).

One comment, one question.
Comment:
It's not really "the first GPT FAT" - it's the partition marked with
the EFI System Partition type (containing a FAT filesystem).
This is actually defined for MBR partition tables too, but I'd be
quite happy for that bit of legacy to be left out.

Question:
Does U-Boot support El Torito for iso images?

> 
> This patch implements a simple version of that protocol for the default distro
> boot script. With this we can automatically boot from valid UEFI enabled
> removable media.
> 
> Because from all I could see U-Boot by default doesn't deliver device tree
> blobs with its firmware, we also need to load the dtb from somewhere. Traverse
> the same EFI partition for an fdt file that fits our current board so that
> an OS receives a valid device tree when booted automatically.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
>  include/config_distro_bootcmd.h | 47 ++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 46 insertions(+), 1 deletion(-)
> 
> diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
> index 37c6b43..c19f1b0 100644
> --- a/include/config_distro_bootcmd.h
> +++ b/include/config_distro_bootcmd.h
> @@ -90,6 +90,48 @@
>  	BOOT_TARGET_DEVICES_references_UBIFS_without_CONFIG_CMD_UBIFS
>  #endif
>  
> +#ifdef CONFIG_EFI_LOADER
> +#if defined(CONFIG_ARM64)
> +#define BOOTEFI_NAME "bootaa64.efi"
> +#elif defined(CONFIG_ARM)
> +#define BOOTEFI_NAME "bootarm.efi"
> +#endif
> +#endif
> +
> +#ifdef BOOTEFI_NAME
> +#define BOOTENV_SHARED_EFI                                                \
> +	"boot_efi_binary="                                                \
> +		"load ${devtype} ${devnum}:${distro_bootpart} "           \
> +			"${kernel_addr_r} efi/boot/"BOOTEFI_NAME"; "      \
> +		"bootefi ${kernel_addr_r}\0"                              \
> +	\
> +	"load_efi_dtb="                                                   \
> +		"load ${devtype} ${devnum}:${distro_bootpart} "           \
> +			"${fdt_addr_r} ${prefix}${fdt_name}; "           \
> +		"fdt addr ${fdt_addr_r}\0"                                \
> +	\
> +	"efi_dtb_prefixes=/ /dtb/ /dtb/current/\0"                        \
> +	"scan_dev_for_efi="                                               \
> +		"for prefix in ${efi_dtb_prefixes}; do "                  \
> +			"if test -e ${devtype} "                          \
> +					"${devnum}:${distro_bootpart} "   \
> +					"${prefix}${fdt_name}; then "     \
> +				"run load_efi_dtb; "                      \
> +			"fi;"                                             \
> +		"done;"                                                   \
> +		"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; "
> +#define SCAN_DEV_FOR_EFI "run scan_dev_for_efi;"
> +#else
> +#define BOOTENV_SHARED_EFI
> +#define SCAN_DEV_FOR_EFI
> +#endif
> +
>  #ifdef CONFIG_CMD_SATA
>  #define BOOTENV_SHARED_SATA	BOOTENV_SHARED_BLKDEV(sata)
>  #define BOOTENV_DEV_SATA	BOOTENV_DEV_BLKDEV
> @@ -217,6 +259,7 @@
>  	BOOTENV_SHARED_SCSI \
>  	BOOTENV_SHARED_IDE \
>  	BOOTENV_SHARED_UBIFS \
> +	BOOTENV_SHARED_EFI \
>  	"boot_prefixes=/ /boot/\0" \
>  	"boot_scripts=boot.scr.uimg boot.scr\0" \
>  	"boot_script_dhcp=boot.scr.uimg\0" \
> @@ -258,7 +301,9 @@
>  		"for prefix in ${boot_prefixes}; do "                     \
>  			"run scan_dev_for_extlinux; "                     \
>  			"run scan_dev_for_scripts; "                      \
> -		"done\0"                                                  \
> +		"done;"                                                   \
> +		SCAN_DEV_FOR_EFI                                          \
> +		"\0"                                                      \
>  	\
>  	"scan_dev_for_boot_part="                                         \
>  		"part list ${devtype} ${devnum} -bootable devplist; "     \
> -- 
> 2.6.2
> 

  reply	other threads:[~2016-02-02 17:52 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02  2:44 [U-Boot] [PATCH 00/16] EFI payload / application support v3 Alexander Graf
2016-02-02  2:44 ` [U-Boot] [PATCH 01/16] disk/part.c: Expose list of available block drivers Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 02/16] include/efi_api.h: Add more detailed API definitions Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 03/16] efi_loader: Add PE image loader Alexander Graf
2016-02-02 12:54   ` Leif Lindholm
2016-02-02 17:49   ` Mark Rutland
2016-02-26  1:25     ` Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 04/16] efi_loader: Add boot time services Alexander Graf
2016-02-02 14:47   ` Leif Lindholm
2016-02-26  1:00     ` Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 05/16] efi_loader: Add console interface Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 06/16] efi_loader: Add runtime services Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 07/16] efi_loader: Add disk interfaces Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 08/16] efi_loader: Add "bootefi" command Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 09/16] efi_loader: Implement memory allocation and map Alexander Graf
2016-02-02 17:35   ` Leif Lindholm
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 10/16] arm64: Allow exceptions to return Alexander Graf
2016-02-02  2:45 ` [U-Boot] [PATCH 11/16] arm64: Allow EFI payload code to take exceptions Alexander Graf
2016-02-02  2:45 ` [U-Boot] [PATCH 12/16] efi_loader: Add DCACHE_OFF support for arm64 Alexander Graf
2016-02-02 15:55   ` Mark Rutland
2016-02-02 16:28     ` Tom Rini
2016-02-02 16:58       ` Alexander Graf
2016-02-02  2:45 ` [U-Boot] [PATCH 13/16] efi_loader: hook up in build environment Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 14/16] efi_loader: Add distro boot script for removable media Alexander Graf
2016-02-02 17:52   ` Leif Lindholm [this message]
2016-02-26  1:29     ` Alexander Graf
2016-02-03 10:36   ` Leif Lindholm
2016-02-03 15:53     ` Alexander Graf
2016-02-04  4:11       ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 15/16] efi_loader: Add README section in README.efi Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 16/16] efi_loader: Add MAINTAINERS entry Alexander Graf
2016-02-03  3:31   ` Simon Glass

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=20160202175229.GE10351@bivouac.eciton.net \
    --to=leif.lindholm@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.