Skip to contentSkip to conversation

Enable Firmware Handoff CI test on qemu_arm64

PATCH Superseded Raymond Mao 3 participants 11 messages Oct 10, 2025 – Oct 13, 2025

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 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.
A test pipeline is triggered at [3] with hacking docker image and test hooks.

[1] https://github.com/FirmwareHandoff/firmware_handoff
[2] https://lore.kernel.org/u-boot/[email protected]/T/#t
[3] https://github.com/u-boot/u-boot/pull/818

Raymond Mao (6):
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: rename conf.qemu_arm64_na to conf.qemu_arm64
ci: add test entries for qemu_arm64_tfa_fw_handoff

 .azure-pipelines.yml                   |  20 ++++-
 .gitlab-ci.yml                         |  23 +++++-
 configs/qemu_arm64_defconfig           |   1 +
 doc/develop/pytest/test_fw_handoff.rst |   8 ++
 test/py/tests/test_fw_handoff.py       | 108 +++++++++++++++++++++++++
 tools/docker/Dockerfile                |  44 +++++++++-
 6 files changed, 196 insertions(+), 8 deletions(-)
 create mode 100644 doc/develop/pytest/test_fw_handoff.rst
 create mode 100644 test/py/tests/test_fw_handoff.py
Signature · 1 line
2.25.1
#1 lore raw

PATCH v3 1/6 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.
Changes in V3:
- Clean-up of OP-TEE deps.

 tools/docker/Dockerfile | 44 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)
tools/docker/Dockerfile +42 -2
index 5b4c75f8400..51d07b1482c 100644
@@ -122,8 +122,10 @@ 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-sphinx \
 	python3-tomli \
 	python3-venv \
@@ -227,10 +229,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 +265,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
#2 lore raw

Re: [PATCH v3 1/6] docker: add OP-TEE and TF-A build for testing Firmware Handoff

Hi Raymond,

Quoted 32 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.

---
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.
Changes in V3:
- Clean-up of OP-TEE deps.

 tools/docker/Dockerfile | 44 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)
tools/docker/Dockerfile +2 -0
index 5b4c75f8400..51d07b1482c 100644
@@ -122,8 +122,10 @@ 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-sphinx \
 	python3-tomli \
 	python3-venv \

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 236

Quoted 9 lines
tools/docker/Dockerfile +5 -1
@@ -227,10 +229,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- \

OK

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 237

Quoted 1 line
tools/docker/Dockerfile +1 -0
+		CROSS_COMPILE_core=/opt/gcc-${TCVER}-nolibc/aarch64-linux/bin/aarch64-linux- \

Not needed (eventually defaults to $(CROSS_COMPILE))

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 238

Quoted 1 line
tools/docker/Dockerfile +1 -0
+		CROSS_COMPILE32=/opt/gcc-${TCVER}-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi- \

OK

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 242

Quoted 4 lines
tools/docker/Dockerfile +4 -0
+		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 \

All 4 lines not needed (defaults)

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 244

Quoted 2 lines
tools/docker/Dockerfile +2 -0
+		CFG_TRANSFER_LIST=y CFG_MAP_EXT_DT_SECURE=y \
+		PLATFORM=vexpress-qemu_armv8a CFG_RPMB_FS=y \

OK

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 245

Quoted 1 line
tools/docker/Dockerfile +1 -0
+		CFG_RPMB_FS_DEV_ID=0 CFG_CORE_HEAP_SIZE=524288 CFG_RPMB_WRITE_KEY=y \

CFG_RPMB_FS_DEV_ID=0 not needed (default)

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 246

Quoted 1 line
tools/docker/Dockerfile +1 -0
+		CFG_CORE_HEAP_SIZE=524288 CFG_CORE_DYN_SHM=y CFG_RPMB_TESTKEY=y \

CFG_CORE_DYN_SHM=y not needed (default)

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 247

Quoted 1 line
tools/docker/Dockerfile +1 -0
+		CFG_RPMB_WRITE_KEY=1 \

Already set above

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 248

Quoted 1 line
tools/docker/Dockerfile +1 -0
+		CFG_REE_FS=n CFG_CORE_ARM64_PA_BITS=48  \

OK

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 249

Quoted 1 line
tools/docker/Dockerfile +1 -0
+		CFG_TEE_CORE_LOG_LEVEL=4 CFG_TEE_TA_LOG_LEVEL=1 DEBUG=y

CFG_TEE_TA_LOG_LEVEL=1 not needed (default).
Would the CFG_TEE_CORE_LOG_LEVEL (2 == LOG_LEVEL_ERROR) and DEBUG (disabled) be OK?

Quoted 25 lines
tools/docker/Dockerfile +15 -1
+
+# 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 +265,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 \

