public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 1/1] sandbox: add bootmethod EFI boot-manager
@ 2024-10-08 22:32 Heinrich Schuchardt
  2024-10-09  1:58 ` Simon Glass
  2024-10-11 14:27 ` Mattijs Korpershoek
  0 siblings, 2 replies; 5+ messages in thread
From: Heinrich Schuchardt @ 2024-10-08 22:32 UTC (permalink / raw)
  To: Simon Glass
  Cc: Tom Rini, Sughosh Ganu, Mattijs Korpershoek, Ilias Apalodimas,
	Mark Kettenis, u-boot, Heinrich Schuchardt

The EFI boot-manager is the default method to boot EFI binaries.
We should be able to use it on the Sandbox.

* Enable EFI boot-manager bootmethod on the sandbox.
* Adjust unit tests to reflect the additional boot method.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 arch/sandbox/dts/test.dts |  4 ++++
 test/boot/bootmeth.c      | 28 +++++++++++++++++-----------
 2 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 8412506c17a..1248ed66089 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -119,6 +119,10 @@
 			compatible = "u-boot,distro-efi";
 		};
 
+		efimgr {
+			compatible = "u-boot,efi-bootmgr";
+		};
+
 		theme {
 			font-size = <30>;
 			menu-inset = <3>;
diff --git a/test/boot/bootmeth.c b/test/boot/bootmeth.c
index 518d99c4a27..fe175ccb755 100644
--- a/test/boot/bootmeth.c
+++ b/test/boot/bootmeth.c
@@ -21,11 +21,13 @@ static int bootmeth_cmd_list(struct unit_test_state *uts)
 	ut_assert_nextlinen("---");
 	ut_assert_nextline("    0    0  extlinux            Extlinux boot from a block device");
 	ut_assert_nextline("    1    1  efi                 EFI boot from an .efi file");
-	if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL))
-		ut_assert_nextline(" glob    2  firmware0           VBE simple");
+	if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL)) {
+		ut_assert_nextline(" glob    2  efimgr              EFI bootmgr flow");
+		ut_assert_nextline(" glob    3  firmware0           VBE simple");
+	}
 	ut_assert_nextlinen("---");
 	ut_assert_nextline(IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) ?
-		 "(3 bootmeths)" : "(2 bootmeths)");
+		 "(4 bootmeths)" : "(2 bootmeths)");
 	ut_assert_console_end();
 
 	return 0;
@@ -56,11 +58,13 @@ static int bootmeth_cmd_order(struct unit_test_state *uts)
 	ut_assert_nextlinen("---");
 	ut_assert_nextline("    0    0  extlinux            Extlinux boot from a block device");
 	ut_assert_nextline("    -    1  efi                 EFI boot from an .efi file");
-	if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL))
-		ut_assert_nextline(" glob    2  firmware0           VBE simple");
+	if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL)) {
+		ut_assert_nextline(" glob    2  efimgr              EFI bootmgr flow");
+		ut_assert_nextline(" glob    3  firmware0           VBE simple");
+	}
 	ut_assert_nextlinen("---");
 	ut_assert_nextline(IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) ?
-		 "(3 bootmeths)" : "(2 bootmeths)");
+		 "(4 bootmeths)" : "(2 bootmeths)");
 	ut_assert_console_end();
 
 	/* Check the -a flag with the reverse order */
@@ -71,11 +75,13 @@ static int bootmeth_cmd_order(struct unit_test_state *uts)
 	ut_assert_nextlinen("---");
 	ut_assert_nextline("    1    0  extlinux            Extlinux boot from a block device");
 	ut_assert_nextline("    0    1  efi                 EFI boot from an .efi file");
-	if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL))
-		ut_assert_nextline(" glob    2  firmware0           VBE simple");
+	if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL)) {
+		ut_assert_nextline(" glob    2  efimgr              EFI bootmgr flow");
+		ut_assert_nextline(" glob    3  firmware0           VBE simple");
+	}
 	ut_assert_nextlinen("---");
 	ut_assert_nextline(IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) ?
-		 "(3 bootmeths)" : "(2 bootmeths)");
+		 "(4 bootmeths)" : "(2 bootmeths)");
 	ut_assert_console_end();
 
 	/* Now reset the order to empty, which should show all of them again */
@@ -84,7 +90,7 @@ static int bootmeth_cmd_order(struct unit_test_state *uts)
 	ut_assertnull(env_get("bootmeths"));
 	ut_assertok(run_command("bootmeth list", 0));
 	ut_assert_skip_to_line(IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) ?
-		 "(3 bootmeths)" : "(2 bootmeths)");
+		 "(4 bootmeths)" : "(2 bootmeths)");
 
 	/* Try reverse order */
 	ut_assertok(run_command("bootmeth order \"efi extlinux\"", 0));
