* [Buildroot] [PATCH 1/1] support/testing: add optee-os runtime test
@ 2024-01-20 23:28 Julien Olivain
2024-02-07 15:36 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 2+ messages in thread
From: Julien Olivain @ 2024-01-20 23:28 UTC (permalink / raw)
To: buildroot; +Cc: Julien Olivain, Etienne Carriere
Cc: Etienne Carriere <etienne.carriere@foss.st.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
---
Patch tested on branch master at commit 3780925 with commands:
make check-package
...
0 warnings generated
support/testing/run-tests \
-d dl -o output_folder \
tests.boot.test_optee_os
...
OK
---
DEVELOPERS | 2 +
support/testing/tests/boot/test_optee_os.py | 74 +++++++++++++++++++
.../tests/boot/test_optee_os/u-boot.fragment | 8 ++
3 files changed, 84 insertions(+)
create mode 100644 support/testing/tests/boot/test_optee_os.py
create mode 100644 support/testing/tests/boot/test_optee_os/u-boot.fragment
diff --git a/DEVELOPERS b/DEVELOPERS
index f5b04937b6..d4a1d55758 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1750,6 +1750,8 @@ F: package/riscv-isa-sim/
F: package/tinycompress/
F: package/z3/
F: package/zynaddsubfx/
+F: support/testing/tests/boot/test_optee_os.py
+F: support/testing/tests/boot/test_optee_os/
F: support/testing/tests/package/sample_python_distro.py
F: support/testing/tests/package/sample_python_gnupg.py
F: support/testing/tests/package/sample_python_hwdata.py
diff --git a/support/testing/tests/boot/test_optee_os.py b/support/testing/tests/boot/test_optee_os.py
new file mode 100644
index 0000000000..5f5cd17464
--- /dev/null
+++ b/support/testing/tests/boot/test_optee_os.py
@@ -0,0 +1,74 @@
+import os
+
+import infra.basetest
+
+
+class TestOptee(infra.basetest.BRTest):
+ # A custom configuration is needed to enable OP-TEE support in the
+ # Kernel. This config is inspired from:
+ # configs/qemu_arm_vexpress_tz_defconfig
+ uboot_fragment = \
+ infra.filepath("tests/boot/test_optee_os/u-boot.fragment")
+ config = \
+ f"""
+ BR2_arm=y
+ BR2_cortex_a15=y
+ BR2_ARM_FPU_VFPV3D16=y
+ BR2_TOOLCHAIN_EXTERNAL=y
+ BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+ BR2_ROOTFS_POST_BUILD_SCRIPT="board/qemu/arm-vexpress-tz/post-build.sh"
+ BR2_LINUX_KERNEL=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.1.73"
+ BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
+ BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/qemu/arm-vexpress-tz/linux.fragment"
+ BR2_PACKAGE_OPTEE_EXAMPLES=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.9"
+ 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_UBOOT_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_TARGET_UBOOT=y
+ BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+ BR2_TARGET_UBOOT_CUSTOM_VERSION=y
+ BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2022.04"
+ BR2_TARGET_UBOOT_BOARD_DEFCONFIG="qemu_arm"
+ BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="{uboot_fragment}"
+ """
+
+ def test_run(self):
+ # There is no Kernel nor rootfs image here. They will be
+ # loaded by TFTP through the emulated network interface in
+ # u-boot.
+ bios = os.path.join(self.builddir, "images", "flash.bin")
+ tftp_dir = os.path.join(self.builddir, "images")
+ self.emulator.boot(arch="arm",
+ options=["-M", "virt,secure=on",
+ "-d", "unimp",
+ "-cpu", "cortex-a15",
+ "-m", "1024M",
+ "-netdev", f"user,id=vmnic,tftp={tftp_dir}",
+ "-device", "virtio-net-device,netdev=vmnic",
+ "-bios", bios])
+ self.emulator.login()
+
+ # Check the Kernel has OP-TEE messages
+ self.assertRunOk("dmesg | grep -F optee:")
+
+ # Check we have OP-TEE devices
+ self.assertRunOk("ls -al /dev/tee*")
+
+ # Run some OP-TEE examples
+ examples = ["aes", "hello_world", "hotp", "random", "secure_storage"]
+ for ex in examples:
+ self.assertRunOk(f"optee_example_{ex}")
diff --git a/support/testing/tests/boot/test_optee_os/u-boot.fragment b/support/testing/tests/boot/test_optee_os/u-boot.fragment
new file mode 100644
index 0000000000..b9505a1ff8
--- /dev/null
+++ b/support/testing/tests/boot/test_optee_os/u-boot.fragment
@@ -0,0 +1,8 @@
+CONFIG_SYS_TEXT_BASE=0x60000000
+CONFIG_BOOTCOMMAND="setenv ipaddr 10.0.2.15 && setenv serverip 10.0.2.2 && tftp ${kernel_addr_r} zImage && tftp ${ramdisk_addr_r} rootfs.cpio.uboot && setenv bootargs console=ttyAMA0,115200 earlyprintk=serial,ttyAMA0,115200 && bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr}"
+CONFIG_SEMIHOSTING=y
+# Drop flash accesses
+CONFIG_ENV_IS_IN_FLASH=n
+CONFIG_MTD=n
+CONFIG_MTD_NOR_FLASH=n
+CONFIG_ENV_IS_NOWHERE=y
--
2.43.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Buildroot] [PATCH 1/1] support/testing: add optee-os runtime test
2024-01-20 23:28 [Buildroot] [PATCH 1/1] support/testing: add optee-os runtime test Julien Olivain
@ 2024-02-07 15:36 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-02-07 15:36 UTC (permalink / raw)
To: Julien Olivain; +Cc: Etienne Carriere, buildroot
On Sun, 21 Jan 2024 00:28:54 +0100
Julien Olivain <ju.o@free.fr> wrote:
> Cc: Etienne Carriere <etienne.carriere@foss.st.com>
> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
> Patch tested on branch master at commit 3780925 with commands:
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-07 15:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-20 23:28 [Buildroot] [PATCH 1/1] support/testing: add optee-os runtime test Julien Olivain
2024-02-07 15:36 ` Thomas Petazzoni via buildroot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.