tools/docker/Dockerfile RUN git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git /tmp/t · line 288

Quoted 10 lines
tools/docker/Dockerfile +7 -0
+		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.

Thanks,

Signature · 1 line
Jerome
#3 lore raw

Re: [PATCH v3 1/6] docker: add OP-TEE and TF-A build for testing Firmware Handoff

Hi Jerome,

Quoted 48 lines · Jerome Forissier

Hi Raymond,

Quoted 32 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.

---
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.
Changes in V3:
- Clean-up of OP-TEE deps.

 tools/docker/Dockerfile | 44 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)
tools/docker/Dockerfile +2 -0
index 5b4c75f8400..51d07b1482c 100644
@@ -122,8 +122,10 @@ 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-sphinx \
      python3-tomli \
      python3-venv \

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 236

Quoted 9 lines
tools/docker/Dockerfile +5 -1
@@ -227,10 +229,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- \

OK

Quoted 4 lines

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 237

Quoted 1 line
tools/docker/Dockerfile +1 -0
+             CROSS_COMPILE_core=/opt/gcc-${TCVER}-nolibc/aarch64-linux/bin/aarch64-linux- \

Not needed (eventually defaults to $(CROSS_COMPILE))

Removing CROSS_COMPILE_core prompts "aarch64-linux-gnu-gcc: command not found", I think we need CROSS_COMPILE64 instead.

Quoted 11 lines

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 238

Quoted 1 line
tools/docker/Dockerfile +1 -0
+             CROSS_COMPILE32=/opt/gcc-${TCVER}-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi- \

OK

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 242

Quoted 4 lines
tools/docker/Dockerfile +4 -0
+             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 \

All 4 lines not needed (defaults)

Dito, removing CROSS_COMPILE_ta_arm64 prompts "aarch64-linux-gnu-gcc:
command not found".
I think for v4.7.0:
CROSS_COMPILE_ta_arm64 defaults to CROSS_COMPILE64; CROSS_COMPILE_ta_arm32 defaults to CROSS_COMPILE32; CROSS_COMPILE32 defaults to CROSS_COMPILE. CROSS_COMPILE_core defaults to CROSS_COMPILE64 when CFG_ARM64_core=y.

So actually CROSS_COMPILE and CROSS_COMPILE64 are required at least.

Regards,
Raymond

Quoted 65 lines

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 244

Quoted 2 lines
tools/docker/Dockerfile +2 -0
+             CFG_TRANSFER_LIST=y CFG_MAP_EXT_DT_SECURE=y \
+             PLATFORM=vexpress-qemu_armv8a CFG_RPMB_FS=y \

OK

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 245

Quoted 1 line
tools/docker/Dockerfile +1 -0
+             CFG_RPMB_FS_DEV_ID=0 CFG_CORE_HEAP_SIZE=524288 CFG_RPMB_WRITE_KEY=y \

CFG_RPMB_FS_DEV_ID=0 not needed (default)

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 246

Quoted 1 line
tools/docker/Dockerfile +1 -0
+             CFG_CORE_HEAP_SIZE=524288 CFG_CORE_DYN_SHM=y CFG_RPMB_TESTKEY=y \

CFG_CORE_DYN_SHM=y not needed (default)

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 247

Quoted 1 line
tools/docker/Dockerfile +1 -0
+             CFG_RPMB_WRITE_KEY=1 \

Already set above

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 248

Quoted 1 line
tools/docker/Dockerfile +1 -0
+             CFG_REE_FS=n CFG_CORE_ARM64_PA_BITS=48  \

OK

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 249

Quoted 1 line
tools/docker/Dockerfile +1 -0
+             CFG_TEE_CORE_LOG_LEVEL=4 CFG_TEE_TA_LOG_LEVEL=1 DEBUG=y

CFG_TEE_TA_LOG_LEVEL=1 not needed (default).
Would the CFG_TEE_CORE_LOG_LEVEL (2 == LOG_LEVEL_ERROR) and DEBUG (disabled) be OK?

Quoted 25 lines
tools/docker/Dockerfile +15 -1
+
+# 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 +265,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 \

tools/docker/Dockerfile RUN git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git /tmp/t · line 288

Quoted 10 lines
tools/docker/Dockerfile +7 -0
+             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.

Thanks,
--
Jerome

#4 lore raw

Re: [PATCH v3 1/6] docker: add OP-TEE and TF-A build for testing Firmware Handoff

Hi Raymond,

Quoted 52 lines · Raymond Mao

Hi Jerome,

Quoted 48 lines · Jerome Forissier

Hi Raymond,

Quoted 32 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.

---
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.
Changes in V3:
- Clean-up of OP-TEE deps.

 tools/docker/Dockerfile | 44 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)