@@ -116,7 +122,7 @@ static int bootmeth_cmd_order_glob(struct unit_test_state *uts)
 	ut_assert_nextline("Order  Seq  Name                Description");
 	ut_assert_nextlinen("---");
 	ut_assert_nextline("    0    1  efi                 EFI boot from an .efi file");
-	ut_assert_nextline(" glob    2  firmware0           VBE simple");
+	ut_assert_nextline(" glob    3  firmware0           VBE simple");
 	ut_assert_nextlinen("---");
 	ut_assert_nextline("(2 bootmeths)");
 	ut_assertnonnull(env_get("bootmeths"));
-- 
2.45.2


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

* Re: [PATCH 1/1] sandbox: add bootmethod EFI boot-manager
  2024-10-08 22:32 [PATCH 1/1] sandbox: add bootmethod EFI boot-manager Heinrich Schuchardt
@ 2024-10-09  1:58 ` Simon Glass
  2024-10-11 14:27 ` Mattijs Korpershoek
  1 sibling, 0 replies; 5+ messages in thread
From: Simon Glass @ 2024-10-09  1:58 UTC (permalink / raw)
  To: Heinrich Schuchardt
  Cc: Tom Rini, Sughosh Ganu, Mattijs Korpershoek, Ilias Apalodimas,
	Mark Kettenis, u-boot

On Tue, 8 Oct 2024 at 16:32, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> The EFI boot-manager is the default method to boot EFI binaries.
> We should be able to use it on the Sandbox.
>
> * Enable EFI boot-manager bootmethod on the sandbox.
> * Adjust unit tests to reflect the additional boot method.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  arch/sandbox/dts/test.dts |  4 ++++
>  test/boot/bootmeth.c      | 28 +++++++++++++++++-----------
>  2 files changed, 21 insertions(+), 11 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

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

