Enable Firmware Handoff CI test on qemu_arm64
v2 cover Enable Firmware Handoff CI test on qemu_arm64
This patch series enable Firmware Handoff [1] CI tests on qemu_arm64 by:
1. fetch MbedTLS (v3.6), OP-TEE (v4.7.0) and TF-A (v2.13.0);
2. build bl1 and fip with both Firmware Handoff and Measured Boot enabled;
3. pytest to validate the Firmware Handoff feature via bloblist by checking the existence of expected FDT nodes and TPM events generated and handed over from TF-A/OP-TEE.
Pre-requisite u-boot-test-hooks patches [2] are required.
[1] https://github.com/FirmwareHandoff/firmware_handoff
[2] https://lore.kernel.org/u-boot/[email protected]/T/#t
Raymond Mao (5):
docker: add OP-TEE and TF-A build for testing Firmware Handoff
pytest: add test script to validate Firmware Handoff
configs: select CMD_BLOBLIST for Firmware Handoff testing
ci: check existence of bl1 and fip in the test script
ci: add test entries for qemu_arm64_tfa_fw_handoff
.azure-pipelines.yml | 18 +++++- .gitlab-ci.yml | 21 +++++- configs/qemu_arm64_defconfig | 1 + test/py/tests/test_fw_handoff.py | 108 +++++++++++++++++++++++++++++++ tools/docker/Dockerfile | 74 ++++++++++++++++++++- 5 files changed, 215 insertions(+), 7 deletions(-) create mode 100644 test/py/tests/test_fw_handoff.py
Signature · 1 line
2.25.1
PATCH v2 1/5 docker: add OP-TEE and TF-A build for testing Firmware Handoff
Fetch OP-TEE (4.7.0), TF-A (v2.13.0), MbedTLS (v3.6) and build bl1 and fip with both Firmware Handoff and Measured Boot enabled.
---
Changes in V2:
- Move OP-TEE dependencies into the common group.
- Fetch MbedTLS/TF-A and build bl1/fip in dockerfile instead of post-buildman script.
- Remove Trust Boot related build options.
tools/docker/Dockerfile | 74 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 3 deletions(-)
tools/docker/Dockerfile +71 -3
@@ -58,6 +58,9 @@ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \ apt-get update && apt-get install -y \ + adb \ + acpica-tools \ + autoconf \ automake \ autopoint \ bc \
@@ -65,21 +68,26 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ bison \ build-essential \ byacc \ + ccache \ cgpt \ clang-18 \ coreutils \ cpio \ + cscope \ curl \ device-tree-compiler \ dosfstools \ e2fsprogs \ + e2tools \ efitools \ erofs-utils \ exfatprogs \ expect \ fakeroot \ + fastboot \ fdisk \ flex \ + ftp-upload \ gawk \ gdisk \ gettext \
@@ -92,11 +100,20 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ imagemagick \ inetutils-telnet \ iputils-ping \ + libattr1-dev \ + libcap-ng-dev \ libconfuse-dev \ + libfdt-dev \ + libftdi-dev \ libgit2-dev \ libjson-glib-dev \ + libglib2.0-dev \ + libgmp3-dev \ libgnutls28-dev \ libgnutls30 \ + libhidapi-dev \ + libmpc-dev \ + libncurses5-dev \ libpixman-1-dev \ libpython3-dev \ libsdl1.2-dev \
@@ -110,9 +127,11 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ lz4 \ lzma-alone \ lzop \ + make \ mount \ mtd-utils \ mtools \ + netcat \ net-tools \ ninja-build \ openssl \
@@ -122,12 +141,16 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ python-is-python3 \ python2.7 \ python3 \ + python3-cryptography \ python3-dev \ python3-pip \ + python3-pyelftools \ + python3-serial \ python3-sphinx \ python3-tomli \ python3-venv \ rpm2cpio \ + rsync \ sbsigntool \ socat \ softhsm2 \
@@ -136,13 +159,20 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ sudo \ swig \ texinfo \ + unzip \ util-linux \ uuid-dev \ vboot-kernel-utils \ vboot-utils \ + wget \ + xdg-utils \ xilinx-bootgen \ + xsltproc \ + xterm \ xxd \ - zip + xz-utils \ + zip \ + zlib1g-dev # Build GRUB UEFI targets for ARM & RISC-V, 32-bit and 64-bit RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \
@@ -227,10 +257,30 @@ RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ make -j$(nproc) all install && \ rm -rf /tmp/qemu -# Build fiptool +# Build OP-TEE for qemu_arm64 +RUN git clone https://github.com/OP-TEE/optee_os.git /tmp/optee_os && \ + cd /tmp/optee_os/ && \ + git checkout 4.7.0 && \ + make CROSS_COMPILE=/opt/gcc-${TCVER}-nolibc/aarch64-linux/bin/aarch64-linux- \ + CROSS_COMPILE_core=/opt/gcc-${TCVER}-nolibc/aarch64-linux/bin/aarch64-linux- \ + CROSS_COMPILE32=/opt/gcc-${TCVER}-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi- \ + CROSS_COMPILE_ta_arm32=/opt/gcc-${TCVER}-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi- \ + CROSS_COMPILE_ta_arm64=/opt/gcc-${TCVER}-nolibc/aarch64-linux/bin/aarch64-linux- \ + ARCH=arm \ + CFG_ARM64_core=y \ + CFG_TRANSFER_LIST=y CFG_MAP_EXT_DT_SECURE=y \ + PLATFORM=vexpress-qemu_armv8a CFG_RPMB_FS=y \ + CFG_RPMB_FS_DEV_ID=0 CFG_CORE_HEAP_SIZE=524288 CFG_RPMB_WRITE_KEY=y \ + CFG_CORE_HEAP_SIZE=524288 CFG_CORE_DYN_SHM=y CFG_RPMB_TESTKEY=y \ + CFG_RPMB_WRITE_KEY=1 \ + CFG_REE_FS=n CFG_CORE_ARM64_PA_BITS=48 \ + CFG_TEE_CORE_LOG_LEVEL=4 CFG_TEE_TA_LOG_LEVEL=1 DEBUG=y + +# Build fiptool, bl1 and fip for fvp and qemu_arm64 +RUN git clone --branch mbedtls-3.6 https://github.com/ARMmbed/mbedtls.git /tmp/mbedtls RUN git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git /tmp/tf-a && \ cd /tmp/tf-a/ && \ - git checkout v2.12.0 && \ + git checkout v2.13.0 && \ make CROSS_COMPILE=/opt/gcc-${TCVER}-nolibc/aarch64-linux/bin/aarch64-linux- \ PLAT=fvp BL33=/dev/null -j$(nproc) all fip && \ mkdir -p /usr/local/bin /opt/tf-a/vexpress_fvp && \
@@ -243,6 +293,24 @@ RUN git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git /tmp/t mkdir -p /opt/tf-a/vexpress_fvp_bloblist && \ cp build/fvp/release/fip.bin build/fvp/release/bl1.bin \ /opt/tf-a/vexpress_fvp_bloblist/ && \ + make CROSS_COMPILE=/opt/gcc-${TCVER}-nolibc/aarch64-linux/bin/aarch64-linux- \ + PLAT=qemu \ + BL33=/dev/null \ + BL32=/tmp/optee_os/out/arm-plat-vexpress/core/tee-header_v2.bin \ + BL32_EXTRA1=/tmp/optee_os/out/arm-plat-vexpress/core/tee-pager_v2.bin \ + BL32_EXTRA2=/tmp/optee_os/out/arm-plat-vexpress/core/tee-pageable_v2.bin \ + BL32_RAM_LOCATION=tdram SPD=opteed \ + TRANSFER_LIST=1 E=0 \ + MEASURED_BOOT=1 \ + EVENT_LOG_LEVEL=10 \ + MBOOT_EL_HASH_ALG=sha256 \ + MBEDTLS_DIR=/tmp/mbedtls \ + -j$(nproc) all fip && \ + mkdir -p /opt/tf-a/qemu_arm64_fw_handoff_tfa_optee && \ + cp build/qemu/release/fip.bin build/qemu/release/bl1.bin \ + /opt/tf-a/qemu_arm64_fw_handoff_tfa_optee/ && \ + rm -rf /tmp/optee_os && \ + rm -rf /tmp/mbedtls && \ rm -rf /tmp/tf-a # Download the Arm Architecture FVP platform. This file is double compressed.
Signature · 1 line
2.25.1
Re: [PATCH v2 1/5] docker: add OP-TEE and TF-A build for testing Firmware Handoff
Quoted 114 lines · Raymond Mao
Fetch OP-TEE (4.7.0), TF-A (v2.13.0), MbedTLS (v3.6) and build bl1 and fip with both Firmware Handoff and Measured Boot enabled.
Signed-off-by Raymond Mao <[email protected]>---
Changes in V2:
- Move OP-TEE dependencies into the common group.
- Fetch MbedTLS/TF-A and build bl1/fip in dockerfile instead of post-buildman script.
- Remove Trust Boot related build options.tools/docker/Dockerfile | 74 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 3 deletions(-)tools/docker/Dockerfile +24
-0@@ -58,6 +58,9 @@ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \ apt-get update && apt-get install -y \ + adb \ + acpica-tools \ + autoconf \ automake \ autopoint \ bc \@@ -65,21 +68,26 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ bison \ build-essential \ byacc \ + ccache \ cgpt \ clang-18 \ coreutils \ cpio \ + cscope \ curl \ device-tree-compiler \ dosfstools \ e2fsprogs \ + e2tools \ efitools \ erofs-utils \ exfatprogs \ expect \ fakeroot \ + fastboot \ fdisk \ flex \ + ftp-upload \ gawk \ gdisk \ gettext \@@ -92,11 +100,20 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ imagemagick \ inetutils-telnet \ iputils-ping \ + libattr1-dev \ + libcap-ng-dev \ libconfuse-dev \ + libfdt-dev \ + libftdi-dev \ libgit2-dev \ libjson-glib-dev \ + libglib2.0-dev \ + libgmp3-dev \ libgnutls28-dev \ libgnutls30 \ + libhidapi-dev \ + libmpc-dev \ + libncurses5-dev \ libpixman-1-dev \ libpython3-dev \ libsdl1.2-dev \@@ -110,9 +127,11 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ lz4 \ lzma-alone \ lzop \ + make \ mount \ mtd-utils \ mtools \ + netcat \ net-tools \ ninja-build \ openssl \@@ -122,12 +141,16 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ python-is-python3 \ python2.7 \ python3 \ + python3-cryptography \ python3-dev \ python3-pip \ + python3-pyelftools \ + python3-serial \ python3-sphinx \ python3-tomli \ python3-venv \ rpm2cpio \ + rsync \ sbsigntool \ socat \ softhsm2 \@@ -136,13 +159,20 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ sudo \ swig \ texinfo \ + unzip \ util-linux \ uuid-dev \ vboot-kernel-utils \ vboot-utils \
tools/docker/Dockerfile RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ · line 175
Quoted 10 lines
tools/docker/Dockerfile +7
-1+ wget \ + xdg-utils \ xilinx-bootgen \ + xsltproc \ + xterm \ xxd \ - zip + xz-utils \ + zip \ + zlib1g-dev
Are some of these deps perhaps optional? I would hope we could build without cscope and xterm, to pick randomly from the top and bottom of the list. I ask since everything we add here makes the container larger, and it's already very big. I'm almost wondering if we should (follow-up, later) add a step where we remove things that tools we built needed, but U-Boot doesn't need for build/tests.
Signature · 1 line
Tom
Re: [PATCH v2 1/5] docker: add OP-TEE and TF-A build for testing Firmware Handoff
Hi Tom,
Quoted 126 lines · Tom Rini
Quoted 123 lines · Raymond Mao
Fetch OP-TEE (4.7.0), TF-A (v2.13.0), MbedTLS (v3.6) and build bl1 and fip with both Firmware Handoff and Measured Boot enabled.
Signed-off-by Raymond Mao <[email protected]>---
Changes in V2:
- Move OP-TEE dependencies into the common group.
- Fetch MbedTLS/TF-A and build bl1/fip in dockerfile instead of post-buildman script.
- Remove Trust Boot related build options.tools/docker/Dockerfile | 74 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 3 deletions(-)tools/docker/Dockerfile +30
-1@@ -58,6 +58,9 @@ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \ apt-get update && apt-get install -y \ + adb \ + acpica-tools \ + autoconf \ automake \ autopoint \ bc \@@ -65,21 +68,26 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ bison \ build-essential \ byacc \ + ccache \ cgpt \ clang-18 \ coreutils \ cpio \ + cscope \ curl \ device-tree-compiler \ dosfstools \ e2fsprogs \ + e2tools \ efitools \ erofs-utils \ exfatprogs \ expect \ fakeroot \ + fastboot \ fdisk \ flex \ + ftp-upload \ gawk \ gdisk \ gettext \@@ -92,11 +100,20 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ imagemagick \ inetutils-telnet \ iputils-ping \ + libattr1-dev \ + libcap-ng-dev \ libconfuse-dev \ + libfdt-dev \ + libftdi-dev \ libgit2-dev \ libjson-glib-dev \ + libglib2.0-dev \ + libgmp3-dev \ libgnutls28-dev \ libgnutls30 \ + libhidapi-dev \ + libmpc-dev \ + libncurses5-dev \ libpixman-1-dev \ libpython3-dev \ libsdl1.2-dev \@@ -110,9 +127,11 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ lz4 \ lzma-alone \ lzop \ + make \ mount \ mtd-utils \ mtools \ + netcat \ net-tools \ ninja-build \ openssl \@@ -122,12 +141,16 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ python-is-python3 \ python2.7 \ python3 \ + python3-cryptography \ python3-dev \ python3-pip \ + python3-pyelftools \ + python3-serial \ python3-sphinx \ python3-tomli \ python3-venv \ rpm2cpio \ + rsync \ sbsigntool \ socat \ softhsm2 \@@ -136,13 +159,20 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ sudo \ swig \ texinfo \ + unzip \ util-linux \ uuid-dev \ vboot-kernel-utils \ vboot-utils \ + wget \ + xdg-utils \ xilinx-bootgen \ + xsltproc \ + xterm \ xxd \ - zip + xz-utils \ + zip \
Quoted 9 lines
tools/docker/Dockerfile RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ · line 175
Quoted 1 line
tools/docker/Dockerfile +1
-0+ zlib1g-devAre some of these deps perhaps optional? I would hope we could build without cscope and xterm, to pick randomly from the top and bottom of the list. I ask since everything we add here makes the container larger, and it's already very big. I'm almost wondering if we should (follow-up, later) add a step where we remove things that tools we built needed, but U-Boot doesn't need for build/tests.
Actually those deps are grep from OP-TEE official docs, but yes, I can find out the ones which are not really necessary and then remove them.
Raymond
Quoted 2 lines
--
Tom
PATCH v2 2/5 pytest: add test script to validate Firmware Handoff
In reply to Raymond MaoAdd test cases to validate FDT and TPM eventlog handoff from TF-A and OP-TEE via bloblist.
For FDT, the nodes 'reserved-memory' and 'firmware' appended by OP-TEE indicates a successful handoff.
For TPM eventlog, the events 'SECURE_RT_EL3', 'SECURE_RT_EL1_OPTEE' and 'SECURE_RT_EL1_OPTEE_EXTRA1' created by TF-A indicates a successful handoff.
---
Changes in v2:
- Control the tests to depend on 'env__firmware_handoff_enabled'.
test/py/tests/test_fw_handoff.py | 108 +++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 test/py/tests/test_fw_handoff.py
test/py/tests/test_fw_handoff.py new file +108 -0
@@ -0,0 +1,108 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (c) 2025 Linaro Limited +# Author: Raymond Mao <[email protected]> +# +# Validate Firmware Handoff from TF-A and OP-TEE + +""" +Note: This test relies on boardenv_* containing configuration values to define +whether Firmware Handoff is enabled for testing. Without this, this test +will be automatically skipped. + +For example: + +.. code-block:: python + + # Boolean indicating whether Firmware Handoff is enabled on this board. + # This variable may be omitted if its value is False. + env__firmware_handoff_enabled = True +""" + +import pytest +import re + +def _norm_ws(s: str) -> str: + """Normalize whitespace for robust comparisons.""" + return re.sub(r"\s+", " ", s).strip() + [email protected]("bloblist") [email protected]("cmd_bloblist") [email protected]("of_control") [email protected]("cmd_fdt") +def test_fw_handoff_dt(ubman): + """Validate FDT handoff via bloblist.""" + + fh_en = ubman.config.env.get('env__firmware_handoff_enabled', False) + if not fh_en: + pytest.skip('Firmware Handoff is disabled') + + bloblist = ubman.run_command("bloblist list") + blob_fdt = re.search(r"^([0-9a-fA-F]+)\s+[0-9a-fA-F]+\s+1\s+Control FDT\s*$", + bloblist, re.MULTILINE) + assert blob_fdt, "Control FDT entry not found in bloblist" + + blob_fdt_addr = int(blob_fdt.group(1), 16) + ubman.run_command(f"fdt addr {blob_fdt_addr:x}") + + reserved_a = ubman.run_command("fdt print /reserved-memory") + firmware_a = ubman.run_command("fdt print /firmware") + + fdt_addr_out = ubman.run_command("echo $fdt_addr") + fdt_addr_match = re.search(r"(?:0x)?([0-9a-fA-F]+)", fdt_addr_out) + assert fdt_addr_match, "Could not parse $fdt_addr" + + fdt_addr = int(fdt_addr_match.group(1), 16) + ubman.run_command(f"fdt addr {fdt_addr:x}") + + reserved_b = ubman.run_command("fdt print /reserved-memory") + firmware_b = ubman.run_command("fdt print /firmware") + + # Normalize whitespace & compare + assert _norm_ws(reserved_a) == _norm_ws(reserved_b), \ + "reserved-memory blocks differ between Control FDT and $fdt_addr FDT" + assert _norm_ws(firmware_a) == _norm_ws(firmware_b), \ + "firmware blocks differ between Control FDT and $fdt_addr FDT" + [email protected]("bloblist") [email protected]("cmd_bloblist") [email protected]("cmd_memory") +def test_fw_handoff_eventlog(ubman): + """Validate TPM event log handoff via bloblist.""" + + fh_en = ubman.config.env.get('env__firmware_handoff_enabled', False) + if not fh_en: + pytest.skip('Firmware Handoff is disabled') + + # Get the address and size of eventlog from the bloblist + bloblist_output = ubman.run_command("bloblist list") + evt_addr = None + evt_size = None + for line in bloblist_output.splitlines(): + if "TPM event log" in line: + parts = line.strip().split() + evt_addr = int(parts[0], 16) + evt_size = int(parts[1], 16) + break + + assert evt_addr is not None and evt_size is not None, \ + "TPM event log not found in bloblist" + + # Read byte from memory and extract printable ASCII from each line + md_output = ubman.run_command(f"md.b {evt_addr:x} {evt_size}") + ascii_log = "" + for line in md_output.splitlines(): + match = re.search(r'([0-9a-f]+:.*?)((?:\s[0-9a-f]{2}){1,16})\s+(.*)', line) + if match: + ascii_part = match.group(3).strip() + ascii_log += ascii_part + + # The events created by TF-A are expected + expected_keywords = [ + "SECURE_RT_EL3", + "SECURE_RT_EL1_OPTEE", + "SECURE_RT_EL1_OPTEE_EXTRA1" + ] + + for keyword in expected_keywords: + assert keyword in ascii_log, f"Missing expected event: {keyword}"
Signature · 1 line
2.25.1
Re: [PATCH v2 2/5] pytest: add test script to validate Firmware Handoff
Quoted 10 lines · Raymond Mao
Add test cases to validate FDT and TPM eventlog handoff from TF-A and OP-TEE via bloblist.
For FDT, the nodes 'reserved-memory' and 'firmware' appended by OP-TEE indicates a successful handoff.
For TPM eventlog, the events '
SECURE_RT_EL3', 'SECURE_RT_EL1_OPTEE' and 'SECURE_RT_EL1_OPTEE_EXTRA1' created by TF-A indicates a successful handoff.
Quoted 8 lines
Signed-off-by Raymond Mao <[email protected]>---
Changes in v2:
- Control the tests to depend on 'env__firmware_handoff_enabled'.test/py/tests/test_fw_handoff.py | 108 +++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 test/py/tests/test_fw_handoff.py
We should also be adding this to doc/develop/pytest/ as well, to make sure the documentation is formatted right. The output itself will be missing on readthedocs, sadly, as there's still some underlying bug to sort out with the integration.
Signature · 1 line
Tom
PATCH v2 3/5 configs: select CMD_BLOBLIST for Firmware Handoff testing
In reply to Raymond MaoFirmware Handoff tests will leverage the same board type 'qemu_arm64' with a new board ID 'fw_handoff_tfa_optee', thus select CMD_BLOBLIST in qemu_arm64_defconfig for running the test.
---
Changes in v2:
- None.
configs/qemu_arm64_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/qemu_arm64_defconfig +1 -0
@@ -32,6 +32,7 @@ CONFIG_CMD_SMBIOS=y CONFIG_CMD_BOOTZ=y CONFIG_CMD_BOOTEFI_SELFTEST=y CONFIG_CMD_NVEDIT_EFI=y +CONFIG_CMD_BLOBLIST=y CONFIG_CMD_DFU=y CONFIG_CMD_MTD=y CONFIG_CMD_PCI=y
Signature · 1 line
2.25.1
Re: [PATCH v2 3/5] configs: select CMD_BLOBLIST for Firmware Handoff testing
Quoted 5 lines · Raymond Mao
Firmware Handoff tests will leverage the same board type '
qemu_arm64' with a new board ID 'fw_handoff_tfa_optee', thus selectCMD_BLOBLISTinqemu_arm64_defconfigfor running the test.Signed-off-by Raymond Mao <[email protected]>
Signature · 1 line
Tom
PATCH v2 4/5 ci: check existence of bl1 and fip in the test script
In reply to Raymond MaoCheck the existence of bl1 and fip from:
1. /opt/tf-a/${board_type}_${board_ident}, if not exist, then;
2. /opt/tf-a/${board_type}
This change allows to test with TF-A with specified board ID only.
---
Changes in v2:
- Initial patch.
.azure-pipelines.yml | 14 ++++++++++++-- .gitlab-ci.yml | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-)
.azure-pipelines.yml +12 -2
@@ -308,8 +308,18 @@ stages: /opt/coreboot/cbfstool \${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom add-flat-binary -f \${UBOOT_TRAVIS_BUILD_DIR}/u-boot.bin -n fallback/payload -c LZMA -l 0x1110000 -e 0x1110000; fi # If we have TF-A binaries, we need to use them. - if [[ -d /opt/tf-a/"\${TEST_PY_BD}" ]]; then - cp /opt/tf-a/"\${TEST_PY_BD}"/fip.bin /opt/tf-a/"\${TEST_PY_BD}"/bl1.bin /tmp; + tfa_dir="" + rm -f /tmp/fip.bin + rm -f /tmp/bl1.bin + if [[ -d /opt/tf-a/"\${TEST_PY_BD}\${TEST_PY_ID//--id /_}" ]]; then + tfa_dir="/opt/tf-a/\${TEST_PY_BD}\${TEST_PY_ID//--id /_}"; + elif [[ -d /opt/tf-a/"\${TEST_PY_BD}" ]]; then + tfa_dir="/opt/tf-a/\${TEST_PY_BD}"; + fi + if [[ -n "\$tfa_dir" ]]; then + cp "\$tfa_dir"/fip.bin "\$tfa_dir"/bl1.bin /tmp/; + fi + if [ -f /tmp/fip.bin ] && [ -f /tmp/bl1.bin ]; then export fip=/tmp/fip.bin; export bl1=/tmp/bl1.bin; export PATH=/opt/Base_RevC_AEMvA_pkg/models/Linux64_GCC-9.3:\${PATH};
.gitlab-ci.yml +12 -2
@@ -97,8 +97,18 @@ stages: /opt/coreboot/cbfstool ${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom add-flat-binary -f ${UBOOT_TRAVIS_BUILD_DIR}/u-boot.bin -n fallback/payload -c LZMA -l 0x1110000 -e 0x1110000; fi # If we have TF-A binaries, we need to use them. - - if [[ -d /opt/tf-a/"${TEST_PY_BD}" ]]; then - cp /opt/tf-a/"${TEST_PY_BD}"/fip.bin /opt/tf-a/"${TEST_PY_BD}"/bl1.bin /tmp/; + - tfa_dir="" + - rm -f /tmp/fip.bin + - rm -f /tmp/bl1.bin + - if [[ -d /opt/tf-a/"${TEST_PY_BD}${TEST_PY_ID//--id /_}" ]]; then + tfa_dir="/opt/tf-a/${TEST_PY_BD}${TEST_PY_ID//--id /_}"; + elif [[ -d /opt/tf-a/"${TEST_PY_BD}" ]]; then + tfa_dir="/opt/tf-a/${TEST_PY_BD}"; + fi + - if [[ -n "$tfa_dir" ]]; then + cp "$tfa_dir"/fip.bin "$tfa_dir"/bl1.bin /tmp/; + fi + - if [ -f /tmp/fip.bin ] && [ -f /tmp/bl1.bin ]; then export fip=/tmp/fip.bin; export bl1=/tmp/bl1.bin; export PATH=/opt/Base_RevC_AEMvA_pkg/models/Linux64_GCC-9.3:${PATH};
Signature · 1 line
2.25.1
PATCH v2 5/5 ci: add test entries for qemu_arm64_tfa_fw_handoff
In reply to Raymond MaoAdd qemu_arm64_tfa_fw_handoff test entries to azure and gitlab pipelines.
---
Changes in v2:
- None.
.azure-pipelines.yml | 4 ++++ .gitlab-ci.yml | 7 +++++++ 2 files changed, 11 insertions(+)
.azure-pipelines.yml +4 -0
@@ -477,6 +477,10 @@ stages: qemu_arm64_lwip: TEST_PY_BD: "qemu_arm64_lwip" TEST_PY_TEST_SPEC: "test_net_dhcp or test_net_ping or test_net_tftpboot" + qemu_arm64_tfa_fw_handoff: + TEST_PY_BD: "qemu_arm64" + TEST_PY_ID: "--id fw_handoff_tfa_optee" + TEST_PY_TEST_SPEC: "test_fw_handoff" qemu_arm_sbsa_ref: TEST_PY_BD: "qemu-arm-sbsa" TEST_PY_TEST_SPEC: "not sleep"
.gitlab-ci.yml +7 -0
@@ -409,6 +409,13 @@ qemu_arm64_lwip test.py: TEST_PY_TEST_SPEC: "test_net_dhcp or test_net_ping or test_net_tftpboot" <<: *buildman_and_testpy_dfn +qemu_arm64_tfa_fw_handoff test.py: + variables: + TEST_PY_BD: "qemu_arm64" + TEST_PY_ID: "--id fw_handoff_tfa_optee" + TEST_PY_TEST_SPEC: "test_fw_handoff" + <<: *buildman_and_testpy_dfn + qemu_arm_sbsa test.py: variables: TEST_PY_BD: "qemu-arm-sbsa"
Signature · 1 line
2.25.1
Quoted 8 lines · Raymond Mao
This patch series enable Firmware Handoff [1] CI tests on
qemu_arm64by:
1. fetch MbedTLS (v3.6), OP-TEE (v4.7.0) and TF-A (v2.13.0);
2. build bl1 and fip with both Firmware Handoff and Measured Boot enabled;
3. pytest to validate the Firmware Handoff feature via bloblist by checking the existence of expected FDT nodes and TPM events generated and handed over from TF-A/OP-TEE.
Quoted 4 lines
Pre-requisite u-boot-test-hooks patches [2] are required.
[1] https://github.com/FirmwareHandoff/firmware_handoff
[2] https://lore.kernel.org/u-boot/[email protected]/T/#t
Generally, the changes look good, thanks! Specifically, did you trigger a CI run where you pointed Azure at a fork of u-boot-test-hooks with your changes? I'm a little concerned about the fiptool change and I don't see a CI run where qemu_arm64_optee.. was triggered, only:
https://dev.azure.com/u-boot/u-boot/_build/results?buildId=12044&view=results
where it's not. Thanks!
Signature · 1 line
Tom
Hi Tom,
Quoted 16 lines · Tom Rini
Quoted 8 lines · Raymond Mao
This patch series enable Firmware Handoff [1] CI tests on
qemu_arm64by:
1. fetch MbedTLS (v3.6), OP-TEE (v4.7.0) and TF-A (v2.13.0);
2. build bl1 and fip with both Firmware Handoff and Measured Boot enabled;
3. pytest to validate the Firmware Handoff feature via bloblist by checking the existence of expected FDT nodes and TPM events generated and handed over from TF-A/OP-TEE.Quoted 4 lines
Pre-requisite u-boot-test-hooks patches [2] are required.
[1] https://github.com/FirmwareHandoff/firmware_handoff
[2] https://lore.kernel.org/u-boot/[email protected]/T/#t
Quoted 7 lines
Generally, the changes look good, thanks! Specifically, did you trigger a CI run where you pointed Azure at a fork of u-boot-test-hooks with your changes? I'm a little concerned about the fiptool change and I don't see a CI run where
qemu_arm64_optee.. was triggered, only:
https://dev.azure.com/u-boot/u-boot/_build/results?buildId=12044&view=results
where it's not. Thanks!
That PR is missing the last commit (adding the CI jobs) and still pointing to the original test hooks.
I have tested with my local docker container (has a test.sh that simulates the one from azure.yml, and points to my test hooks working branch) and all works.
But when I triggered it this afternoon at:
https://github.com/u-boot/u-boot/pull/818, I did see the failures...
Hmmm, I will compare the log with the one I got from the local docker container to find the cause.
Regards,
Raymond
Quoted 2 lines
--
Tom
Hi Tom,
Quoted 36 lines · Raymond Mao
Hi Tom,
Quoted 16 lines · Tom Rini
Quoted 8 lines · Raymond Mao
This patch series enable Firmware Handoff [1] CI tests on
qemu_arm64by:
1. fetch MbedTLS (v3.6), OP-TEE (v4.7.0) and TF-A (v2.13.0);
2. build bl1 and fip with both Firmware Handoff and Measured Boot enabled;
3. pytest to validate the Firmware Handoff feature via bloblist by checking the existence of expected FDT nodes and TPM events generated and handed over from TF-A/OP-TEE.Quoted 4 lines
Pre-requisite u-boot-test-hooks patches [2] are required.
[1] https://github.com/FirmwareHandoff/firmware_handoff
[2] https://lore.kernel.org/u-boot/[email protected]/T/#tQuoted 7 lines
Generally, the changes look good, thanks! Specifically, did you trigger a CI run where you pointed Azure at a fork of u-boot-test-hooks with your changes? I'm a little concerned about the fiptool change and I don't see a CI run where
qemu_arm64_optee.. was triggered, only:
https://dev.azure.com/u-boot/u-boot/_build/results?buildId=12044&view=results
where it's not. Thanks!That PR is missing the last commit (adding the CI jobs) and still pointing to the original test hooks.
I have tested with my local docker container (has atest.shthat simulates the one from azure.yml, and points to my test hooks working branch) and all works.
But when I triggered it this afternoon at:
https://github.com/u-boot/u-boot/pull/818, I did see the failures...
Quoted 3 lines
Hmmm, I will compare the log with the one I got from the local docker container to find the cause.
The github CI seems to not build from the dockerfile, it always runs with:
``` 2025-10-03T22:30:41.8339632Z Digest: sha256:0d2cd4abea187f396a7e77041a6d9ce877314446a154cdcbfbbf546b09a58d09 2025-10-03T22:30:41.8352926Z Status: Downloaded newer image for trini/u-boot-gitlab-ci-runner:jammy-20250714-25Jul2025 ```
That is the reason of failure.
Is there a way to hack the CI to build the container from the dockerfile of the PR branch?
Regards,
Raymond
Quoted 5 lines
Regards,
RaymondQuoted 2 lines
--
Tom
Quoted 50 lines · Raymond Mao
Hi Tom,
Quoted 36 lines · Raymond Mao
Hi Tom,
Quoted 16 lines · Tom Rini
Quoted 8 lines · Raymond Mao
This patch series enable Firmware Handoff [1] CI tests on
qemu_arm64by:
1. fetch MbedTLS (v3.6), OP-TEE (v4.7.0) and TF-A (v2.13.0);
2. build bl1 and fip with both Firmware Handoff and Measured Boot enabled;
3. pytest to validate the Firmware Handoff feature via bloblist by checking the existence of expected FDT nodes and TPM events generated and handed over from TF-A/OP-TEE.Quoted 4 lines
Pre-requisite u-boot-test-hooks patches [2] are required.
[1] https://github.com/FirmwareHandoff/firmware_handoff
[2] https://lore.kernel.org/u-boot/[email protected]/T/#tQuoted 7 lines
Generally, the changes look good, thanks! Specifically, did you trigger a CI run where you pointed Azure at a fork of u-boot-test-hooks with your changes? I'm a little concerned about the fiptool change and I don't see a CI run where
qemu_arm64_optee.. was triggered, only:
https://dev.azure.com/u-boot/u-boot/_build/results?buildId=12044&view=results
where it's not. Thanks!That PR is missing the last commit (adding the CI jobs) and still pointing to the original test hooks.
I have tested with my local docker container (has atest.shthat simulates the one from azure.yml, and points to my test hooks working branch) and all works.
But when I triggered it this afternoon at:
https://github.com/u-boot/u-boot/pull/818, I did see the failures...Quoted 3 lines
Hmmm, I will compare the log with the one I got from the local docker container to find the cause.
The github CI seems to not build from the dockerfile, it always runs with:
``` 2025-10-03T22:30:41.8339632Z Digest: sha256:0d2cd4abea187f396a7e77041a6d9ce877314446a154cdcbfbbf546b09a58d09 2025-10-03T22:30:41.8352926Z Status: Downloaded newer image for trini/u-boot-gitlab-ci-runner:jammy-20250714-25Jul2025 ```
Quoted 3 lines
That is the reason of failure.
Is there a way to hack the CI to build the container from the dockerfile of the PR branch?
Yes, you need to change:
ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20250714-25Jul2025
In the .azure-pipelines.yml to point to where you've pushed your container changes to.
Signature · 1 line
Tom