tools/docker/Dockerfile +2 -0
index 5b4c75f8400..51d07b1482c 100644
@@ -122,8 +122,10 @@ 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-sphinx \
      python3-tomli \
      python3-venv \

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 236

Quoted 9 lines
tools/docker/Dockerfile +5 -1
@@ -227,10 +229,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- \

OK

Quoted 7 lines
Quoted 4 lines

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 237

Quoted 1 line
tools/docker/Dockerfile +1 -0
+             CROSS_COMPILE_core=/opt/gcc-${TCVER}-nolibc/aarch64-linux/bin/aarch64-linux- \

Not needed (eventually defaults to $(CROSS_COMPILE))

Removing CROSS_COMPILE_core prompts "aarch64-linux-gnu-gcc: command not found", I think we need CROSS_COMPILE64 instead.

Correct.

Quoted 21 lines
Quoted 12 lines

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 238

Quoted 2 lines
tools/docker/Dockerfile +1 -0
+             CROSS_COMPILE32=/opt/gcc-${TCVER}-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi- \

OK

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 242

Quoted 4 lines
tools/docker/Dockerfile +4 -0
+             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 \

All 4 lines not needed (defaults)

Dito, removing CROSS_COMPILE_ta_arm64 prompts "aarch64-linux-gnu-gcc:
command not found".
I think for v4.7.0:
CROSS_COMPILE_ta_arm64 defaults to CROSS_COMPILE64; CROSS_COMPILE_ta_arm32 defaults to CROSS_COMPILE32; CROSS_COMPILE32 defaults to CROSS_COMPILE. CROSS_COMPILE_core defaults to CROSS_COMPILE64 when CFG_ARM64_core=y.

Quoted 1 line

So actually CROSS_COMPILE and CROSS_COMPILE64 are required at least.

Again, this is totally correct. Sorry for mixing things up a bit ;-) Anyway you got the point, I'd like to minimize the number of variables set on the command line. I would recommend setting CROSS_COMPILE32 and CROSS_COMPILE64 (and not CROSS_COMPILE).

Thanks,

Signature · 1 line
Jerome
Quoted 70 lines

Regards,
Raymond

Quoted 65 lines

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 244

Quoted 2 lines
tools/docker/Dockerfile +2 -0
+             CFG_TRANSFER_LIST=y CFG_MAP_EXT_DT_SECURE=y \
+             PLATFORM=vexpress-qemu_armv8a CFG_RPMB_FS=y \

OK

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 245

Quoted 1 line
tools/docker/Dockerfile +1 -0
+             CFG_RPMB_FS_DEV_ID=0 CFG_CORE_HEAP_SIZE=524288 CFG_RPMB_WRITE_KEY=y \

CFG_RPMB_FS_DEV_ID=0 not needed (default)

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 246

Quoted 1 line
tools/docker/Dockerfile +1 -0
+             CFG_CORE_HEAP_SIZE=524288 CFG_CORE_DYN_SHM=y CFG_RPMB_TESTKEY=y \

CFG_CORE_DYN_SHM=y not needed (default)

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 247

Quoted 1 line
tools/docker/Dockerfile +1 -0
+             CFG_RPMB_WRITE_KEY=1 \

Already set above

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 248

Quoted 1 line
tools/docker/Dockerfile +1 -0
+             CFG_REE_FS=n CFG_CORE_ARM64_PA_BITS=48  \

OK

tools/docker/Dockerfile RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ · line 249

Quoted 1 line
tools/docker/Dockerfile +1 -0
+             CFG_TEE_CORE_LOG_LEVEL=4 CFG_TEE_TA_LOG_LEVEL=1 DEBUG=y

CFG_TEE_TA_LOG_LEVEL=1 not needed (default).
Would the CFG_TEE_CORE_LOG_LEVEL (2 == LOG_LEVEL_ERROR) and DEBUG (disabled) be OK?

Quoted 25 lines
tools/docker/Dockerfile +15 -1
+
+# 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 +265,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 \

tools/docker/Dockerfile RUN git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git /tmp/t · line 288

Quoted 10 lines
tools/docker/Dockerfile +7 -0
+             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.

Thanks,
--
Jerome

#5 lore raw

PATCH v3 2/6 pytest: add test script to validate Firmware Handoff

In reply to 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.

---
Changes in v2:
- Control the tests to depend on 'env__firmware_handoff_enabled'. Changes in V3:
- Doc file is added.

 doc/develop/pytest/test_fw_handoff.rst |   8 ++
 test/py/tests/test_fw_handoff.py       | 108 +++++++++++++++++++++++++
 2 files changed, 116 insertions(+)
 create mode 100644 doc/develop/pytest/test_fw_handoff.rst
 create mode 100644 test/py/tests/test_fw_handoff.py