* Re: [PATCH 1/1] sandbox: add bootmethod EFI boot-manager
  2024-10-08 22:32 [PATCH 1/1] sandbox: add bootmethod EFI boot-manager Heinrich Schuchardt
  2024-10-09  1:58 ` Simon Glass
@ 2024-10-11 14:27 ` Mattijs Korpershoek
  2024-10-17 23:23   ` Simon Glass
  1 sibling, 1 reply; 5+ messages in thread
From: Mattijs Korpershoek @ 2024-10-11 14:27 UTC (permalink / raw)
  To: Heinrich Schuchardt, Simon Glass
  Cc: Tom Rini, Sughosh Ganu, Ilias Apalodimas, Mark Kettenis, u-boot,
	Heinrich Schuchardt

Hi Heinrich,

Thank you for the patch.

On mer., oct. 09, 2024 at 00:32, Heinrich Schuchardt <heinrich.schuchardt@canonical.com> wrote:

> The EFI boot-manager is the default method to boot EFI binaries.
> We should be able to use it on the Sandbox.
>
> * Enable EFI boot-manager bootmethod on the sandbox.
> * Adjust unit tests to reflect the additional boot method.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

> ---
>  arch/sandbox/dts/test.dts |  4 ++++
>  test/boot/bootmeth.c      | 28 +++++++++++++++++-----------
>  2 files changed, 21 insertions(+), 11 deletions(-)
>
> diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> index 8412506c17a..1248ed66089 100644
> --- a/arch/sandbox/dts/test.dts
> +++ b/arch/sandbox/dts/test.dts
> @@ -119,6 +119,10 @@
>  			compatible = "u-boot,distro-efi";
>  		};
>  
> +		efimgr {
> +			compatible = "u-boot,efi-bootmgr";
> +		};
> +
>  		theme {
>  			font-size = <30>;
>  			menu-inset = <3>;
> diff --git a/test/boot/bootmeth.c b/test/boot/bootmeth.c
> index 518d99c4a27..fe175ccb755 100644
> --- a/test/boot/bootmeth.c
> +++ b/test/boot/bootmeth.c
> @@ -21,11 +21,13 @@ static int bootmeth_cmd_list(struct unit_test_state *uts)
>  	ut_assert_nextlinen("---");
>  	ut_assert_nextline("    0    0  extlinux            Extlinux boot from a block device");
>  	ut_assert_nextline("    1    1  efi                 EFI boot from an .efi file");
> -	if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL))
> -		ut_assert_nextline(" glob    2  firmware0           VBE simple");
> +	if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL)) {
> +		ut_assert_nextline(" glob    2  efimgr              EFI bootmgr flow");
> +		ut_assert_nextline(" glob    3  firmware0           VBE simple");
> +	}
>  	ut_assert_nextlinen("---");
>  	ut_assert_nextline(IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) ?
> -		 "(3 bootmeths)" : "(2 bootmeths)");
> +		 "(4 bootmeths)" : "(2 bootmeths)");
>  	ut_assert_console_end();
>  
>  	return 0;
> @@ -56,11 +58,13 @@ static int bootmeth_cmd_order(struct unit_test_state *uts)
>  	ut_assert_nextlinen("---");
>  	ut_assert_nextline("    0    0  extlinux            Extlinux boot from a block device");
>  	ut_assert_nextline("    -    1  efi                 EFI boot from an .efi file");
> -	if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL))
> -		ut_assert_nextline(" glob    2  firmware0           VBE simple");
> +	if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL)) {
> +		ut_assert_nextline(" glob    2  efimgr              EFI bootmgr flow");
> +		ut_assert_nextline(" glob    3  firmware0           VBE simple");
> +	}
>  	ut_assert_nextlinen("---");
>  	ut_assert_nextline(IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) ?
> -		 "(3 bootmeths)" : "(2 bootmeths)");
> +		 "(4 bootmeths)" : "(2 bootmeths)");
>  	ut_assert_console_end();
>  
>  	/* Check the -a flag with the reverse order */
> @@ -71,11 +75,13 @@ static int bootmeth_cmd_order(struct unit_test_state *uts)
>  	ut_assert_nextlinen("---");
>  	ut_assert_nextline("    1    0  extlinux            Extlinux boot from a block device");
>  	ut_assert_nextline("    0    1  efi                 EFI boot from an .efi file");
> -	if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL))
> -		ut_assert_nextline(" glob    2  firmware0           VBE simple");
> +	if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL)) {
> +		ut_assert_nextline(" glob    2  efimgr              EFI bootmgr flow");
> +		ut_assert_nextline(" glob    3  firmware0           VBE simple");
> +	}
>  	ut_assert_nextlinen("---");
>  	ut_assert_nextline(IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) ?
> -		 "(3 bootmeths)" : "(2 bootmeths)");
> +		 "(4 bootmeths)" : "(2 bootmeths)");
>  	ut_assert_console_end();
>  
>  	/* Now reset the order to empty, which should show all of them again */
> @@ -84,7 +90,7 @@ static int bootmeth_cmd_order(struct unit_test_state *uts)
>  	ut_assertnull(env_get("bootmeths"));
>  	ut_assertok(run_command("bootmeth list", 0));
>  	ut_assert_skip_to_line(IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) ?
> -		 "(3 bootmeths)" : "(2 bootmeths)");
> +		 "(4 bootmeths)" : "(2 bootmeths)");
>  
>  	/* Try reverse order */
>  	ut_assertok(run_command("bootmeth order \"efi extlinux\"", 0));
> @@ -116,7 +122,7 @@ static int bootmeth_cmd_order_glob(struct unit_test_state *uts)
>  	ut_assert_nextline("Order  Seq  Name                Description");
>  	ut_assert_nextlinen("---");
>  	ut_assert_nextline("    0    1  efi                 EFI boot from an .efi file");
> -	ut_assert_nextline(" glob    2  firmware0           VBE simple");
> +	ut_assert_nextline(" glob    3  firmware0           VBE simple");
>  	ut_assert_nextlinen("---");
>  	ut_assert_nextline("(2 bootmeths)");
>  	ut_assertnonnull(env_get("bootmeths"));
> -- 
> 2.45.2

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

* Re: [PATCH 1/1] sandbox: add bootmethod EFI boot-manager
  2024-10-11 14:27 ` Mattijs Korpershoek
@ 2024-10-17 23:23   ` Simon Glass
  2024-10-18  1:00     ` Heinrich Schuchardt
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Glass @ 2024-10-17 23:23 UTC (permalink / raw)
  To: Mattijs Korpershoek
  Cc: Heinrich Schuchardt, Tom Rini, Sughosh Ganu, Ilias Apalodimas,
	Mark Kettenis, u-boot

Hi Heinrich,

On Fri, 11 Oct 2024 at 08:27, Mattijs Korpershoek
<mkorpershoek@baylibre.com> wrote:
>
> Hi Heinrich,
>
> Thank you for the patch.
>
> On mer., oct. 09, 2024 at 00:32, Heinrich Schuchardt <heinrich.schuchardt@canonical.com> wrote:
>
> > The EFI boot-manager is the default method to boot EFI binaries.
> > We should be able to use it on the Sandbox.
> >
> > * Enable EFI boot-manager bootmethod on the sandbox.
> > * Adjust unit tests to reflect the additional boot method.
> >
> > Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
>
> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
>
> > ---
> >  arch/sandbox/dts/test.dts |  4 ++++
> >  test/boot/bootmeth.c      | 28 +++++++++++++++++-----------
> >  2 files changed, 21 insertions(+), 11 deletions(-)
> >

