diff --git a/common.mk b/common.mk index 7a1fa58a0c36ec008bfa7458ebc4cea02648c81b..cb8b74d53ecad692d12776a7aeea95240f046151 100644 --- a/common.mk +++ b/common.mk @@ -14,6 +14,7 @@ OPTEE_CLIENT_PATH ?= $(ROOT)/optee_client OPTEE_CLIENT_EXPORT ?= $(OPTEE_CLIENT_PATH)/out/export OPTEE_TEST_PATH ?= $(ROOT)/optee_test OPTEE_TEST_OUT_PATH ?= $(ROOT)/optee_test/out +HELLOWORLD_PATH ?= $(ROOT)/hello_world CFG_TEE_CORE_LOG_LEVEL ?= 3 @@ -194,7 +195,7 @@ optee-os-common: OPTEE_OS_CLEAN_COMMON_FLAGS ?= $(OPTEE_OS_COMMON_EXTRA_FLAGS) -optee-os-clean-common: xtest-clean +optee-os-clean-common: xtest-clean helloworld-clean $(MAKE) -C $(OPTEE_OS_PATH) $(OPTEE_OS_CLEAN_COMMON_FLAGS) clean OPTEE_CLIENT_COMMON_FLAGS ?= CROSS_COMPILE=$(CROSS_COMPILE_NS_USER) @@ -231,3 +232,19 @@ XTEST_PATCH_COMMON_FLAGS ?= $(XTEST_COMMON_FLAGS) xtest-patch-common: $(MAKE) -C $(OPTEE_TEST_PATH) $(XTEST_PATCH_COMMON_FLAGS) patch + +################################################################################ +# hello_world +################################################################################ +HELLOWORLD_COMMON_FLAGS ?= HOST_CROSS_COMPILE=$(CROSS_COMPILE_NS_USER)\ + TA_CROSS_COMPILE=$(CROSS_COMPILE_S_USER) \ + TA_DEV_KIT_DIR=$(OPTEE_OS_TA_DEV_KIT_DIR) \ + TEEC_EXPORT=$(OPTEE_CLIENT_EXPORT) + +helloworld-common: optee-os optee-client + $(MAKE) -C $(HELLOWORLD_PATH) $(HELLOWORLD_COMMON_FLAGS) + +HELLOWORLD_CLEAN_COMMON_FLAGS ?= TA_DEV_KIT_DIR=$(OPTEE_OS_TA_DEV_KIT_DIR) + +helloworld-clean-common: + $(MAKE) -C $(HELLOWORLD_PATH) $(HELLOWORLD_CLEAN_COMMON_FLAGS) clean diff --git a/fvp.mk b/fvp.mk index 7a357ac248650abccb660e00cd885860468b90e2..56be3b7a31e4c53356d3bf704d2eea8539fb6671 100644 --- a/fvp.mk +++ b/fvp.mk @@ -27,7 +27,7 @@ endif ################################################################################ # Targets ################################################################################ -all: arm-tf edk2 linux optee-os optee-client xtest +all: arm-tf edk2 linux optee-os optee-client xtest helloworld all-clean: arm-tf-clean busybox-clean edk2-clean optee-os-clean \ optee-client-clean @@ -129,6 +129,13 @@ xtest-clean: xtest-clean-common xtest-patch: xtest-patch-common +################################################################################ +# hello_world +################################################################################ +helloworld: helloworld-common + +helloworld-clean: helloworld-clean-common + ################################################################################ # Root FS ################################################################################ @@ -136,11 +143,13 @@ xtest-patch: xtest-patch-common filelist-tee: @echo "# xtest / optee_test" > $(GEN_ROOTFS_FILELIST) @find $(OPTEE_TEST_OUT_PATH) -type f -name "xtest" | sed 's/\(.*\)/file \/bin\/xtest \1 755 0 0/g' >> $(GEN_ROOTFS_FILELIST) + @echo "file /bin/hello_world $(HELLOWORLD_PATH)/host/hello_world 755 0 0" >> $(GEN_ROOTFS_FILELIST) @echo "# TAs" >> $(GEN_ROOTFS_FILELIST) @echo "dir /lib/optee_armtz 755 0 0" >> $(GEN_ROOTFS_FILELIST) @find $(OPTEE_TEST_OUT_PATH) -name "*.ta" | \ sed 's/\(.*\)\/\(.*\)/file \/lib\/optee_armtz\/\2 \1\/\2 444 0 0/g' >> $(GEN_ROOTFS_FILELIST) - @echo "# Secure storage dig" >> $(GEN_ROOTFS_FILELIST) + @echo "file /lib/optee_armtz/8aaaf200-2450-11e4-abe20002a5d5c51b.ta $(HELLOWORLD_PATH)/ta/8aaaf200-2450-11e4-abe20002a5d5c51b.ta 444 0 0" >> $(GEN_ROOTFS_FILELIST) + @echo "# Secure storage dir" >> $(GEN_ROOTFS_FILELIST) @echo "dir /data 755 0 0" >> $(GEN_ROOTFS_FILELIST) @echo "dir /data/tee 755 0 0" >> $(GEN_ROOTFS_FILELIST) @if [ -e $(OPTEE_GENDRV_MODULE) ]; then \ @@ -155,7 +164,7 @@ filelist-tee: @echo "slink /lib/libteec.so.1 libteec.so.1.0 755 0 0" >> $(GEN_ROOTFS_FILELIST) @echo "slink /lib/libteec.so libteec.so.1 755 0 0" >> $(GEN_ROOTFS_FILELIST) -update_rootfs: busybox optee-client xtest filelist-tee +update_rootfs: busybox optee-client xtest helloworld filelist-tee cat $(GEN_ROOTFS_PATH)/filelist-final.txt $(GEN_ROOTFS_PATH)/filelist-tee.txt > $(GEN_ROOTFS_PATH)/filelist.tmp cd $(GEN_ROOTFS_PATH); \ $(LINUX_PATH)/usr/gen_init_cpio $(GEN_ROOTFS_PATH)/filelist.tmp | gzip > $(GEN_ROOTFS_PATH)/filesystem.cpio.gz diff --git a/hikey.mk b/hikey.mk index c1da02b01a74945b4eda67c813332a360dd98b43..eca36917366f05731b00a807ab9c4398bacd099c 100644 --- a/hikey.mk +++ b/hikey.mk @@ -61,7 +61,7 @@ SHAPERF_PATH ?=$(ROOT)/sha-perf ################################################################################ all: prepare arm-tf boot-img lloader nvme -clean: arm-tf-clean busybox-clean edk2-clean linux-clean optee-os-clean optee-client-clean xtest-clean strace-clean update_rootfs-clean boot-img-clean lloader-clean aes-perf-clean sha-perf-clean grub-clean +clean: arm-tf-clean busybox-clean edk2-clean linux-clean optee-os-clean optee-client-clean xtest-clean helloworld-clean strace-clean update_rootfs-clean boot-img-clean lloader-clean aes-perf-clean sha-perf-clean grub-clean cleaner: clean prepare-cleaner busybox-cleaner linux-cleaner strace-cleaner nvme-cleaner grub-cleaner @@ -214,6 +214,13 @@ xtest-clean: xtest-clean-common .PHONY: xtest-patch xtest-patch: xtest-patch-common +################################################################################ +# hello_world +################################################################################ +helloworld: helloworld-common + +helloworld-clean: helloworld-clean-common + ################################################################################ # aes-pef ################################################################################ @@ -271,8 +278,10 @@ filelist-all: busybox export TOP=$(ROOT); export MULTIARCH=$(MULTIARCH); \ $(expand-env-var) <$(PATCHES_PATH)/rootfs/initramfs-add-files.txt >> $(GEN_ROOTFS_PATH)/filelist-all.txt; \ find $(OPTEE_TEST_OUT_PATH) -type f -name "xtest" | sed 's/\(.*\)/file \/bin\/xtest \1 755 0 0/g' >> $(GEN_ROOTFS_PATH)/filelist-all.txt; \ + @echo "file /bin/hello_world $(HELLOWORLD_PATH)/host/hello_world 755 0 0" >> $(GEN_ROOTFS_PATH)/filelist-all.txt; \ find $(OPTEE_TEST_OUT_PATH) -name "*.ta" | \ - sed 's/\(.*\)\/\(.*\)/file \/lib\/optee_armtz\/\2 \1\/\2 444 0 0/g' >> $(GEN_ROOTFS_PATH)/filelist-all.txt + sed 's/\(.*\)\/\(.*\)/file \/lib\/optee_armtz\/\2 \1\/\2 444 0 0/g' >> $(GEN_ROOTFS_PATH)/filelist-all.txt; \ + @echo "file /lib/optee_armtz/8aaaf200-2450-11e4-abe20002a5d5c51b.ta $(HELLOWORLD_PATH)/ta/8aaaf200-2450-11e4-abe20002a5d5c51b.ta 444 0 0" >> $(GEN_ROOTFS_PATH)/filelist-all.txt @if [ -e $(OPTEE_GENDRV_MODULE) ]; then \ echo "# OP-TEE device" >> $(GEN_ROOTFS_PATH)/filelist-all.txt; \ echo "dir /lib/modules 755 0 0" >> $(GEN_ROOTFS_PATH)/filelist-all.txt; \ @@ -280,7 +289,7 @@ filelist-all: busybox echo "file /lib/modules/$(call KERNEL_VERSION)/optee.ko $(OPTEE_GENDRV_MODULE) 755 0 0" >> $(GEN_ROOTFS_PATH)/filelist-all.txt; \ fi -update_rootfs: optee-client xtest aes-perf sha-perf strace filelist-all linux-gen_init_cpio +update_rootfs: optee-client xtest helloworld aes-perf sha-perf strace filelist-all linux-gen_init_cpio cd $(GEN_ROOTFS_PATH); \ $(LINUX_PATH)/usr/gen_init_cpio $(GEN_ROOTFS_PATH)/filelist-all.txt | gzip > $(GEN_ROOTFS_PATH)/filesystem.cpio.gz diff --git a/hikey_debian.mk b/hikey_debian.mk index 09ec2b2ecaf4239a98d6a9b1236fb6a87228f806..b212c9edb7d7134a8ec86be4e9ef25665429f194 100644 --- a/hikey_debian.mk +++ b/hikey_debian.mk @@ -81,7 +81,7 @@ DEBPKG_CONTROL_PATH ?= $(DEBPKG_PATH)/DEBIAN ################################################################################ all: prepare arm-tf linux boot-img lloader system-img nvme deb -clean: arm-tf-clean edk2-clean linux-clean optee-os-clean optee-client-clean xtest-clean boot-img-clean lloader-clean aes-perf-clean sha-perf-clean +clean: arm-tf-clean edk2-clean linux-clean optee-os-clean optee-client-clean xtest-clean helloworld-clean boot-img-clean lloader-clean aes-perf-clean sha-perf-clean cleaner: clean prepare-cleaner linux-cleaner nvme-cleaner system-img-cleaner @@ -212,6 +212,13 @@ xtest-clean: xtest-clean-common .PHONY: xtest-patch xtest-patch: xtest-patch-common +################################################################################ +# hello_world +################################################################################ +helloworld: helloworld-common + +helloworld-clean: helloworld-clean-common + ################################################################################ # aes-pef ################################################################################ @@ -301,7 +308,7 @@ Architecture: arm64 Depends: Maintainer: Joakim Bech <joakim.bech@linaro.org> Description: OP-TEE client binaries, test program and Trusted Applications - Package contains tee-supplicant, libtee.so, xtest and a set of + Package contains tee-supplicant, libtee.so, xtest, hello_world and a set of Trusted Applications. NOTE! This package should only be used for testing and development. endef @@ -309,15 +316,17 @@ endef export CONTROL_TEXT .PHONY: deb -deb: xtest optee-client +deb: xtest helloworld optee-client @mkdir -p $(DEBPKG_BIN_PATH) && cd $(DEBPKG_BIN_PATH) && \ cp -f $(OPTEE_CLIENT_EXPORT)/bin/tee-supplicant . && \ - cp -f $(OPTEE_TEST_OUT_PATH)/xtest/xtest . + cp -f $(OPTEE_TEST_OUT_PATH)/xtest/xtest . && \ + cp -f $(HELLOWORLD_PATH)/host/hello_world . @mkdir -p $(DEBPKG_LIB_PATH) && cd $(DEBPKG_LIB_PATH) && \ cp $(OPTEE_CLIENT_EXPORT)/lib/libtee* . @mkdir -p $(DEBPKG_TA_PATH) && cd $(DEBPKG_TA_PATH) && \ + cp $(HELLOWORLD_PATH)/ta/*.ta . && \ find $(OPTEE_TEST_OUT_PATH)/ta -name "*.ta" -exec cp {} . \; @mkdir -p $(DEBPKG_CONTROL_PATH) diff --git a/juno.mk b/juno.mk index 5dadb9e1259584d3e4b388eab2695434a6641aab..a19df942f2c1fe8471f7980ef4e0b466e22e517c 100644 --- a/juno.mk +++ b/juno.mk @@ -23,7 +23,7 @@ U-BOOT_BIN ?= $(U-BOOT_PATH)/u-boot.bin ################################################################################ # Targets ################################################################################ -all: arm-tf u-boot linux optee-os optee-client xtest update_rootfs +all: arm-tf u-boot linux optee-os optee-client xtest helloworld update_rootfs all-clean: arm-tf-clean busybox-clean u-boot-clean optee-os-clean \ optee-client-clean @@ -128,6 +128,13 @@ xtest-clean: xtest-clean-common xtest-patch: xtest-patch-common +################################################################################ +# hello_world +################################################################################ +helloworld: helloworld-common + +helloworld-clean: helloworld-clean-common + ################################################################################ # Root FS ################################################################################ @@ -135,11 +142,13 @@ xtest-patch: xtest-patch-common filelist-tee: @echo "# xtest / optee_test" > $(GEN_ROOTFS_FILELIST) @find $(OPTEE_TEST_OUT_PATH) -type f -name "xtest" | sed 's/\(.*\)/file \/bin\/xtest \1 755 0 0/g' >> $(GEN_ROOTFS_FILELIST) + @echo "file /bin/hello_world $(HELLOWORLD_PATH)/host/hello_world 755 0 0" >> $(GEN_ROOTFS_FILELIST) @echo "# TAs" >> $(GEN_ROOTFS_FILELIST) @echo "dir /lib/optee_armtz 755 0 0" >> $(GEN_ROOTFS_FILELIST) @find $(OPTEE_TEST_OUT_PATH) -name "*.ta" | \ sed 's/\(.*\)\/\(.*\)/file \/lib\/optee_armtz\/\2 \1\/\2 444 0 0/g' >> $(GEN_ROOTFS_FILELIST) - @echo "# Secure storage dig" >> $(GEN_ROOTFS_FILELIST) + @echo "file /lib/optee_armtz/8aaaf200-2450-11e4-abe20002a5d5c51b.ta $(HELLOWORLD_PATH)/ta/8aaaf200-2450-11e4-abe20002a5d5c51b.ta 444 0 0" >> $(GEN_ROOTFS_FILELIST) + @echo "# Secure storage dir" >> $(GEN_ROOTFS_FILELIST) @echo "dir /data 755 0 0" >> $(GEN_ROOTFS_FILELIST) @echo "dir /data/tee 755 0 0" >> $(GEN_ROOTFS_FILELIST) @if [ -e $(OPTEE_GENDRV_MODULE) ]; then \ @@ -155,7 +164,7 @@ filelist-tee: @echo "slink /lib/libteec.so libteec.so.1 755 0 0" >> $(GEN_ROOTFS_FILELIST) .PHONY: update_rootfs -update_rootfs: u-boot busybox optee-client xtest filelist-tee +update_rootfs: u-boot busybox optee-client xtest helloworld filelist-tee cat $(GEN_ROOTFS_PATH)/filelist-final.txt $(GEN_ROOTFS_PATH)/filelist-tee.txt > $(GEN_ROOTFS_PATH)/filelist.tmp cd $(GEN_ROOTFS_PATH) && \ $(LINUX_PATH)/usr/gen_init_cpio $(GEN_ROOTFS_PATH)/filelist.tmp | gzip > $(GEN_ROOTFS_PATH)/filesystem.cpio.gz diff --git a/mediatek.mk b/mediatek.mk index c04141b1a6b275e7d8d873ed85b2a4b3d6bac107..8bd39bc84ffaa6fb4a10902a145800700d84c7dd 100644 --- a/mediatek.mk +++ b/mediatek.mk @@ -21,7 +21,7 @@ ARM_TF_BIN ?= $(ARM_TF_PATH)/build/mt8173/debug/bl31.bin ################################################################################ # Targets ################################################################################ -all: arm-tf linux optee-os optee-client xtest +all: arm-tf linux optee-os optee-client xtest helloworld all-clean: arm-tf-clean linux-clean busybox-clean optee-os-clean \ optee-client-clean @@ -103,6 +103,12 @@ xtest: xtest-common xtest-clean: xtest-clean-common xtest-patch: xtest-patch-common +################################################################################ +# hello_world +################################################################################ +helloworld: helloworld-common +helloworld-clean: helloworld-clean-common + ################################################################################ # Root FS ################################################################################ @@ -110,11 +116,13 @@ xtest-patch: xtest-patch-common filelist-tee: @echo "# xtest / optee_test" > $(GEN_ROOTFS_FILELIST) @find $(OPTEE_TEST_OUT_PATH) -type f -name "xtest" | sed 's/\(.*\)/file \/bin\/xtest \1 755 0 0/g' >> $(GEN_ROOTFS_FILELIST) + @echo "file /bin/hello_world $(HELLOWORLD_PATH)/host/hello_world 755 0 0" >> $(GEN_ROOTFS_FILELIST) @echo "# TAs" >> $(GEN_ROOTFS_FILELIST) @echo "dir /lib/optee_armtz 755 0 0" >> $(GEN_ROOTFS_FILELIST) @find $(OPTEE_TEST_OUT_PATH) -name "*.ta" | \ sed 's/\(.*\)\/\(.*\)/file \/lib\/optee_armtz\/\2 \1\/\2 444 0 0/g' >> $(GEN_ROOTFS_FILELIST) - @echo "# Secure storage dig" >> $(GEN_ROOTFS_FILELIST) + @echo "file /lib/optee_armtz/8aaaf200-2450-11e4-abe20002a5d5c51b.ta $(HELLOWORLD_PATH)/ta/8aaaf200-2450-11e4-abe20002a5d5c51b.ta 444 0 0" >> $(GEN_ROOTFS_FILELIST) + @echo "# Secure storage dir" >> $(GEN_ROOTFS_FILELIST) @echo "dir /data 755 0 0" >> $(GEN_ROOTFS_FILELIST) @echo "dir /data/tee 755 0 0" >> $(GEN_ROOTFS_FILELIST) @if [ -e $(OPTEE_GENDRV_MODULE) ]; then \ @@ -130,7 +138,7 @@ filelist-tee: @echo "slink /lib/aarch64-linux-gnu/libteec.so.1 libteec.so.1.0 755 0 0" >> $(GEN_ROOTFS_FILELIST) @echo "slink /lib/aarch64-linux-gnu/libteec.so libteec.so.1 755 0 0" >> $(GEN_ROOTFS_FILELIST) -update_rootfs: busybox optee-client xtest filelist-tee +update_rootfs: busybox optee-client xtest helloworld filelist-tee cat $(GEN_ROOTFS_PATH)/filelist-final.txt $(GEN_ROOTFS_PATH)/filelist-tee.txt > $(GEN_ROOTFS_PATH)/filelist.tmp cd $(GEN_ROOTFS_PATH); \ $(LINUX_PATH)/usr/gen_init_cpio $(GEN_ROOTFS_PATH)/filelist.tmp | gzip > $(GEN_ROOTFS_PATH)/filesystem.cpio.gz diff --git a/qemu.mk b/qemu.mk index 126485e31087cf3f38ad81f0c7ca840526d143d1..601777be2ddc88b4ff80f0562aa2f6c6328d7f94 100644 --- a/qemu.mk +++ b/qemu.mk @@ -122,18 +122,27 @@ xtest-clean: xtest-clean-common xtest-patch: xtest-patch-common +################################################################################ +# hello_world +################################################################################ +helloworld: helloworld-common + +helloworld-clean: helloworld-clean-common + ################################################################################ # Root FS ################################################################################ .PHONY: filelist-tee -filelist-tee: xtest +filelist-tee: xtest helloworld @echo "# xtest / optee_test" > $(GEN_ROOTFS_FILELIST) @find $(OPTEE_TEST_OUT_PATH) -type f -name "xtest" | sed 's/\(.*\)/file \/bin\/xtest \1 755 0 0/g' >> $(GEN_ROOTFS_FILELIST) + @echo "file /bin/hello_world $(HELLOWORLD_PATH)/host/hello_world 755 0 0" >> $(GEN_ROOTFS_FILELIST) @echo "# TAs" >> $(GEN_ROOTFS_FILELIST) @echo "dir /lib/optee_armtz 755 0 0" >> $(GEN_ROOTFS_FILELIST) @find $(OPTEE_TEST_OUT_PATH) -name "*.ta" | \ sed 's/\(.*\)\/\(.*\)/file \/lib\/optee_armtz\/\2 \1\/\2 444 0 0/g' >> $(GEN_ROOTFS_FILELIST) - @echo "# Secure storage dig" >> $(GEN_ROOTFS_FILELIST) + @echo "file /lib/optee_armtz/8aaaf200-2450-11e4-abe20002a5d5c51b.ta $(HELLOWORLD_PATH)/ta/8aaaf200-2450-11e4-abe20002a5d5c51b.ta 444 0 0" >> $(GEN_ROOTFS_FILELIST) + @echo "# Secure storage dir" >> $(GEN_ROOTFS_FILELIST) @echo "dir /data 755 0 0" >> $(GEN_ROOTFS_FILELIST) @echo "dir /data/tee 755 0 0" >> $(GEN_ROOTFS_FILELIST) @if [ -e $(OPTEE_GENDRV_MODULE) ]; then \ diff --git a/qemu_v8.mk b/qemu_v8.mk index fd7ecb9ccdfc492fdbfa4334d0783efc71984756..ee1606ea4818b1c38563d5921f5420d60e9417fc 100644 --- a/qemu_v8.mk +++ b/qemu_v8.mk @@ -150,6 +150,13 @@ xtest-clean: xtest-clean-common xtest-patch: xtest-patch-common +################################################################################ +# hello_world +################################################################################ +helloworld: helloworld-common + +helloworld-clean: helloworld-clean-common + ################################################################################ # strace ################################################################################ @@ -172,13 +179,15 @@ endif # Root FS ################################################################################ .PHONY: filelist-tee -filelist-tee: xtest +filelist-tee: xtest helloworld @echo "# xtest / optee_test" > $(GEN_ROOTFS_FILELIST) @find $(OPTEE_TEST_OUT_PATH) -type f -name "xtest" | sed 's/\(.*\)/file \/bin\/xtest \1 755 0 0/g' >> $(GEN_ROOTFS_FILELIST) + @echo "file /bin/hello_world $(HELLOWORLD_PATH)/host/hello_world 755 0 0" >> $(GEN_ROOTFS_FILELIST) @echo "# TAs" >> $(GEN_ROOTFS_FILELIST) @echo "dir /lib/optee_armtz 755 0 0" >> $(GEN_ROOTFS_FILELIST) @find $(OPTEE_TEST_OUT_PATH) -name "*.ta" | \ sed 's/\(.*\)\/\(.*\)/file \/lib\/optee_armtz\/\2 \1\/\2 444 0 0/g' >> $(GEN_ROOTFS_FILELIST) + @echo "file /lib/optee_armtz/8aaaf200-2450-11e4-abe20002a5d5c51b.ta $(HELLOWORLD_PATH)/ta/8aaaf200-2450-11e4-abe20002a5d5c51b.ta 444 0 0" >> $(GEN_ROOTFS_FILELIST) @echo "# Secure storage dir" >> $(GEN_ROOTFS_FILELIST) @echo "dir /data 755 0 0" >> $(GEN_ROOTFS_FILELIST) @echo "dir /data/tee 755 0 0" >> $(GEN_ROOTFS_FILELIST)