[PATCH 1/1] sandbox: add bootmethod EFI boot-manager

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Wed Oct 9 00:32:19 CEST 2024


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 at 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



More information about the U-Boot mailing list