Skip to contentSkip to conversation

efi: Add a test for EFI bootmeth

PATCH Superseded Simon Glass 3 participants 23 messages Oct 19, 2024 – Oct 27, 2024

v7 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

v7 cover efi: Add a test for EFI bootmeth

The test coverage for the EFI bootmeth is incomplete since it does not actually boot the application.

This series creates a simple test for this purpose. It includes a few patches to make this work:

- Revert of an unreviewed patch to change the sandbox efi filename
- Hang in sandbox virtio due to EFI probing all block devices

Other necessary fixes have already been applied.

Changes in v7:
- Add a revert of the un-reviewed patch, instead of just changing it
- Just do the minimal update for the sandbox filename
- Update commit message
- Drop patches already applied
- Drop patch 'Disable ANSI output for tests'
- Rebase on -master

Changes in v6:
- Drop the patch to disable sandbox virtio blk with EFI
- Add new patch to disable the sandbox virtio blk device
- Deal with sandbox CONFIG_LOGF_FUNC
- Rebase on -next
- Drop patches previously applied
- Drop mention of helloworld since it is no-longer used by this test

Changes in v4:
- Add efi_loader tag to some patches
- Split out non-EFI patches into a different series

Changes in v2:
- Add many new patches to resolve all the outstanding test issues

Simon Glass (7):
test: boot: Update bootflow_iter() for console checking Revert "efi_loader: correctly identify binary name"
efi_loader: sandbox: Use a different filename for sandbox
efi_loader: Add a test app
sandbox: virtio: Disable the sandbox virtio blk device
test: efi: boot: Set up an image suitable for EFI testing
test: efi: boot: Add a test for the efi bootmeth

 arch/Kconfig                        |   3 +-
 arch/sandbox/dts/test.dts           |   2 +-
 include/efi_default_filename.h      |  25 +---------
 lib/efi_loader/Kconfig              |  10 ++++
 lib/efi_loader/Makefile             |   1 +
 lib/efi_loader/testapp.c            |  68 ++++++++++++++++++++++++++++
 test/boot/bootdev.c                 |  18 +++++++-
 test/boot/bootflow.c                |  64 +++++++++++++++++++++++++-
 test/py/tests/bootstd/flash1.img.xz | Bin 0 -> 5016 bytes
 test/py/tests/test_ut.py            |  52 ++++++++++++++++++---
 10 files changed, 209 insertions(+), 34 deletions(-)
 create mode 100644 lib/efi_loader/testapp.c
 create mode 100644 test/py/tests/bootstd/flash1.img.xz
Signature · 1 line
2.34.1
#1 lore raw

PATCH v7 1/7 test: boot: Update bootflow_iter() for console checking

This test checks console output so should have the UTF_CONSOLE flag. Add it.

---

(no changes since v1)

 test/boot/bootflow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
test/boot/bootflow.c +1 -1
index 154dea70a59..cc894e804a4 100644
@@ -370,7 +370,7 @@ static int bootflow_iter(struct unit_test_state *uts)
 
 	return 0;
 }
-BOOTSTD_TEST(bootflow_iter, UTF_DM | UTF_SCAN_FDT);
+BOOTSTD_TEST(bootflow_iter, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);
 
 #if defined(CONFIG_SANDBOX) && defined(CONFIG_BOOTMETH_GLOBAL)
 /* Check using the system bootdev */
Signature · 1 line
2.34.1
#2 lore raw

PATCH v7 2/7 Revert "efi_loader: correctly identify binary name"

In reply to Simon Glass

This patch was applied without sandbox review. It has changed how sandbox works and the original author has not been willing to discuss alternatives.

This reverts commit 3a0654ecd0d6a39406e6fe91f7a40ce589594ae9.

---

Changes in v7:
- Add a revert of the un-reviewed patch, instead of just changing it

 include/efi_default_filename.h | 41 +++++++++++++---------------------
 1 file changed, 15 insertions(+), 26 deletions(-)
include/efi_default_filename.h +15 -26
index 77932984b55..13b9de8754a 100644
@@ -5,7 +5,6 @@
  * file name is defined in this include.
  *
  * Copyright (c) 2022, Heinrich Schuchardt <[email protected]>
- * Copyright (c) 2022, Linaro Limited
  */
 
 #ifndef _EFI_DEFAULT_FILENAME_H
@@ -15,42 +14,32 @@
 
 #undef BOOTEFI_NAME
 
-#ifdef CONFIG_SANDBOX
-
 #if HOST_ARCH == HOST_ARCH_X86_64
 #define BOOTEFI_NAME "BOOTX64.EFI"
-#elif HOST_ARCH == HOST_ARCH_X86
-#define BOOTEFI_NAME "BOOTIA32.EFI"
-#elif HOST_ARCH == HOST_ARCH_AARCH64
-#define BOOTEFI_NAME "BOOTAA64.EFI"
-#elif HOST_ARCH == HOST_ARCH_ARM
-#define BOOTEFI_NAME "BOOTARM.EFI"
-#elif HOST_ARCH == HOST_ARCH_RISCV32
-#define BOOTEFI_NAME "BOOTRISCV32.EFI"
-#elif HOST_ARCH == HOST_ARCH_RISCV64
-#define BOOTEFI_NAME "BOOTRISCV64.EFI"
-#else
-#error Unsupported UEFI architecture
 #endif
 
-#else
+#if HOST_ARCH == HOST_ARCH_X86
+#define BOOTEFI_NAME "BOOTIA32.EFI"
+#endif
 
-#if defined(CONFIG_ARM64)
+#if HOST_ARCH == HOST_ARCH_AARCH64
 #define BOOTEFI_NAME "BOOTAA64.EFI"
-#elif defined(CONFIG_ARM)
+#endif
+
+#if HOST_ARCH == HOST_ARCH_ARM
 #define BOOTEFI_NAME "BOOTARM.EFI"
-#elif defined(CONFIG_X86_64)
-#define BOOTEFI_NAME "BOOTX64.EFI"
-#elif defined(CONFIG_X86)
-#define BOOTEFI_NAME "BOOTIA32.EFI"
-#elif defined(CONFIG_ARCH_RV32I)
+#endif
+
+#if HOST_ARCH == HOST_ARCH_RISCV32
 #define BOOTEFI_NAME "BOOTRISCV32.EFI"
-#elif defined(CONFIG_ARCH_RV64I)
+#endif
+
+#if HOST_ARCH == HOST_ARCH_RISCV64
 #define BOOTEFI_NAME "BOOTRISCV64.EFI"
-#else
-#error Unsupported UEFI architecture
 #endif
 
+#ifndef BOOTEFI_NAME
+#error Unsupported UEFI architecture
 #endif
 
 #endif
Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH v7 2/7] Revert "efi_loader: correctly identify binary name"

Quoted 11 lines

From: Simon Glass <[email protected]>
Date: Sat, 19 Oct 2024 09:24:29 -0600

This patch was applied without sandbox review. It has changed how sandbox works and the original author has not been willing to discuss alternatives.

This reverts commit 3a0654ecd0d6a39406e6fe91f7a40ce589594ae9.

---

This breaks EFI booting from removable media in a cross-compiled U-Boot. And you still end up with the same HOST_ARCH-dependent BOOTEFI_NAME for sandbox, so no, this didn't change how sandbox works.

Quoted 80 lines

Changes in v7:
- Add a revert of the un-reviewed patch, instead of just changing it

 include/efi_default_filename.h | 41 +++++++++++++---------------------
 1 file changed, 15 insertions(+), 26 deletions(-)
include/efi_default_filename.h +15 -26
index 77932984b55..13b9de8754a 100644
@@ -5,7 +5,6 @@
  * file name is defined in this include.
  *
  * Copyright (c) 2022, Heinrich Schuchardt <[email protected]>
- * Copyright (c) 2022, Linaro Limited
  */
 
 #ifndef _EFI_DEFAULT_FILENAME_H
@@ -15,42 +14,32 @@
 
 #undef BOOTEFI_NAME
 
-#ifdef CONFIG_SANDBOX
-
 #if HOST_ARCH == HOST_ARCH_X86_64
 #define BOOTEFI_NAME "BOOTX64.EFI"
-#elif HOST_ARCH == HOST_ARCH_X86
-#define BOOTEFI_NAME "BOOTIA32.EFI"
-#elif HOST_ARCH == HOST_ARCH_AARCH64
-#define BOOTEFI_NAME "BOOTAA64.EFI"
-#elif HOST_ARCH == HOST_ARCH_ARM
-#define BOOTEFI_NAME "BOOTARM.EFI"
-#elif HOST_ARCH == HOST_ARCH_RISCV32
-#define BOOTEFI_NAME "BOOTRISCV32.EFI"
-#elif HOST_ARCH == HOST_ARCH_RISCV64
-#define BOOTEFI_NAME "BOOTRISCV64.EFI"
-#else
-#error Unsupported UEFI architecture
 #endif
 
-#else
+#if HOST_ARCH == HOST_ARCH_X86
+#define BOOTEFI_NAME "BOOTIA32.EFI"
+#endif
 
-#if defined(CONFIG_ARM64)
+#if HOST_ARCH == HOST_ARCH_AARCH64
 #define BOOTEFI_NAME "BOOTAA64.EFI"
-#elif defined(CONFIG_ARM)
+#endif
+
+#if HOST_ARCH == HOST_ARCH_ARM
 #define BOOTEFI_NAME "BOOTARM.EFI"
-#elif defined(CONFIG_X86_64)
-#define BOOTEFI_NAME "BOOTX64.EFI"
-#elif defined(CONFIG_X86)
-#define BOOTEFI_NAME "BOOTIA32.EFI"
-#elif defined(CONFIG_ARCH_RV32I)
+#endif
+
+#if HOST_ARCH == HOST_ARCH_RISCV32
 #define BOOTEFI_NAME "BOOTRISCV32.EFI"
-#elif defined(CONFIG_ARCH_RV64I)
+#endif
+
+#if HOST_ARCH == HOST_ARCH_RISCV64
 #define BOOTEFI_NAME "BOOTRISCV64.EFI"
-#else
-#error Unsupported UEFI architecture
 #endif
 
+#ifndef BOOTEFI_NAME
+#error Unsupported UEFI architecture
 #endif
 
 #endif
Signature · 1 line
2.34.1
#4 lore raw

PATCH v7 3/7 efi_loader: sandbox: Use a different filename for sandbox

In reply to Simon Glass

Sandbox is a separate architecture in U-Boot. We want to create binaries which can run no matter what host architecture is in use.

Create a special filename for sandbox, to avoid needing different code paths when creating the file in CI.

---

Changes in v7:
- Just do the minimal update for the sandbox filename

 include/efi_default_filename.h | 32 +++++++++++---------------------
 1 file changed, 11 insertions(+), 21 deletions(-)
include/efi_default_filename.h +11 -21
index 13b9de8754a..6806c0daa88 100644
@@ -14,31 +14,21 @@
 
 #undef BOOTEFI_NAME
 
-#if HOST_ARCH == HOST_ARCH_X86_64
-#define BOOTEFI_NAME "BOOTX64.EFI"
-#endif
-
-#if HOST_ARCH == HOST_ARCH_X86
-#define BOOTEFI_NAME "BOOTIA32.EFI"
-#endif
-
-#if HOST_ARCH == HOST_ARCH_AARCH64
+#ifdef CONFIG_SANDBOX
+#define BOOTEFI_NAME "BOOTSBOX.EFI"
+#elif defined(CONFIG_ARM64)
 #define BOOTEFI_NAME "BOOTAA64.EFI"
-#endif
-
-#if HOST_ARCH == HOST_ARCH_ARM
+#elif defined(CONFIG_ARM)
 #define BOOTEFI_NAME "BOOTARM.EFI"
-#endif
-
-#if HOST_ARCH == HOST_ARCH_RISCV32
+#elif defined(CONFIG_X86_64)
+#define BOOTEFI_NAME "BOOTX64.EFI"
+#elif defined(CONFIG_X86)
+#define BOOTEFI_NAME "BOOTIA32.EFI"
+#elif defined(CONFIG_ARCH_RV32I)
 #define BOOTEFI_NAME "BOOTRISCV32.EFI"
-#endif
-
-#if HOST_ARCH == HOST_ARCH_RISCV64
+#elif defined(CONFIG_ARCH_RV64I)
 #define BOOTEFI_NAME "BOOTRISCV64.EFI"
-#endif
-
-#ifndef BOOTEFI_NAME
+#else
 #error Unsupported UEFI architecture
 #endif
 
Signature · 1 line
2.34.1
#5 lore raw

PATCH v7 4/7 efi_loader: Add a test app

In reply to Simon Glass

Add a simple app to use for testing. This is intended to do whatever it needs to for testing purposes. For now it just prints a message and exits boot services.

There was a considerable amount of discussion about whether it is OK to call exit-boot-services and then return to U-Boot. This is not normally done in a real application, since exit-boot-services is used to completely disconnect from U-Boot. However, since this is a test, we need to check the results of running the app, so returning is necessary. It works correctly and it provides a nice model of how to test the EFI code in a simple way.

---

Changes in v7:
- Update commit message

 lib/efi_loader/Kconfig   | 10 ++++++
 lib/efi_loader/Makefile  |  1 +
 lib/efi_loader/testapp.c | 68 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 79 insertions(+)
 create mode 100644 lib/efi_loader/testapp.c
lib/efi_loader/Kconfig +10 -0
index 69b2c9360d8..6ced29da719 100644
@@ -565,6 +565,16 @@ config BOOTEFI_HELLO_COMPILE
 	  No additional space will be required in the resulting U-Boot binary
 	  when this option is enabled.
 
+config BOOTEFI_TESTAPP_COMPILE
+	bool "Compile an EFI test app for testing"
+	default y
+	help
+	  This compiles an app designed for testing. It is packed into an image
+	  by the test.py testing frame in the setup_efi_image() function.
+
+	  No additional space will be required in the resulting U-Boot binary
+	  when this option is enabled.
+
 endif
 
 source "lib/efi/Kconfig"
lib/efi_loader/Makefile +1 -0
index 00d18966f9e..87131ab911d 100644
@@ -20,6 +20,7 @@ apps-$(CONFIG_EFI_LOAD_FILE2_INITRD) += initrddump
 ifeq ($(CONFIG_GENERATE_ACPI_TABLE),)
 apps-y += dtbdump
 endif
+apps-$(CONFIG_BOOTEFI_TESTAPP_COMPILE) += testapp
 
 obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
 obj-$(CONFIG_EFI_BOOTMGR) += efi_bootmgr.o
lib/efi_loader/testapp.c new file +68 -0

68 lines not on this page · raw message

Signature · 1 line
2.34.1
#6 lore raw

PATCH v7 5/7 sandbox: virtio: Disable the sandbox virtio blk device

In reply to Simon Glass

This is not implemented so cannot actually be used to read blocks. Disable it until it is implemented, to avoid causing a hang with EFI, which probes every available BLK device.

Issue: https://source.denx.de/u-boot/u-boot/-/issues/37
---

(no changes since v6)

Changes in v6:
- Drop the patch to disable sandbox virtio blk with EFI
- Add new patch to disable the sandbox virtio blk device

 arch/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/Kconfig +2 -1
index 8f1f4667012..c39efb4d0a2 100644
@@ -212,7 +212,8 @@ config SANDBOX
 	imply VIRTIO_MMIO
 	imply VIRTIO_PCI
 	imply VIRTIO_SANDBOX
-	imply VIRTIO_BLK
+	# Re-enable this when fully implemented
+	# imply VIRTIO_BLK
 	imply VIRTIO_NET
 	imply DM_SOUND
 	imply PCI_SANDBOX_EP
Signature · 1 line
2.34.1
Reviewed-by on v7 5/7
#7 lore raw

Re: [PATCH v7 5/7] sandbox: virtio: Disable the sandbox virtio blk device

Quoted 6 lines · Simon Glass

This is not implemented so cannot actually be used to read blocks. Disable it until it is implemented, to avoid causing a hang with EFI, which probes every available BLK device.

Issue: https://source.denx.de/u-boot/u-boot/-/issues/37

Signature · 1 line
Tom
#8 lore raw

PATCH v7 6/7 test: efi: boot: Set up an image suitable for EFI testing

In reply to Simon Glass

Create a new disk for use with tests, which contains the new 'testapp' EFI app specifically intended for testing the EFI loader.

Attach it to the USB device, since most testing is currently done with mmc.

Initially this image will be used to test the EFI bootmeth.

Fix a stale comment in prep_mmc_bootdev() while we are here.

For now this uses sudo and a compressed fallback file, like all the other bootstd tests. Once this series is in, the patch which moves this to use user-space tools will be cleaned up and re-submitted.

---
Here is the patch to avoid sudo and CI fallback:

[1] https://patchwork.ozlabs.org/project/uboot/patch/
[email protected]/

(no changes since v1)

 arch/sandbox/dts/test.dts           |   2 +-
 test/boot/bootdev.c                 |  18 +++++++++-
 test/boot/bootflow.c                |   2 +-
 test/py/tests/bootstd/flash1.img.xz | Bin 0 -> 5016 bytes
 test/py/tests/test_ut.py            |  52 ++++++++++++++++++++++++----
 5 files changed, 65 insertions(+), 9 deletions(-)
 create mode 100644 test/py/tests/bootstd/flash1.img.xz
arch/sandbox/dts/test.dts +1 -1
index 9bf44ae3b0b..f40fd5a2b16 100644
@@ -1512,7 +1512,7 @@
 				flash-stick@1 {
 					reg = <1>;
 					compatible = "sandbox,usb-flash";
-					sandbox,filepath = "testflash1.bin";
+					sandbox,filepath = "flash1.img";
 				};
 
 				flash-stick@2 {
test/boot/bootdev.c +17 -1
index 369105ca4cf..c892854b227 100644
@@ -221,6 +221,10 @@ static int bootdev_test_order(struct unit_test_state *uts)
 	/* Use the environment variable to override it */
 	ut_assertok(env_set("boot_targets", "mmc1 mmc2 usb"));
 	ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
+
+	/* get the usb device which has a backing file (flash1.img) */
+	ut_asserteq(0, bootflow_scan_next(&iter, &bflow));
+
 	ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow));
 	ut_asserteq(5, iter.num_devs);
 	ut_asserteq_str("mmc1.bootdev", iter.dev_used[0]->name);
@@ -260,7 +264,11 @@ static int bootdev_test_order(struct unit_test_state *uts)
 	ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
 	ut_asserteq(2, iter.num_devs);
 
-	/* Now scan past mmc1 and make sure that the 3 USB devices show up */
+	/*
+	 * Now scan past mmc1 and make sure that the 3 USB devices show up. The
+	 * first one has a backing file so returns success
+	 */
+	ut_asserteq(0, bootflow_scan_next(&iter, &bflow));
 	ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow));
 	ut_asserteq(6, iter.num_devs);
 	ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name);
@@ -322,6 +330,10 @@ static int bootdev_test_prio(struct unit_test_state *uts)
 
 	/* 3 MMC and 3 USB bootdevs: MMC should come before USB */
 	ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
+
+	/* get the usb device which has a backing file (flash1.img) */
+	ut_asserteq(0, bootflow_scan_next(&iter, &bflow));
+
 	ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow));
 	ut_asserteq(6, iter.num_devs);
 	ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name);
@@ -339,6 +351,10 @@ static int bootdev_test_prio(struct unit_test_state *uts)
 	bootflow_iter_uninit(&iter);
 	ut_assertok(bootflow_scan_first(NULL, NULL, &iter, BOOTFLOWIF_HUNT,
 					&bflow));
+
+	/* get the usb device which has a backing file (flash1.img) */
+	ut_asserteq(0, bootflow_scan_next(&iter, &bflow));
+
 	ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow));
 	ut_asserteq(7, iter.num_devs);
 	ut_asserteq_str("usb_mass_storage.lun0.bootdev",
test/boot/bootflow.c +1 -1
index cc894e804a4..0a819998ebd 100644
@@ -533,7 +533,7 @@ static int prep_mmc_bootdev(struct unit_test_state *uts, const char *mmc_dev,
 
 	order[2] = mmc_dev;
 
-	/* Enable the mmc4 node since we need a second bootflow */
+	/* Enable the requested mmc node since we need a second bootflow */
 	root = oftree_root(oftree_default());
 	node = ofnode_find_subnode(root, mmc_dev);
 	ut_assert(ofnode_valid(node));
test/py/tests/bootstd/flash1.img.xz new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..9148b91a20c1f0acb54449b124d1408961e92507
GIT binary patch
test/py/tests/test_ut.py +46 -6

95 lines not on this page · raw message

Signature · 1 line
2.34.1
#9 lore raw

Re: [PATCH v7 6/7] test: efi: boot: Set up an image suitable for EFI testing

Quoted 22 lines · Simon Glass

Create a new disk for use with tests, which contains the new 'testapp' EFI app specifically intended for testing the EFI loader.

Attach it to the USB device, since most testing is currently done with mmc.

Initially this image will be used to test the EFI bootmeth.

Fix a stale comment in prep_mmc_bootdev() while we are here.

For now this uses sudo and a compressed fallback file, like all the other bootstd tests. Once this series is in, the patch which moves this to use user-space tools will be cleaned up and re-submitted.

---
Here is the patch to avoid sudo and CI fallback:

[1] https://patchwork.ozlabs.org/project/uboot/patch/
[email protected]/

Quoted 6 lines

(no changes since v1)

 arch/sandbox/dts/test.dts           |   2 +-
 test/boot/bootdev.c                 |  18 +++++++++-
 test/boot/bootflow.c                |   2 +-
 test/py/tests/bootstd/flash1.img.xz | Bin 0 -> 5016 bytes

This I think best illustrates the problem with "BOOTSBOX.EFI". This image will work for CI up until I can figure out how to get access to free arm64 servers to run some tests on and then it will fail.

This is also an ext4 image and while the specification only says SHOULD for being FAT32 there are practical problems with using ext4 and not FAT32 for us (some missing features in our ext4 implementation that prevent variables from working) and so should be done as FAT32 and not ext4.

Signature · 1 line
Tom
#10 lore raw

Re: [PATCH v7 6/7] test: efi: boot: Set up an image suitable for EFI testing

Hi Tom,

Quoted 27 lines · Tom Rini
Quoted 24 lines · Simon Glass

Create a new disk for use with tests, which contains the new 'testapp' EFI app specifically intended for testing the EFI loader.

Attach it to the USB device, since most testing is currently done with mmc.

Initially this image will be used to test the EFI bootmeth.

Fix a stale comment in prep_mmc_bootdev() while we are here.

For now this uses sudo and a compressed fallback file, like all the other bootstd tests. Once this series is in, the patch which moves this to use user-space tools will be cleaned up and re-submitted.

---
Here is the patch to avoid sudo and CI fallback:

[1] https://patchwork.ozlabs.org/project/uboot/patch/
[email protected]/

(no changes since v1)

Quoted 8 lines
Quoted 4 lines
 arch/sandbox/dts/test.dts           |   2 +-
 test/boot/bootdev.c                 |  18 +++++++++-
 test/boot/bootflow.c                |   2 +-
 test/py/tests/bootstd/flash1.img.xz | Bin 0 -> 5016 bytes

This I think best illustrates the problem with "BOOTSBOX.EFI". This image will work for CI up until I can figure out how to get access to free arm64 servers to run some tests on and then it will fail.

I don't believe so. Why do you think that?

BTW it would be good to get CI running on arm. I believe Linaro might have some servers. I keep thinking of getting an Ampere device but so far have resisted as it is UEFI with closed firmware...

Quoted 6 lines

This is also an ext4 image and while the specification only says SHOULD for being FAT32 there are practical problems with using ext4 and not FAT32 for us (some missing features in our ext4 implementation that prevent variables from working) and so should be done as FAT32 and not ext4.

OK I'll update it.

IMO FAT32 is one of the things that will kill EFI eventually, if they don't sort it out. It just isn't reliable enough for commercial use, unless no one ever writes to it.

Regards,
Simon

#11 lore raw

Re: [PATCH v7 6/7] test: efi: boot: Set up an image suitable for EFI testing

Quoted 35 lines · Simon Glass

Hi Tom,

Quoted 32 lines · Tom Rini
Quoted 28 lines · Simon Glass

Create a new disk for use with tests, which contains the new 'testapp' EFI app specifically intended for testing the EFI loader.

Attach it to the USB device, since most testing is currently done with mmc.

Initially this image will be used to test the EFI bootmeth.

Fix a stale comment in prep_mmc_bootdev() while we are here.

For now this uses sudo and a compressed fallback file, like all the other bootstd tests. Once this series is in, the patch which moves this to use user-space tools will be cleaned up and re-submitted.

---
Here is the patch to avoid sudo and CI fallback:

[1] https://patchwork.ozlabs.org/project/uboot/patch/
[email protected]/

(no changes since v1)

 arch/sandbox/dts/test.dts           |   2 +-
 test/boot/bootdev.c                 |  18 +++++++++-
 test/boot/bootflow.c                |   2 +-
 test/py/tests/bootstd/flash1.img.xz | Bin 0 -> 5016 bytes
Quoted 5 lines
Quoted 3 lines

This I think best illustrates the problem with "BOOTSBOX.EFI". This image will work for CI up until I can figure out how to get access to free arm64 servers to run some tests on and then it will fail.

I don't believe so. Why do you think that?

Because it includes the BOOTSBOX.EFI x86 binary file, and executes it? Or did I miss where we update the contents to include that file as we just built it (and so why have it included?) ?

Quoted 3 lines

BTW it would be good to get CI running on arm. I believe Linaro might have some servers. I keep thinking of getting an Ampere device but so far have resisted as it is UEFI with closed firmware...

The problem is more, for GitLab, getting anyone to maintain and provide a runner and then for Azure, waiting for Microsoft to include some in the free tier. I think for the former, at one point I was thinking about using one of Oracle's always-free tier ones and for a small enough subset of things (like a host tools and a sandbox run) it might be fine.

Signature · 1 line
Tom
#12 lore raw

Re: [PATCH v7 6/7] test: efi: boot: Set up an image suitable for EFI testing

Hi Tom,

Quoted 41 lines · Tom Rini
Quoted 39 lines · Simon Glass

Hi Tom,

Quoted 35 lines · Tom Rini
Quoted 22 lines · Simon Glass

Create a new disk for use with tests, which contains the new 'testapp' EFI app specifically intended for testing the EFI loader.

Attach it to the USB device, since most testing is currently done with mmc.

Initially this image will be used to test the EFI bootmeth.

Fix a stale comment in prep_mmc_bootdev() while we are here.

For now this uses sudo and a compressed fallback file, like all the other bootstd tests. Once this series is in, the patch which moves this to use user-space tools will be cleaned up and re-submitted.

---
Here is the patch to avoid sudo and CI fallback:

[1] https://patchwork.ozlabs.org/project/uboot/patch/
[email protected]/

Quoted 6 lines

(no changes since v1)

 arch/sandbox/dts/test.dts           |   2 +-
 test/boot/bootdev.c                 |  18 +++++++++-
 test/boot/bootflow.c                |   2 +-
 test/py/tests/bootstd/flash1.img.xz | Bin 0 -> 5016 bytes

This I think best illustrates the problem with "BOOTSBOX.EFI". This image will work for CI up until I can figure out how to get access to free arm64 servers to run some tests on and then it will fail.

Quoted 5 lines
Quoted 1 line

I don't believe so. Why do you think that?

Because it includes the BOOTSBOX.EFI x86 binary file, and executes it? Or did I miss where we update the contents to include that file as we just built it (and so why have it included?) ?

It works fine on x86 and I'm sure it will work fine on ARM as well. The file is built with the host compiler, just as U-Boot itself is.

Quoted 10 lines
Quoted 4 lines

BTW it would be good to get CI running on arm. I believe Linaro might have some servers. I keep thinking of getting an Ampere device but so far have resisted as it is UEFI with closed firmware...

The problem is more, for GitLab, getting anyone to maintain and provide a runner and then for Azure, waiting for Microsoft to include some in the free tier. I think for the former, at one point I was thinking about using one of Oracle's always-free tier ones and for a small enough subset of things (like a host tools and a sandbox run) it might be fine.

OK. I suspect Ilias might be able to help.

Regards,
Simon

#13 lore raw

Re: [PATCH v7 6/7] test: efi: boot: Set up an image suitable for EFI testing

Quoted 44 lines · Simon Glass

Hi Tom,

Quoted 41 lines · Tom Rini
Quoted 39 lines · Simon Glass

Hi Tom,

Quoted 35 lines · Tom Rini
Quoted 22 lines · Simon Glass

Create a new disk for use with tests, which contains the new 'testapp' EFI app specifically intended for testing the EFI loader.

Attach it to the USB device, since most testing is currently done with mmc.

Initially this image will be used to test the EFI bootmeth.

Fix a stale comment in prep_mmc_bootdev() while we are here.

For now this uses sudo and a compressed fallback file, like all the other bootstd tests. Once this series is in, the patch which moves this to use user-space tools will be cleaned up and re-submitted.

---
Here is the patch to avoid sudo and CI fallback:

[1] https://patchwork.ozlabs.org/project/uboot/patch/
[email protected]/

Quoted 6 lines

(no changes since v1)

 arch/sandbox/dts/test.dts           |   2 +-
 test/boot/bootdev.c                 |  18 +++++++++-
 test/boot/bootflow.c                |   2 +-
 test/py/tests/bootstd/flash1.img.xz | Bin 0 -> 5016 bytes

This I think best illustrates the problem with "BOOTSBOX.EFI". This image will work for CI up until I can figure out how to get access to free arm64 servers to run some tests on and then it will fail.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

I don't believe so. Why do you think that?

Because it includes the BOOTSBOX.EFI x86 binary file, and executes it? Or did I miss where we update the contents to include that file as we just built it (and so why have it included?) ?

It works fine on x86 and I'm sure it will work fine on ARM as well. The file is built with the host compiler, just as U-Boot itself is.

Erm, are you saying the BOOT/EFI/BOOTSBOX.EFI file that's in test/py/tests/bootstd/flash1.img.xz doesn't need to exist and the test replaces that, as it goes?

Signature · 1 line
Tom
#14 lore raw

Re: [PATCH v7 6/7] test: efi: boot: Set up an image suitable for EFI testing

Hi Tom,

Quoted 52 lines · Tom Rini
Quoted 50 lines · Simon Glass

Hi Tom,

Quoted 46 lines · Tom Rini
Quoted 35 lines · Simon Glass

Hi Tom,

Quoted 32 lines · Tom Rini
Quoted 28 lines · Simon Glass

Create a new disk for use with tests, which contains the new 'testapp' EFI app specifically intended for testing the EFI loader.

Attach it to the USB device, since most testing is currently done with mmc.

Initially this image will be used to test the EFI bootmeth.

Fix a stale comment in prep_mmc_bootdev() while we are here.

For now this uses sudo and a compressed fallback file, like all the other bootstd tests. Once this series is in, the patch which moves this to use user-space tools will be cleaned up and re-submitted.

---
Here is the patch to avoid sudo and CI fallback:

[1] https://patchwork.ozlabs.org/project/uboot/patch/
[email protected]/

(no changes since v1)

 arch/sandbox/dts/test.dts           |   2 +-
 test/boot/bootdev.c                 |  18 +++++++++-
 test/boot/bootflow.c                |   2 +-
 test/py/tests/bootstd/flash1.img.xz | Bin 0 -> 5016 bytes
Quoted 5 lines
Quoted 3 lines

This I think best illustrates the problem with "BOOTSBOX.EFI". This image will work for CI up until I can figure out how to get access to free arm64 servers to run some tests on and then it will fail.

I don't believe so. Why do you think that?

Because it includes the BOOTSBOX.EFI x86 binary file, and executes it? Or did I miss where we update the contents to include that file as we just built it (and so why have it included?) ?

Quoted 6 lines
Quoted 2 lines

It works fine on x86 and I'm sure it will work fine on ARM as well. The file is built with the host compiler, just as U-Boot itself is.

Erm, are you saying the BOOT/EFI/BOOTSBOX.EFI file that's in test/py/tests/bootstd/flash1.img.xz doesn't need to exist and the test replaces that, as it goes?

No, I'm saying that sandbox uses that file, no matter the host architecture, and I don't need to create different versions of flash1.im.xz for each host architecture.

I discussed this with Heinrich and he seems happy enough with the -N flag for his use case. I know how to replicate his use case and am going to try it soon.

Regards,
Simon

#15 lore raw

Re: [PATCH v7 6/7] test: efi: boot: Set up an image suitable for EFI testing

Quoted 62 lines · Simon Glass

Hi Tom,

Quoted 52 lines · Tom Rini
Quoted 50 lines · Simon Glass

Hi Tom,

Quoted 46 lines · Tom Rini
Quoted 35 lines · Simon Glass

Hi Tom,

Quoted 32 lines · Tom Rini
Quoted 28 lines · Simon Glass

Create a new disk for use with tests, which contains the new 'testapp' EFI app specifically intended for testing the EFI loader.

Attach it to the USB device, since most testing is currently done with mmc.

Initially this image will be used to test the EFI bootmeth.

Fix a stale comment in prep_mmc_bootdev() while we are here.

For now this uses sudo and a compressed fallback file, like all the other bootstd tests. Once this series is in, the patch which moves this to use user-space tools will be cleaned up and re-submitted.

---
Here is the patch to avoid sudo and CI fallback:

[1] https://patchwork.ozlabs.org/project/uboot/patch/
[email protected]/

(no changes since v1)

 arch/sandbox/dts/test.dts           |   2 +-
 test/boot/bootdev.c                 |  18 +++++++++-
 test/boot/bootflow.c                |   2 +-
 test/py/tests/bootstd/flash1.img.xz | Bin 0 -> 5016 bytes
Quoted 5 lines
Quoted 3 lines

This I think best illustrates the problem with "BOOTSBOX.EFI". This image will work for CI up until I can figure out how to get access to free arm64 servers to run some tests on and then it will fail.

I don't believe so. Why do you think that?

Because it includes the BOOTSBOX.EFI x86 binary file, and executes it? Or did I miss where we update the contents to include that file as we just built it (and so why have it included?) ?

Quoted 6 lines
Quoted 2 lines

It works fine on x86 and I'm sure it will work fine on ARM as well. The file is built with the host compiler, just as U-Boot itself is.

Erm, are you saying the BOOT/EFI/BOOTSBOX.EFI file that's in test/py/tests/bootstd/flash1.img.xz doesn't need to exist and the test replaces that, as it goes?

Quoted 7 lines

No, I'm saying that sandbox uses that file, no matter the host architecture, and I don't need to create different versions of flash1.im.xz for each host architecture.

I discussed this with Heinrich and he seems happy enough with the -N flag for his use case. I know how to replicate his use case and am going to try it soon.

Yes, I'm just confused as to how the same BOOTSBOX.EFI binary file can be executed as both x86-64 and aarch64. Because:

$ xz -k -d test/py/tests/bootstd/flash1.img.xz
$ sudo losetup -fP  test/py/tests/bootstd/flash1.img
$ sudo mount -o ro /dev/loop18p1 /mnt
$ file /mnt/EFI/BOOT/BOOTSBOX.EFI
/mnt/EFI/BOOT/BOOTSBOX.EFI: PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows, 5 sections

Seems unlikely to work on an aarch64 host. Which is why I asked if the test actually replaced the contents of the file.

Signature · 1 line
Tom
#16 lore raw

Re: [PATCH v7 6/7] test: efi: boot: Set up an image suitable for EFI testing

Hi Tom,

Quoted 74 lines · Tom Rini
Quoted 62 lines · Simon Glass

Hi Tom,

Quoted 52 lines · Tom Rini
Quoted 50 lines · Simon Glass

Hi Tom,

Quoted 46 lines · Tom Rini
Quoted 35 lines · Simon Glass

Hi Tom,

Quoted 32 lines · Tom Rini
Quoted 28 lines · Simon Glass

Create a new disk for use with tests, which contains the new 'testapp' EFI app specifically intended for testing the EFI loader.

Attach it to the USB device, since most testing is currently done with mmc.

Initially this image will be used to test the EFI bootmeth.

Fix a stale comment in prep_mmc_bootdev() while we are here.

For now this uses sudo and a compressed fallback file, like all the other bootstd tests. Once this series is in, the patch which moves this to use user-space tools will be cleaned up and re-submitted.

---
Here is the patch to avoid sudo and CI fallback:

[1] https://patchwork.ozlabs.org/project/uboot/patch/
[email protected]/

(no changes since v1)

 arch/sandbox/dts/test.dts           |   2 +-
 test/boot/bootdev.c                 |  18 +++++++++-
 test/boot/bootflow.c                |   2 +-
 test/py/tests/bootstd/flash1.img.xz | Bin 0 -> 5016 bytes
Quoted 5 lines
Quoted 3 lines

This I think best illustrates the problem with "BOOTSBOX.EFI". This image will work for CI up until I can figure out how to get access to free arm64 servers to run some tests on and then it will fail.

I don't believe so. Why do you think that?

Because it includes the BOOTSBOX.EFI x86 binary file, and executes it? Or did I miss where we update the contents to include that file as we just built it (and so why have it included?) ?

Quoted 6 lines
Quoted 2 lines

It works fine on x86 and I'm sure it will work fine on ARM as well. The file is built with the host compiler, just as U-Boot itself is.

Erm, are you saying the BOOT/EFI/BOOTSBOX.EFI file that's in test/py/tests/bootstd/flash1.img.xz doesn't need to exist and the test replaces that, as it goes?

Quoted 7 lines

No, I'm saying that sandbox uses that file, no matter the host architecture, and I don't need to create different versions of flash1.im.xz for each host architecture.

I discussed this with Heinrich and he seems happy enough with the -N flag for his use case. I know how to replicate his use case and am going to try it soon.

Yes, I'm just confused as to how the same BOOTSBOX.EFI binary file can be executed as both x86-64 and aarch64. Because:

Quoted 8 lines
$ xz -k -d test/py/tests/bootstd/flash1.img.xz
$ sudo losetup -fP  test/py/tests/bootstd/flash1.img
$ sudo mount -o ro /dev/loop18p1 /mnt
$ file /mnt/EFI/BOOT/BOOTSBOX.EFI
/mnt/EFI/BOOT/BOOTSBOX.EFI: PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows, 5 sections

Seems unlikely to work on an aarch64 host. Which is why I asked if the test actually replaced the contents of the file.

Well, yes, for now the .xz is an x86_64 image, but I expect to be able to get rid of that fallback once my EFI test lands, so it should work fine on ARM.

Regards,
Simon

#17 lore raw

Re: [PATCH v7 6/7] test: efi: boot: Set up an image suitable for EFI testing

Quoted 83 lines · Simon Glass

Hi Tom,

Quoted 80 lines · Tom Rini
Quoted 62 lines · Simon Glass

Hi Tom,

Quoted 52 lines · Tom Rini
Quoted 50 lines · Simon Glass

Hi Tom,

Quoted 46 lines · Tom Rini
Quoted 35 lines · Simon Glass

Hi Tom,

Quoted 32 lines · Tom Rini
Quoted 28 lines · Simon Glass

Create a new disk for use with tests, which contains the new 'testapp' EFI app specifically intended for testing the EFI loader.

Attach it to the USB device, since most testing is currently done with mmc.

Initially this image will be used to test the EFI bootmeth.

Fix a stale comment in prep_mmc_bootdev() while we are here.

For now this uses sudo and a compressed fallback file, like all the other bootstd tests. Once this series is in, the patch which moves this to use user-space tools will be cleaned up and re-submitted.

---
Here is the patch to avoid sudo and CI fallback:

[1] https://patchwork.ozlabs.org/project/uboot/patch/
[email protected]/

(no changes since v1)

 arch/sandbox/dts/test.dts           |   2 +-
 test/boot/bootdev.c                 |  18 +++++++++-
 test/boot/bootflow.c                |   2 +-
 test/py/tests/bootstd/flash1.img.xz | Bin 0 -> 5016 bytes
Quoted 5 lines
Quoted 3 lines

This I think best illustrates the problem with "BOOTSBOX.EFI". This image will work for CI up until I can figure out how to get access to free arm64 servers to run some tests on and then it will fail.

I don't believe so. Why do you think that?

Because it includes the BOOTSBOX.EFI x86 binary file, and executes it? Or did I miss where we update the contents to include that file as we just built it (and so why have it included?) ?

Quoted 6 lines
Quoted 2 lines

It works fine on x86 and I'm sure it will work fine on ARM as well. The file is built with the host compiler, just as U-Boot itself is.

Erm, are you saying the BOOT/EFI/BOOTSBOX.EFI file that's in test/py/tests/bootstd/flash1.img.xz doesn't need to exist and the test replaces that, as it goes?

Quoted 7 lines

No, I'm saying that sandbox uses that file, no matter the host architecture, and I don't need to create different versions of flash1.im.xz for each host architecture.

I discussed this with Heinrich and he seems happy enough with the -N flag for his use case. I know how to replicate his use case and am going to try it soon.

Yes, I'm just confused as to how the same BOOTSBOX.EFI binary file can be executed as both x86-64 and aarch64. Because:

$ xz -k -d test/py/tests/bootstd/flash1.img.xz
$ sudo losetup -fP  test/py/tests/bootstd/flash1.img
$ sudo mount -o ro /dev/loop18p1 /mnt
$ file /mnt/EFI/BOOT/BOOTSBOX.EFI
/mnt/EFI/BOOT/BOOTSBOX.EFI: PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows, 5 sections
Quoted 6 lines
Quoted 2 lines

Seems unlikely to work on an aarch64 host. Which is why I asked if the test actually replaced the contents of the file.

Well, yes, for now the .xz is an x86_64 image, but I expect to be able to get rid of that fallback once my EFI test lands, so it should work fine on ARM.

So lets just re-work things to get this right from the start then please.

Signature · 1 line
Tom
#18 lore raw

Re: [PATCH v7 6/7] test: efi: boot: Set up an image suitable for EFI testing

Hi Tom,

Quoted 88 lines · On Wed, Oct 23, 2024, 20:41 Tom Rini <[email protected]> wrote:
Quoted 86 lines · Simon Glass

Hi Tom,

Quoted 82 lines · Tom Rini
Quoted 62 lines · Simon Glass

Hi Tom,

Quoted 52 lines · Tom Rini
Quoted 50 lines · Simon Glass

Hi Tom,

Quoted 46 lines · Tom Rini
Quoted 35 lines · Simon Glass

Hi Tom,

Quoted 32 lines · Tom Rini
Quoted 28 lines · Simon Glass

Create a new disk for use with tests, which contains the new 'testapp' EFI app specifically intended for testing the EFI loader.

Attach it to the USB device, since most testing is currently done with mmc.

Initially this image will be used to test the EFI bootmeth.

Fix a stale comment in prep_mmc_bootdev() while we are here.

For now this uses sudo and a compressed fallback file, like all the other bootstd tests. Once this series is in, the patch which moves this to use user-space tools will be cleaned up and re-submitted.

---
Here is the patch to avoid sudo and CI fallback:

[1] https://patchwork.ozlabs.org/project/uboot/patch/
[email protected]/

(no changes since v1)

 arch/sandbox/dts/test.dts           |   2 +-
 test/boot/bootdev.c                 |  18 +++++++++-
 test/boot/bootflow.c                |   2 +-
 test/py/tests/bootstd/flash1.img.xz | Bin 0 -> 5016 bytes
Quoted 5 lines
Quoted 3 lines

This I think best illustrates the problem with "BOOTSBOX.EFI". This image will work for CI up until I can figure out how to get access to free arm64 servers to run some tests on and then it will fail.

I don't believe so. Why do you think that?

Because it includes the BOOTSBOX.EFI x86 binary file, and executes it? Or did I miss where we update the contents to include that file as we just built it (and so why have it included?) ?

Quoted 6 lines
Quoted 2 lines

It works fine on x86 and I'm sure it will work fine on ARM as well. The file is built with the host compiler, just as U-Boot itself is.

Erm, are you saying the BOOT/EFI/BOOTSBOX.EFI file that's in test/py/tests/bootstd/flash1.img.xz doesn't need to exist and the test replaces that, as it goes?

Quoted 7 lines

No, I'm saying that sandbox uses that file, no matter the host architecture, and I don't need to create different versions of flash1.im.xz for each host architecture.

I discussed this with Heinrich and he seems happy enough with the -N flag for his use case. I know how to replicate his use case and am going to try it soon.

Yes, I'm just confused as to how the same BOOTSBOX.EFI binary file can be executed as both x86-64 and aarch64. Because:

$ xz -k -d test/py/tests/bootstd/flash1.img.xz
$ sudo losetup -fP  test/py/tests/bootstd/flash1.img
$ sudo mount -o ro /dev/loop18p1 /mnt
$ file /mnt/EFI/BOOT/BOOTSBOX.EFI
/mnt/EFI/BOOT/BOOTSBOX.EFI: PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows, 5 sections

Seems unlikely to work on an aarch64 host. Which is why I asked if the test actually replaced the contents of the file.

Quoted 6 lines
Quoted 3 lines

Well, yes, for now the .xz is an x86_64 image, but I expect to be able to get rid of that fallback once my EFI test lands, so it should work fine on ARM.

So lets just re-work things to get this right from the start then please.

My understanding was that I offered to tidy up and send [1] after this series lands?

Regards,
Simon

#19 lore raw

Re: [PATCH v7 6/7] test: efi: boot: Set up an image suitable for EFI testing

Quoted 95 lines · Simon Glass

Hi Tom,

Quoted 92 lines · On Wed, Oct 23, 2024, 20:41 Tom Rini <[email protected]> wrote:
Quoted 89 lines · Simon Glass

Hi Tom,

Quoted 74 lines · Tom Rini
Quoted 62 lines · Simon Glass

Hi Tom,

Quoted 52 lines · Tom Rini
Quoted 50 lines · Simon Glass

Hi Tom,

Quoted 46 lines · Tom Rini
Quoted 35 lines · Simon Glass

Hi Tom,

Quoted 32 lines · Tom Rini
Quoted 28 lines · Simon Glass

Create a new disk for use with tests, which contains the new 'testapp' EFI app specifically intended for testing the EFI loader.

Attach it to the USB device, since most testing is currently done with mmc.

Initially this image will be used to test the EFI bootmeth.

Fix a stale comment in prep_mmc_bootdev() while we are here.

For now this uses sudo and a compressed fallback file, like all the other bootstd tests. Once this series is in, the patch which moves this to use user-space tools will be cleaned up and re-submitted.

---
Here is the patch to avoid sudo and CI fallback:

[1] https://patchwork.ozlabs.org/project/uboot/patch/
[email protected]/

(no changes since v1)

 arch/sandbox/dts/test.dts           |   2 +-
 test/boot/bootdev.c                 |  18 +++++++++-
 test/boot/bootflow.c                |   2 +-
 test/py/tests/bootstd/flash1.img.xz | Bin 0 -> 5016 bytes
Quoted 5 lines
Quoted 3 lines

This I think best illustrates the problem with "BOOTSBOX.EFI". This image will work for CI up until I can figure out how to get access to free arm64 servers to run some tests on and then it will fail.

I don't believe so. Why do you think that?

Because it includes the BOOTSBOX.EFI x86 binary file, and executes it? Or did I miss where we update the contents to include that file as we just built it (and so why have it included?) ?

Quoted 6 lines
Quoted 2 lines

It works fine on x86 and I'm sure it will work fine on ARM as well. The file is built with the host compiler, just as U-Boot itself is.

Erm, are you saying the BOOT/EFI/BOOTSBOX.EFI file that's in test/py/tests/bootstd/flash1.img.xz doesn't need to exist and the test replaces that, as it goes?

Quoted 7 lines

No, I'm saying that sandbox uses that file, no matter the host architecture, and I don't need to create different versions of flash1.im.xz for each host architecture.

I discussed this with Heinrich and he seems happy enough with the -N flag for his use case. I know how to replicate his use case and am going to try it soon.

Yes, I'm just confused as to how the same BOOTSBOX.EFI binary file can be executed as both x86-64 and aarch64. Because:

Quoted 8 lines
$ xz -k -d test/py/tests/bootstd/flash1.img.xz
$ sudo losetup -fP  test/py/tests/bootstd/flash1.img
$ sudo mount -o ro /dev/loop18p1 /mnt
$ file /mnt/EFI/BOOT/BOOTSBOX.EFI
/mnt/EFI/BOOT/BOOTSBOX.EFI: PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows, 5 sections

Seems unlikely to work on an aarch64 host. Which is why I asked if the test actually replaced the contents of the file.

Well, yes, for now the .xz is an x86_64 image, but I expect to be able to get rid of that fallback once my EFI test lands, so it should work fine on ARM.

Quoted 5 lines
Quoted 2 lines

So lets just re-work things to get this right from the start then please.

My understanding was that I offered to tidy up and send [1] after this series lands?

Oh, so replacing the file is blocked on not having sudo in use on these tests. That wasn't clear, sorry.

Signature · 1 line
Tom
#20 lore raw

Re: [PATCH v7 6/7] test: efi: boot: Set up an image suitable for EFI testing

Hi Tom,

Quoted 97 lines · Tom Rini
Quoted 95 lines · Simon Glass

Hi Tom,

Quoted 92 lines · On Wed, Oct 23, 2024, 20:41 Tom Rini <[email protected]> wrote:
Quoted 89 lines · Simon Glass

Hi Tom,

Quoted 74 lines · Tom Rini
Quoted 62 lines · Simon Glass

Hi Tom,

Quoted 52 lines · Tom Rini
Quoted 50 lines · Simon Glass

Hi Tom,

Quoted 46 lines · Tom Rini
Quoted 35 lines · Simon Glass

Hi Tom,

Quoted 32 lines · Tom Rini
Quoted 28 lines · Simon Glass

Create a new disk for use with tests, which contains the new 'testapp' EFI app specifically intended for testing the EFI loader.

Attach it to the USB device, since most testing is currently done with mmc.

Initially this image will be used to test the EFI bootmeth.

Fix a stale comment in prep_mmc_bootdev() while we are here.

For now this uses sudo and a compressed fallback file, like all the other bootstd tests. Once this series is in, the patch which moves this to use user-space tools will be cleaned up and re-submitted.

---
Here is the patch to avoid sudo and CI fallback:

[1] https://patchwork.ozlabs.org/project/uboot/patch/
[email protected]/

(no changes since v1)

 arch/sandbox/dts/test.dts           |   2 +-
 test/boot/bootdev.c                 |  18 +++++++++-
 test/boot/bootflow.c                |   2 +-
 test/py/tests/bootstd/flash1.img.xz | Bin 0 -> 5016 bytes
Quoted 5 lines
Quoted 3 lines

This I think best illustrates the problem with "BOOTSBOX.EFI". This image will work for CI up until I can figure out how to get access to free arm64 servers to run some tests on and then it will fail.

I don't believe so. Why do you think that?

Because it includes the BOOTSBOX.EFI x86 binary file, and executes it? Or did I miss where we update the contents to include that file as we just built it (and so why have it included?) ?

Quoted 6 lines
Quoted 2 lines

It works fine on x86 and I'm sure it will work fine on ARM as well. The file is built with the host compiler, just as U-Boot itself is.

Erm, are you saying the BOOT/EFI/BOOTSBOX.EFI file that's in test/py/tests/bootstd/flash1.img.xz doesn't need to exist and the test replaces that, as it goes?

Quoted 7 lines

No, I'm saying that sandbox uses that file, no matter the host architecture, and I don't need to create different versions of flash1.im.xz for each host architecture.

I discussed this with Heinrich and he seems happy enough with the -N flag for his use case. I know how to replicate his use case and am going to try it soon.

Yes, I'm just confused as to how the same BOOTSBOX.EFI binary file can be executed as both x86-64 and aarch64. Because:

Quoted 8 lines
$ xz -k -d test/py/tests/bootstd/flash1.img.xz
$ sudo losetup -fP  test/py/tests/bootstd/flash1.img
$ sudo mount -o ro /dev/loop18p1 /mnt
$ file /mnt/EFI/BOOT/BOOTSBOX.EFI
/mnt/EFI/BOOT/BOOTSBOX.EFI: PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows, 5 sections

Seems unlikely to work on an aarch64 host. Which is why I asked if the test actually replaced the contents of the file.

Well, yes, for now the .xz is an x86_64 image, but I expect to be able to get rid of that fallback once my EFI test lands, so it should work fine on ARM.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

So lets just re-work things to get this right from the start then please.

My understanding was that I offered to tidy up and send [1] after this series lands?

Oh, so replacing the file is blocked on not having sudo in use on these tests. That wasn't clear, sorry.

OK, good, thanks. It's just CI that has this problem, since sudo doesn't work.

Regards,
Simon

#21 lore raw

Re: [PATCH v7 6/7] test: efi: boot: Set up an image suitable for EFI testing

Quoted 103 lines · Simon Glass

Hi Tom,

Quoted 100 lines · Tom Rini
Quoted 98 lines · Simon Glass

Hi Tom,

Quoted 94 lines · On Wed, Oct 23, 2024, 20:41 Tom Rini <[email protected]> wrote:
Quoted 83 lines · Simon Glass

Hi Tom,

Quoted 80 lines · Tom Rini
Quoted 62 lines · Simon Glass

Hi Tom,

Quoted 52 lines · Tom Rini
Quoted 50 lines · Simon Glass

Hi Tom,

Quoted 46 lines · Tom Rini
Quoted 35 lines · Simon Glass

Hi Tom,

Quoted 32 lines · Tom Rini
Quoted 28 lines · Simon Glass

Create a new disk for use with tests, which contains the new 'testapp'
EFI app specifically intended for testing the EFI loader.

Attach it to the USB device, since most testing is currently done with
mmc.

Initially this image will be used to test the EFI bootmeth.

Fix a stale comment in prep_mmc_bootdev() while we are here.

For now this uses sudo and a compressed fallback file, like all the
other bootstd tests. Once this series is in, the patch which moves
this to use user-space tools will be cleaned up and re-submitted.

Signed-off-by: Simon Glass <[email protected]>

---
Here is the patch to avoid sudo and CI fallback:

[1] https://patchwork.ozlabs.org/project/uboot/patch/
[email protected]/

(no changes since v1)

arch/sandbox/dts/test.dts | 2 +-
test/boot/bootdev.c | 18 +++++++++-
test/boot/bootflow.c | 2 +-
test/py/tests/bootstd/flash1.img.xz | Bin 0 -> 5016 bytes

Quoted 5 lines
Quoted 3 lines

This I think best illustrates the problem with "BOOTSBOX.EFI". This image will work for CI up until I can figure out how to get access to free arm64 servers to run some tests on and then it will fail.

I don't believe so. Why do you think that?

Because it includes the BOOTSBOX.EFI x86 binary file, and executes it? Or did I miss where we update the contents to include that file as we just built it (and so why have it included?) ?

Quoted 6 lines
Quoted 2 lines

It works fine on x86 and I'm sure it will work fine on ARM as well. The file is built with the host compiler, just as U-Boot itself is.

Erm, are you saying the BOOT/EFI/BOOTSBOX.EFI file that's in test/py/tests/bootstd/flash1.img.xz doesn't need to exist and the test replaces that, as it goes?

Quoted 7 lines

No, I'm saying that sandbox uses that file, no matter the host architecture, and I don't need to create different versions of flash1.im.xz for each host architecture.

I discussed this with Heinrich and he seems happy enough with the -N flag for his use case. I know how to replicate his use case and am going to try it soon.

Yes, I'm just confused as to how the same BOOTSBOX.EFI binary file can be executed as both x86-64 and aarch64. Because:

$ xz -k -d test/py/tests/bootstd/flash1.img.xz
$ sudo losetup -fP  test/py/tests/bootstd/flash1.img
$ sudo mount -o ro /dev/loop18p1 /mnt
$ file /mnt/EFI/BOOT/BOOTSBOX.EFI
/mnt/EFI/BOOT/BOOTSBOX.EFI: PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows, 5 sections
Quoted 6 lines
Quoted 2 lines

Seems unlikely to work on an aarch64 host. Which is why I asked if the test actually replaced the contents of the file.

Well, yes, for now the .xz is an x86_64 image, but I expect to be able to get rid of that fallback once my EFI test lands, so it should work fine on ARM.

So lets just re-work things to get this right from the start then please.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

My understanding was that I offered to tidy up and send [1] after this series lands?

Oh, so replacing the file is blocked on not having sudo in use on these tests. That wasn't clear, sorry.

OK, good, thanks. It's just CI that has this problem, since sudo doesn't work.

To be clear, the push for no-sudo is because of developers who (understandably!) don't want sudo running random things on their machine in order to run U-Boot tests. That it makes CI more consistent is good, too.

Signature · 1 line
Tom
#22 lore raw

PATCH v7 7/7 test: efi: boot: Add a test for the efi bootmeth

In reply to Simon Glass

Add a simple test of booting with the EFI bootmeth, which runs the app and checks that it can call 'exit boot-services' (to check that all the device-removal code doesn't break anything) and then exit back to U-Boot.

This uses a disk image containing the testapp, ready for execution by sandbox when needed.

The unwanted ANSI output is still a problem when running this test.

---
Note that this uses the same mechanism as for the other images which are created. Once this series lands I will update[1] and revisit.

[1] https://patchwork.ozlabs.org/project/uboot/patch/

    [email protected]/

Changes in v7:
- Drop patches already applied
- Drop patch 'Disable ANSI output for tests'
- Rebase on -master

Changes in v6:
- Deal with sandbox CONFIG_LOGF_FUNC
- Rebase on -next
- Drop patches previously applied
- Drop mention of helloworld since it is no-longer used by this test

Changes in v4:
- Add efi_loader tag to some patches
- Split out non-EFI patches into a different series

Changes in v2:
- Add many new patches to resolve all the outstanding test issues

 test/boot/bootflow.c | 60 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)
test/boot/bootflow.c +60 -0
index 0a819998ebd..b7f4b6371ee 100644
@@ -13,6 +13,7 @@
 #include <cli.h>
 #include <dm.h>
 #include <efi_default_filename.h>
+#include <efi_loader.h>
 #include <expo.h>
 #ifdef CONFIG_SANDBOX
 #include <asm/test.h>
@@ -31,6 +32,9 @@ extern U_BOOT_DRIVER(bootmeth_android);
 extern U_BOOT_DRIVER(bootmeth_cros);
 extern U_BOOT_DRIVER(bootmeth_2script);
 
+/* Use this as the vendor for EFI to tell the app to exit boot services */
+static u16 __efi_runtime_data test_vendor[] = u"U-Boot testing";
+
 static int inject_response(struct unit_test_state *uts)
 {
 	/*
@@ -1213,3 +1217,59 @@ static int bootflow_android(struct unit_test_state *uts)
 	return 0;
 }
 BOOTSTD_TEST(bootflow_android, UTF_CONSOLE);
+
+/* Test EFI bootmeth */
+static int bootflow_efi(struct unit_test_state *uts)
+{
+	/* disable ethernet since the hunter will run dhcp */
+	test_set_eth_enable(false);
+
+	/* make USB scan without delays */
+	test_set_skip_delays(true);
+
+	bootstd_reset_usb();
+
+	ut_assertok(bootstd_test_drop_bootdev_order(uts));
+	ut_assertok(run_command("bootflow scan", 0));
+	ut_assert_skip_to_line(
+		"Bus usb@1: scanning bus usb@1 for devices... 5 USB Device(s) found");
+
+	ut_assertok(run_command("bootflow list", 0));
+
+	ut_assert_nextlinen("Showing all");
+	ut_assert_nextlinen("Seq");
+	ut_assert_nextlinen("---");
+	ut_assert_nextlinen("  0  extlinux");
+	ut_assert_nextlinen(
+		"  1  efi          ready   usb_mass_    1  usb_mass_storage.lun0.boo /EFI/BOOT/BOOTSBOX.EFI");
+	ut_assert_nextlinen("---");
+	ut_assert_skip_to_line("(2 bootflows, 2 valid)");
+	ut_assert_console_end();
+
+	ut_assertok(run_command("bootflow select 1", 0));
+	ut_assert_console_end();
+
+	systab.fw_vendor = test_vendor;
+
+	ut_asserteq(1, run_command("bootflow boot", 0));
+	ut_assert_nextline(
+		"** Booting bootflow 'usb_mass_storage.lun0.bootdev.part_1' with efi");
+	if (IS_ENABLED(CONFIG_LOGF_FUNC))
+		ut_assert_skip_to_line("       efi_run_image() Booting /\\EFI\\BOOT\\BOOTSBOX.EFI");
+	else
+		ut_assert_skip_to_line("Booting /\\EFI\\BOOT\\BOOTSBOX.EFI");
+
+	/* TODO: Why the \r ? */
+	ut_assert_nextline("U-Boot test app for EFI_LOADER\r");
+	ut_assert_nextline("Exiting boot sevices");
+	if (IS_ENABLED(CONFIG_LOGF_FUNC))
+		ut_assert_nextline("     do_bootefi_exec() ## Application failed, r = 5");
+	else
+		ut_assert_nextline("## Application failed, r = 5");
+	ut_assert_nextline("Boot failed (err=-22)");
+
+	ut_assert_console_end();
+
+	return 0;
+}
+BOOTSTD_TEST(bootflow_efi, UTF_CONSOLE);
Signature · 1 line
2.34.1