[Buildroot] [PATCH v2 2/2] configs/qemu_arm_vexpress_tz_falcon_defconfig: new
Jakob Kastelic
kastelic.jakob at gmail.com
Wed Sep 17 02:45:41 UTC 2025
This commit adds a new configuration, in which TF-A loads Linux directly
(as BL33) under Qemu. This defconfig can be used to test the new TF-A
flag, BR2_TARGET_ARM_TRUSTED_FIRMWARE_LINUX_AS_BL33.
Signed-off-by: Jakob Kastelic <kastelic.jakob at gmail.com>
---
DEVELOPERS | 3 ++
.../qemu/arm-vexpress-tz-falcon/patch-dts.sh | 21 +++++++++++
board/qemu/arm-vexpress-tz-falcon/readme.txt | 28 +++++++++++++++
configs/qemu_arm_vexpress_tz_falcon_defconfig | 36 +++++++++++++++++++
4 files changed, 88 insertions(+)
create mode 100755 board/qemu/arm-vexpress-tz-falcon/patch-dts.sh
create mode 100644 board/qemu/arm-vexpress-tz-falcon/readme.txt
create mode 100644 configs/qemu_arm_vexpress_tz_falcon_defconfig
diff --git a/DEVELOPERS b/DEVELOPERS
index 16d9ee892b..227b239bea 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -3537,3 +3537,6 @@ F: package/quazip/
F: package/shapelib/
F: package/simple-mail/
F: package/tinc/
+
+N: Jakob Kastelic <kastelic.jakob at gmail.com>
+F: configs/qemu_arm_vexpress_tz_falcon_defconfig
diff --git a/board/qemu/arm-vexpress-tz-falcon/patch-dts.sh b/board/qemu/arm-vexpress-tz-falcon/patch-dts.sh
new file mode 100755
index 0000000000..896ae317b5
--- /dev/null
+++ b/board/qemu/arm-vexpress-tz-falcon/patch-dts.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -u
+set -e
+
+QEMU_BOARD_DIR="$(dirname "$0")"
+INITRD_ADDR=$(sed -n 's/.*addr=\(0x[0-9a-fA-F]*\).*/\1/p' "${QEMU_BOARD_DIR}/readme.txt" | head -n1)
+ROOTFS_SIZE=$(stat -c %s "${BINARIES_DIR}/rootfs.cpio.gz")
+INITRD_END=$(printf '0x%x' $((0x${INITRD_ADDR#0x} + ROOTFS_SIZE)))
+TMP_DTB="${BINARIES_DIR}/falcon.tmp.dtb"
+FINAL_DTB="${BINARIES_DIR}/falcon.dtb"
+
+# Extract the DTB from Qemu
+qemu-system-arm -smp 1 -s -m 1024 -d unimp \
+ -machine virt,dumpdtb="${TMP_DTB}",secure=on -cpu cortex-a15
+
+# Insert intramfs address into /chosen
+fdtput -t x "${TMP_DTB}" /chosen linux,initrd-start "${INITRD_ADDR}"
+fdtput -t x "${TMP_DTB}" /chosen linux,initrd-end "${INITRD_END}"
+
+mv "${TMP_DTB}" "${FINAL_DTB}"
diff --git a/board/qemu/arm-vexpress-tz-falcon/readme.txt b/board/qemu/arm-vexpress-tz-falcon/readme.txt
new file mode 100644
index 0000000000..a7bf5c01e1
--- /dev/null
+++ b/board/qemu/arm-vexpress-tz-falcon/readme.txt
@@ -0,0 +1,28 @@
+Board qemu_arm_vexpress_tz_falcon builds a QEMU ARMv7-A target system with
+OP-TEE running in the TrustZone secure world and a Linux based
+OS running in the non-secure world. The board configuration enables
+builds of the QEMU host ARM target emulator.
+
+ make qemu_arm_vexpress_tz_falcon_defconfig
+ make
+
+The BIOS used in the QEMU host is the ARM Trusted Firmware-A (TF-A).
+Since TF-A loads the Linux kernel directly, Qemu is expected to place both the
+DTB and the rootfs image in memory. For this reason the emulation needs to be
+run from the image directory:
+
+ cd output/images && ../host/bin/qemu-system-arm \
+ -machine virt -machine secure=on -cpu cortex-a15 \
+ -dtb falcon.dtb -device loader,file=rootfs.cpio.gz,addr=0x76000040 \
+ -smp 1 -s -m 1024 -d unimp \
+ -serial stdio \
+ -netdev user,id=vmnic -device virtio-net-device,netdev=vmnic \
+ -semihosting-config enable=on,target=native \
+ -bios flash.bin # qemu_arm_vexpress_tz_falcon_defconfig
+
+The boot stage traces (if any) followed by the login prompt will appear
+in the terminal that started QEMU.
+
+For all other details, check out the Readme for qemu_arm_vexpress_tz_defconfig.
+That configuration differs from the present one only in that it uses U-Boot to
+load Linux, rather than loading it from TF-A directly as we do here.
diff --git a/configs/qemu_arm_vexpress_tz_falcon_defconfig b/configs/qemu_arm_vexpress_tz_falcon_defconfig
new file mode 100644
index 0000000000..5ca6e74668
--- /dev/null
+++ b/configs/qemu_arm_vexpress_tz_falcon_defconfig
@@ -0,0 +1,36 @@
+BR2_arm=y
+BR2_cortex_a15=y
+BR2_ARM_FPU_VFPV3D16=y
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y
+BR2_TOOLCHAIN_BUILDROOT_CXX=y
+BR2_GLOBAL_PATCH_DIR="board/qemu/patches"
+BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
+BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/qemu/arm-vexpress-tz/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh board/qemu/arm-vexpress-tz-falcon/patch-dts.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.27"
+BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
+BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/qemu/arm-vexpress-tz/linux.fragment"
+BR2_PACKAGE_OPENSSL=y
+BR2_PACKAGE_OPTEE_EXAMPLES=y
+BR2_PACKAGE_OPTEE_TEST=y
+BR2_TARGET_ROOTFS_CPIO=y
+BR2_TARGET_ROOTFS_CPIO_GZIP=y
+BR2_TARGET_ROOTFS_CPIO_UIMAGE=y
+# BR2_TARGET_ROOTFS_TAR is not set
+BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION=y
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.7"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="qemu"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP=y
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE=y
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_LINUX_AS_BL33=y
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES="BL32_RAM_LOCATION=tdram"
+BR2_TARGET_OPTEE_OS=y
+BR2_TARGET_OPTEE_OS_NEEDS_DTC=y
+BR2_TARGET_OPTEE_OS_PLATFORM="vexpress-qemu_virt"
+BR2_PACKAGE_HOST_QEMU=y
+BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
--
2.39.5
More information about the buildroot
mailing list