doc/develop/pytest/test_fw_handoff.rst new file +8 -0
new file mode 100644
index 00000000000..af926f684c6
@@ -0,0 +1,8 @@
+test_fw_handoff
+===============
+
+.. automodule:: test_fw_handoff
+   :synopsis:
+   :member-order: bysource
+   :members:
+   :undoc-members:
test/py/tests/test_fw_handoff.py new file +108 -0

108 lines not on this page · raw message

Signature · 1 line
2.25.1
Reviewed-by on v3 2/6
#6 lore raw

Re: [PATCH v3 2/6] pytest: add test script to validate Firmware Handoff

Quoted 11 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.

Signature · 1 line
Tom
#7 lore raw

PATCH v3 3/6 configs: select CMD_BLOBLIST for Firmware Handoff testing

In reply to Raymond Mao

Firmware 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.
Changes in v3:
- None.

 configs/qemu_arm64_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/qemu_arm64_defconfig +1 -0
index 358bb1aeeb9..0a43abf8fbf 100644
@@ -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
#8 lore raw

PATCH v3 4/6 ci: check existence of bl1 and fip in the test script

In reply to Raymond Mao

Check 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.
Changes in v3:
- None.

 .azure-pipelines.yml | 14 ++++++++++++--
 .gitlab-ci.yml       | 14 ++++++++++++--
 2 files changed, 24 insertions(+), 4 deletions(-)
.azure-pipelines.yml +12 -2
index 8209d2b329c..1382e4f6475 100644
@@ -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
index 85401d3e09b..224485a2e64 100644
@@ -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
#9 lore raw

PATCH v3 5/6 ci: rename conf.qemu_arm64_na to conf.qemu_arm64

In reply to Raymond Mao

The test-hooks config file has been renamed by [1], thus update the name where it is used by the script.

[1] https://lore.kernel.org/u-boot/[email protected]/

---
Changes in v3:
- Initial patch.

 .azure-pipelines.yml | 2 +-
 .gitlab-ci.yml       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
.azure-pipelines.yml +1 -1
index 1382e4f6475..4bf4d9e763b 100644
@@ -254,7 +254,7 @@ stages:
           git clone --depth=1 https://github.com/u-boot/u-boot-test-hooks /tmp/uboot-test-hooks
           # qemu_arm64_lwip_defconfig is the same as qemu_arm64 but with NET_LWIP enabled.
           # The test config and the boardenv file from qemu_arm64 can be re-used so create symlinks
-          ln -s conf.qemu_arm64_na /tmp/uboot-test-hooks/bin/travis-ci/conf.qemu_arm64_lwip_na
+          ln -s conf.qemu_arm64 /tmp/uboot-test-hooks/bin/travis-ci/conf.qemu_arm64_lwip_na
           ln -s u_boot_boardenv_qemu_arm64_na.py /tmp/uboot-test-hooks/py/travis-ci/u_boot_boardenv_qemu_arm64_lwip_na.py
           ln -s travis-ci /tmp/uboot-test-hooks/bin/\`hostname\`
           ln -s travis-ci /tmp/uboot-test-hooks/py/\`hostname\`
.gitlab-ci.yml +1 -1
index 224485a2e64..5ae02176167 100644
@@ -39,7 +39,7 @@ stages:
     - git clone --depth=1 https://source.denx.de/u-boot/u-boot-test-hooks /tmp/uboot-test-hooks
     # qemu_arm64_lwip_defconfig is the same as qemu_arm64 but with NET_LWIP enabled.
     # The test config and the boardenv file from qemu_arm64 can be re-used so create symlinks
-    - ln -s conf.qemu_arm64_na /tmp/uboot-test-hooks/bin/travis-ci/conf.qemu_arm64_lwip_na
+    - ln -s conf.qemu_arm64 /tmp/uboot-test-hooks/bin/travis-ci/conf.qemu_arm64_lwip_na
     - ln -s u_boot_boardenv_qemu_arm64_na.py /tmp/uboot-test-hooks/py/travis-ci/u_boot_boardenv_qemu_arm64_lwip_na.py
     - ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
     - ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
Signature · 1 line
2.25.1
#10 lore raw

PATCH v3 6/6 ci: add test entries for qemu_arm64_tfa_fw_handoff

In reply to Raymond Mao

Add qemu_arm64_tfa_fw_handoff test entries to azure and gitlab pipelines.

---
Changes in v2:
- None.
Changes in v3:
- None.

 .azure-pipelines.yml | 4 ++++
 .gitlab-ci.yml       | 7 +++++++
 2 files changed, 11 insertions(+)
.azure-pipelines.yml +4 -0
index 4bf4d9e763b..6948ad6b4b6 100644
@@ -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
index 5ae02176167..e20e6c6d43f 100644
@@ -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