This produces the following output on sandbox, for me:

=> bootfl scan
efi_set_blk_dev_to_system_partition() No EFI system partition
efi_set_blk_dev_to_system_partition() No EFI system partition
     efi_var_to_file() Failed to persist EFI variables
efi_set_blk_dev_to_system_partition() No EFI system partition
     efi_var_to_file() Failed to persist EFI variables
efi_set_blk_dev_to_system_partition() No EFI system partition
     efi_var_to_file() Failed to persist EFI variables
efi_set_blk_dev_to_system_partition() No EFI system partition
     efi_var_to_file() Failed to persist EFI variables
efi_set_blk_dev_to_system_partition() No EFI system partition
     efi_var_to_file() Failed to persist EFI variables
efi_set_blk_dev_to_system_partition() No EFI system partition
     efi_var_to_file() Failed to persist EFI variables
efi_set_blk_dev_to_system_partition() No EFI system partition
     efi_var_to_file() Failed to persist EFI variables

Perhaps we need to make this option, e.g. with a 'bootstd' command to enable it?

Regards,
Simon

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

* Re: [PATCH 1/1] sandbox: add bootmethod EFI boot-manager
  2024-10-17 23:23   ` Simon Glass
@ 2024-10-18  1:00     ` Heinrich Schuchardt
  0 siblings, 0 replies; 5+ messages in thread
From: Heinrich Schuchardt @ 2024-10-18  1:00 UTC (permalink / raw)
  To: Simon Glass
  Cc: Tom Rini, Sughosh Ganu, Ilias Apalodimas, Mark Kettenis, u-boot,
	Mattijs Korpershoek

On 10/18/24 01:23, Simon Glass wrote:
> Hi Heinrich,
> 
> On Fri, 11 Oct 2024 at 08:27, Mattijs Korpershoek
> <mkorpershoek@baylibre.com> wrote:
>>
>> Hi Heinrich,
>>
>> Thank you for the patch.
>>
>> On mer., oct. 09, 2024 at 00:32, Heinrich Schuchardt <heinrich.schuchardt@canonical.com> wrote:
>>
>>> The EFI boot-manager is the default method to boot EFI binaries.
>>> We should be able to use it on the Sandbox.
>>>
>>> * Enable EFI boot-manager bootmethod on the sandbox.
>>> * Adjust unit tests to reflect the additional boot method.
>>>
>>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
>>
>> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
>>
>>> ---
>>>   arch/sandbox/dts/test.dts |  4 ++++
>>>   test/boot/bootmeth.c      | 28 +++++++++++++++++-----------
>>>   2 files changed, 21 insertions(+), 11 deletions(-)
>>>
> 
> This produces the following output on sandbox, for me:
> 
> => bootfl scan
> efi_set_blk_dev_to_system_partition() No EFI system partition
> efi_set_blk_dev_to_system_partition() No EFI system partition
>       efi_var_to_file() Failed to persist EFI variables
> efi_set_blk_dev_to_system_partition() No EFI system partition
>       efi_var_to_file() Failed to persist EFI variables
> efi_set_blk_dev_to_system_partition() No EFI system partition
>       efi_var_to_file() Failed to persist EFI variables
> efi_set_blk_dev_to_system_partition() No EFI system partition
>       efi_var_to_file() Failed to persist EFI variables
> efi_set_blk_dev_to_system_partition() No EFI system partition
>       efi_var_to_file() Failed to persist EFI variables
> efi_set_blk_dev_to_system_partition() No EFI system partition
>       efi_var_to_file() Failed to persist EFI variables
> efi_set_blk_dev_to_system_partition() No EFI system partition
>       efi_var_to_file() Failed to persist EFI variables
> 
> Perhaps we need to make this option, e.g. with a 'bootstd' command to enable it?

These messages only appear if you have no ESP on a connected block 
device and store EFI variables on disk. For each block device a BOOT#### 
variable is created.

Instead of changing this patch we should reduce the noisiness.

For a user it should be sufficient to read once that EFI variables 
cannot be persisted due to a missing ESP.

Best regards

Heinrich

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

end of thread, other threads:[~2024-10-18  1:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-08 22:32 [PATCH 1/1] sandbox: add bootmethod EFI boot-manager Heinrich Schuchardt
2024-10-09  1:58 ` Simon Glass
2024-10-11 14:27 ` Mattijs Korpershoek
2024-10-17 23:23   ` Simon Glass
2024-10-18  1:00     ` Heinrich Schuchardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox