Re: [U-Boot] [PATCH v5 24/30] efi_loader: Add distro boot script for removable media

2016-03-09 Thread Tom Rini
On Thu, Mar 10, 2016 at 12:05:12AM +0100, Alexander Graf wrote:
> 
> 
> On 04.03.16 01:10, 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, ...).
> > 
> > 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 
> > Reviewed-by: Simon Glass 
> > ---
> >  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; "
> 
> Whoever applies this, please also apply the patch below on top and
> squash it in (or tell me to resend). Without the fix, we end up slurping
> the boot_prefix variable into the scan_dev_for_efi variable.
> 
> 
> Alex
> 
> diff --git a/include/config_distro_bootcmd.h
> b/include/config_distro_bootcmd.h
> index e7d7002..ad9045e 100644
> --- a/include/config_distro_bootcmd.h
> +++ b/include/config_distro_bootcmd.h
> @@ -125,7 +125,7 @@
> "efi/boot/"BOOTEFI_NAME"; "   \
> "run boot_efi_binary; "   \
> "echo EFI LOAD FAILED: continuing...; "   \
> -   "fi; "
> +   "fi; \0"
>  #define SCAN_DEV_FOR_EFI "run scan_dev_for_efi;"
>  #else
>  #define BOOTENV_SHARED_EFI

Please make just a v6 of this patch and re-post, thanks!

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 24/30] efi_loader: Add distro boot script for removable media

2016-03-09 Thread Alexander Graf


On 04.03.16 01:10, 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, ...).
> 
> 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 
> Reviewed-by: Simon Glass 
> ---
>  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; "

Whoever applies this, please also apply the patch below on top and
squash it in (or tell me to resend). Without the fix, we end up slurping
the boot_prefix variable into the scan_dev_for_efi variable.


Alex

diff --git a/include/config_distro_bootcmd.h
b/include/config_distro_bootcmd.h
index e7d7002..ad9045e 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -125,7 +125,7 @@
"efi/boot/"BOOTEFI_NAME"; "   \
"run boot_efi_binary; "   \
"echo EFI LOAD FAILED: continuing...; "   \
-   "fi; "
+   "fi; \0"
 #define SCAN_DEV_FOR_EFI "run scan_dev_for_efi;"
 #else
 #define BOOTENV_SHARED_EFI
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v5 24/30] efi_loader: Add distro boot script for removable media

2016-03-03 Thread Alexander Graf
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, ...).

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 
Reviewed-by: Simon Glass 
---
 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_SATABOOTENV_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; " \
-- 
1.8.5.6

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot