diff mbox series

[v2,2/2] oe-selftest: uboot: add test for building U-Boot initial env binary

Message ID 20251117161239.1227164-2-pierre-loup.gosse@smile.fr
State New
Headers show
Series [v2,1/2] u-boot: make initial environment binary image | expand

Commit Message

Pierre-loup GOSSE Nov. 17, 2025, 4:12 p.m. UTC
From: Pierre-Loup GOSSE <pierre-loup.gosse@smile.fr>

This adds two new selftest cases `test_uboot_initial_env_binary` and
`test_uboot_config_initial_env_binary` to verify the build of the U-Boot
initial env binary with the mkimage tool.

Signed-off-by: Pierre-Loup GOSSE <pierre-loup.gosse@smile.fr>
Cc: Ross Burton <ross.burton@arm.com>
---
changes in v2:
- add tests
---
 meta/lib/oeqa/selftest/cases/uboot.py | 52 +++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

Comments

Mathieu Dubois-Briand Nov. 19, 2025, 5:41 p.m. UTC | #1
On Mon Nov 17, 2025 at 5:12 PM CET, Pierre-loup GOSSE via lists.openembedded.org wrote:
> From: Pierre-Loup GOSSE <pierre-loup.gosse@smile.fr>
>
> This adds two new selftest cases `test_uboot_initial_env_binary` and
> `test_uboot_config_initial_env_binary` to verify the build of the U-Boot
> initial env binary with the mkimage tool.
>
> Signed-off-by: Pierre-Loup GOSSE <pierre-loup.gosse@smile.fr>
> Cc: Ross Burton <ross.burton@arm.com>
> ---

Hi Pierre-Loup,

Thanks for your patch.

It looks like this is failing when building on ARM machines:

2025-11-19 10:13:26,832 - oe-selftest - INFO - uboot.UBootTest.test_uboot_config_initial_env_binary (subunit.RemotedTestCase)
2025-11-19 10:13:26,836 - oe-selftest - INFO -  ... FAIL
...
ERROR: u-boot-1_2025.10-r0 do_compile: oe_runmake failed
ERROR: u-boot-1_2025.10-r0 do_compile: Execution of '/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-3996856/tmp/work/qemuarm64-poky-linux/u-boot/2025.10/temp/run.do_compile.1762173' failed with exit code 1
...
|   aarch64-poky-linux-gcc  --sysroot=/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-3996856/tmp/work/qemuarm64-poky-linux/u-boot/2025.10/recipe-sysroot  -ffile-prefix-map=/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-3996856/tmp/work/qemuarm64-poky-linux/u-boot/2025.10/sources/u-boot-2025.10=/usr/src/debug/u-boot/2025.10  -ffile-prefix-map=/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-3996856/tmp/work/qemuarm64-poky-linux/u-boot/2025.10/build=/usr/src/debug/u-boot/2025.10  -ffile-prefix-map=/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-3996856/tmp/work/qemuarm64-poky-linux/u-boot/2025.10/recipe-sysroot=  -ffile-prefix-map=/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-3996856/tmp/work/qemuarm64-poky-linux/u-boot/2025.10/recipe-sysroot-native=  -E -Wall -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu11  -ffreestanding -fno-builtin -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-int-in-bool-context -Wno-address-of-packed-member -O2 -fno-stack-protector -fno-delete-null-pointer-checks -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-maybe-uninitialized -fmacro-prefix-map=/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-3996856/tmp/work/qemuarm64-poky-linux/u-boot/2025.10/sources/u-boot-2025.10/= -gdwarf-4 -fstack-usage -Wno-format-nonliteral -Wno-address-of-packed-member -Wno-unused-but-set-variable -Wno-unused-but-set-variable -Werror=date-time -Wno-packed-not-aligned -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -D__KERNEL__ -D__UBOOT__ -fomit-frame-pointer  -fno-toplevel-reorder -fno-dwarf2-cfi-asm -fpic -fno-common -march=core2 -m64 -D__x86_64__ -fdata-sections -ffunction-sections -fvisibility=hidden -pipe -Iinclude  -I/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-3996856/tmp/work/qemuarm64-poky-linux/u-boot/2025.10/sources/u-boot-2025.10/include -I/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-3996856/tmp/work/qemuarm64-poky-linux/u-boot/2025.10/sources/u-boot-2025.10/arch/x86/include -include /srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-3996856/tmp/work/qemuarm64-poky-linux/u-boot/2025.10/sources/u-boot-2025.10/include/linux/kconfig.h -nostdinc -isystem /srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-3996856/tmp/work/qemuarm64-poky-linux/u-boot/2025.10/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../lib/aarch64-poky-linux/gcc/aarch64-poky-linux/15.2.0/include -DCONFIG_XPL_BUILD -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM include/config.h > spl/u-boot.cfg.tmp && { grep 'define CONFIG_' spl/u-boot.cfg.tmp | sed '/define CONFIG_IS_ENABLED(/d;/define CONFIG_IF_ENABLED_INT(/d;/define CONFIG_VAL(/d;' > spl/u-boot.cfg; rm spl/u-boot.cfg.tmp; } || { rm spl/u-boot.cfg.tmp; false; }
| aarch64-poky-linux-gcc: error: unrecognized command-line option '-m64'

https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/2854

Can you have a look at the issue?

Thanks,
Mathieu
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/uboot.py b/meta/lib/oeqa/selftest/cases/uboot.py
index 980ea327f0..e2478d3dfd 100644
--- a/meta/lib/oeqa/selftest/cases/uboot.py
+++ b/meta/lib/oeqa/selftest/cases/uboot.py
@@ -5,6 +5,9 @@ 
 # SPDX-License-Identifier: MIT
 #
 
+import os
+import textwrap
+
 from oeqa.selftest.case import OESelftestTestCase
 from oeqa.utils.commands import bitbake, runqemu, get_bb_var, get_bb_vars, runCmd
 from oeqa.core.decorator.data import skipIfNotArch, skipIfNotBuildArch
@@ -96,3 +99,52 @@  QB_DRIVE_TYPE = "/dev/vd"
             self.assertTrue("Machine model: linux,dummy-virt" in output, msg=output)
             # with KVM enabled
             self.assertTrue("KVM: hypervisor services detected" in output, msg=output)
+
+    def test_uboot_initial_env_binary(self):
+        """
+        Tests building the initial U-Boot environment in binary format with
+        the U-Boot mkimage tool.
+        We assume that the uboot-mkenvimage tool generates a correct binary.
+        """
+
+        self.write_config(textwrap.dedent("""
+            UBOOT_INITIAL_ENV_BINARY = "1"
+            UBOOT_INITIAL_ENV_BINARY_SIZE = "0x4000"
+            UBOOT_INITIAL_ENV_BINARY_REDUND = "1"
+        """))
+
+        bitbake("u-boot")
+
+        bb_vars = get_bb_vars(["DEPLOYDIR", "UBOOT_INITIAL_ENV"], "u-boot")
+
+        uboot_initial_env_binary_path = os.path.realpath(os.path.join(
+            bb_vars["DEPLOYDIR"], "%s.bin" % bb_vars["UBOOT_INITIAL_ENV"]
+        ))
+
+        self.assertExists(uboot_initial_env_binary_path)
+
+    def test_uboot_config_initial_env_binary(self):
+        """
+        Tests building the initial U-Boot environment in binary format with
+        the U-Boot mkimage tool for a U-Boot config.
+        We assume that the uboot-mkenvimage tool generates a correct binary.
+        """
+
+        self.write_config(textwrap.dedent("""
+            UBOOT_MACHINE = ""
+            UBOOT_CONFIG = "test"
+            UBOOT_CONFIG[test] = "qemu-x86_64_defconfig"
+            UBOOT_INITIAL_ENV_BINARY = "1"
+            UBOOT_INITIAL_ENV_BINARY_SIZE = "0x4000"
+            UBOOT_INITIAL_ENV_BINARY_REDUND = "1"
+        """))
+
+        bitbake("u-boot")
+
+        bb_vars = get_bb_vars(["DEPLOYDIR", "UBOOT_INITIAL_ENV"], "u-boot")
+
+        uboot_initial_env_binary_path = os.path.realpath(os.path.join(
+            bb_vars["DEPLOYDIR"], "%s-test.bin" % bb_vars["UBOOT_INITIAL_ENV"]
+        ))
+
+        self.assertExists(uboot_initial_env_binary_path)