[Buildroot] [PATCH v3] support/testing/tests/boot/test_atf.py: test BL33
Thomas Petazzoni
thomas.petazzoni at bootlin.com
Thu Feb 5 08:04:00 UTC 2026
Hello,
Thanks for the patch!
On Wed, Feb 04, 2026 at 08:46:22PM -0800, Jakob Kastelic wrote:
> +class TestATFNoUBoot(infra.basetest.BRTest):
> + config = \
> + """
> + BR2_arm=y
> + BR2_cortex_a15=y
> + BR2_ARM_FPU_VFPV3D16=y
> + BR2_TOOLCHAIN_BUILDROOT_CXX=y
Can we use an external toolchain instead?
> + BR2_TARGET_ROOTFS_EXT2=y
> + BR2_TARGET_ROOTFS_EXT2_4=y
> + BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_18=y
> + BR2_GLOBAL_PATCH_DIR="board/qemu/patches"
> + BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
Not really useful for tests I'd say, and this would mean the test
would fail when we update qemu defconfigs as the test would no longer
be aligned with the hashes in board/qemu/patches/.
> + 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"
> + BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
> + BR2_LINUX_KERNEL=y
> + BR2_LINUX_KERNEL_CUSTOM_VERSION=y
> + BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.18.7"
> + 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_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
> + """
> +
> + def patch_dts(self):
> + """
> + Place the rootfs into the kernel command line via the DTB.
> +
> + In qemu-system-arm, -append is only allowed with -kernel option. Since
> + we are using the -bios option to load TF-A (which in turn loads the
> + kernel), we have to manually patch the DTB to add the root option.
> + """
> + dtb = os.path.join(self.builddir, "images", "qemu.dtb")
> + rootfs = os.path.join(self.builddir, "images", "rootfs.ext4")
> + flash = os.path.join(self.builddir, "images", "flash.bin")
> + qemu = os.path.join(self.builddir, "host", "bin", "qemu-system-arm")
> + fdtput = os.path.join(self.builddir, "host", "bin", "fdtput")
> +
> + # get the DTB from Qemu
> + subprocess.run([
> + qemu, "-machine", f"virt,dumpdtb={dtb}", "-machine",
> + "secure=on", "-cpu", "cortex-a15"
> + ], check=True)
> +
> + # insert kernel command line argument into DTB
> + subprocess.run([fdtput, "-t", "s", f"{dtb}", "/chosen", "bootargs",
> + "root=/dev/vda" ], check=True)
> +
> + return dtb, rootfs, flash
> +
> + def test_run(self):
> + dtb, rootfs, flash = self.patch_dts()
> +
> + self.emulator.boot(arch="arm", options=[
> + "-machine", f"virt", "-machine",
Why f"virt" and not just "virt" ?
Otherwise, looks good to me!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
More information about the buildroot
mailing list