All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 0/1] efi_loader: improve boot sequence in distro_bootcmd
@ 2018-11-27  0:33 AKASHI Takahiro
  2018-11-27  0:33 ` [U-Boot] [PATCH v3 1/1] efi_loader: rework fdt handling in distro boot script AKASHI Takahiro
  0 siblings, 1 reply; 5+ messages in thread
From: AKASHI Takahiro @ 2018-11-27  0:33 UTC (permalink / raw)
  To: u-boot

Actually, this patch is a RESEND of my v2[1], without patch #2 and #3
as I don't want to dive into details of dtb discussions[2].
I think that the patch #1 alone is useful.

If fdt_addr_r is not defined,
    "load ... ${fdt_addr_r} ${prefix}${efi_fdtfile}"
will fail quietly. So it should be OK.

Think about applying my "removable device" patch[3] alongside this patch.

[1] https://lists.denx.de/pipermail/u-boot/2018-October/345029.html
[2] https://lists.denx.de/pipermail/u-boot/2018-October/344375.html
[3] https://lists.denx.de/pipermail/u-boot/2018-November/347491.html

Changes in v3 (Nov 27, 2018):
* remove v2's patch #2 and #3

Changes in v2 (Oct 22, 2018):
* rewrite my previous changes after Alex's comments, including
     - boot bootmgr only once before searching for boot binary
     - dtb must be loaded from the same device with boot binary's
* add patch#2 as part of this patch set, in particular adding CONFIG_SYS

Thanks,
-Takahio Akashi

AKASHI Takahiro (1):
  efi_loader: rework fdt handling in distro boot script

 include/config_distro_bootcmd.h | 38 +++++++++++++++++----------------
 1 file changed, 20 insertions(+), 18 deletions(-)

-- 
2.19.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v3 1/1] efi_loader: rework fdt handling in distro boot script
  2018-11-27  0:33 [U-Boot] [PATCH v3 0/1] efi_loader: improve boot sequence in distro_bootcmd AKASHI Takahiro
@ 2018-11-27  0:33 ` AKASHI Takahiro
  2018-12-02 22:58   ` Alexander Graf
  0 siblings, 1 reply; 5+ messages in thread
From: AKASHI Takahiro @ 2018-11-27  0:33 UTC (permalink / raw)
  To: 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 <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					  \
 		"for target in ${boot_targets}; do "                      \
 			"run bootcmd_${target}; "                         \
 		"done\0"
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v3 1/1] efi_loader: rework fdt handling in distro boot script
  2018-11-27  0:33 ` [U-Boot] [PATCH v3 1/1] efi_loader: rework fdt handling in distro boot script AKASHI Takahiro
@ 2018-12-02 22:58   ` Alexander Graf
  2018-12-03  2:22     ` AKASHI Takahiro
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Graf @ 2018-12-02 22:58 UTC (permalink / raw)
  To: u-boot



On 27.11.18 01:33, 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"

This drops the bit that unsets the variable. So after the script, your
env will be different from before the script. Please run

  U-Boot# printenv
  U-Boot# boot (w/o any efi payload to boot)
  U-Boot# printenv

Then diff the two environments. They should be identical.


Alex

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v3 1/1] efi_loader: rework fdt handling in distro boot script
  2018-12-02 22:58   ` Alexander Graf
@ 2018-12-03  2:22     ` AKASHI Takahiro
  2018-12-03  9:24       ` Alexander Graf
  0 siblings, 1 reply; 5+ messages in thread
From: AKASHI Takahiro @ 2018-12-03  2:22 UTC (permalink / raw)
  To: u-boot

On Sun, Dec 02, 2018 at 11:58:45PM +0100, Alexander Graf wrote:
> 
> 
> On 27.11.18 01:33, 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"
> 
> This drops the bit that unsets the variable. So after the script, your
> env will be different from before the script.

Yeah, but

> Please run
> 
>   U-Boot# printenv
>   U-Boot# boot (w/o any efi payload to boot)
>   U-Boot# printenv
> 
> Then diff the two environments. They should be identical.

Are you sure? When I try this on unmodified v2018.11,
I also see some difference:

18a19
> devnum=0
37a39
> scsi_need_init=false
44c46
< Environment size: 3614/65532 bytes
---
> Environment size: 3644/65532 bytes

It seems that 'devnum' and 'scsi_need_init' come from 'bootcmd_scsi0.'
Can you clarify your point a bit more, please?

Thanks,
-Takahiro Akashi

> 
> 
> Alex

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v3 1/1] efi_loader: rework fdt handling in distro boot script
  2018-12-03  2:22     ` AKASHI Takahiro
@ 2018-12-03  9:24       ` Alexander Graf
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander Graf @ 2018-12-03  9:24 UTC (permalink / raw)
  To: u-boot



> Am 03.12.2018 um 03:22 schrieb AKASHI Takahiro <takahiro.akashi@linaro.org>:
> 
>> On Sun, Dec 02, 2018 at 11:58:45PM +0100, Alexander Graf wrote:
>> 
>> 
>>> On 27.11.18 01:33, 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"
>> 
>> This drops the bit that unsets the variable. So after the script, your
>> env will be different from before the script.
> 
> Yeah, but
> 
>> Please run
>> 
>>  U-Boot# printenv
>>  U-Boot# boot (w/o any efi payload to boot)
>>  U-Boot# printenv
>> 
>> Then diff the two environments. They should be identical.
> 
> Are you sure? When I try this on unmodified v2018.11,
> I also see some difference:
> 
> 18a19
>> devnum=0
> 37a39
>> scsi_need_init=false
> 44c46
> < Environment size: 3614/65532 bytes
> ---
>> Environment size: 3644/65532 bytes
> 
> It seems that 'devnum' and 'scsi_need_init' come from 'bootcmd_scsi0.'
> Can you clarify your point a bit more, please?

That is a bug :). Thanks for catching it? Can you please send a patch to fix it?

The problem is that a saveenv after a fsiled boot attempt should not contain intermediate variables from that attempt.


Alex

> 
> Thanks,
> -Takahiro Akashi
> 
>> 
>> 
>> Alex

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-12-03  9:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-27  0:33 [U-Boot] [PATCH v3 0/1] efi_loader: improve boot sequence in distro_bootcmd AKASHI Takahiro
2018-11-27  0:33 ` [U-Boot] [PATCH v3 1/1] efi_loader: rework fdt handling in distro boot script AKASHI Takahiro
2018-12-02 22:58   ` Alexander Graf
2018-12-03  2:22     ` AKASHI Takahiro
2018-12-03  9:24       ` Alexander Graf

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.