OP-TEE / optee_docs

This git contains the official documentation for the OP-TEE project
BSD 2-Clause "Simplified" License
58 stars 96 forks source link

How to run optee_example? #12

Closed piachristel closed 5 years ago

piachristel commented 5 years ago

I have made the build of optee according to the steps on https://optee.readthedocs.io/building/gits/build.html. But for step 8, I was not sure where to execute. If I run it in the optee/build directory, I get:

xxx:~/xxx/optee/build$ ps aux | grep tee-supplicant
christi+ 10629  0.0  0.0  14432  1076 pts/4    S+   10:25   0:00 grep --color=auto tee-supplicant
xxx:~/xxx/optee/build$ tee-supplicant -d
tee-supplicant: command not found

In the optee/build directory I have then run xhost + sudo make all run

I have entered c in the qemu console. Then in the normal world console, I can run the xtest succesfully:

24045 subtests of which 0 failed
93 test cases of which 0 failed
0 test cases were skipped
TEE test application done!

But if I run hello_world in the normal world console, I get -sh: hello_world: not found

If I run c make all in the optee_examples/hello_worlddirectory, I get the following error:

make -C host CROSS_COMPILE="" --no-builtin-variables
make[1]: Entering directory '/home/christina/master-thesis/optee/optee_examples/hello_world/host'
gcc -Wall -I../ta/include -I/include -I./include -c main.c -o main.o
main.c:33:10: fatal error: tee_client_api.h: No such file or directory
 #include <tee_client_api.h>
          ^~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:28: recipe for target 'main.o' failed
make[1]: *** [main.o] Error 1
make[1]: Leaving directory '/home/christina/master-thesis/optee/optee_examples/hello_world/host'
Makefile:9: recipe for target 'all' failed
make: *** [all] Error 2

How can I correctly load the tee-supplicant? And how can I make the hello_world example run?

Thanks for help & correct me if this issue is in the wrong place!

jforissier commented 5 years ago

tee-supplicant runs on the target (QEMU terminal). The command for the "hello world" application is optee_example_hello_world.

piachristel commented 5 years ago

Thank you! I can run the examples now!

And for tee-supplicant: is it loaded automatically? Because tee-supplicant command in the QEMU terminal still gives me a unknown command: 'tee-supplicant' error.

jforissier commented 5 years ago

Yes, tee-supplicant is started by an init script. You get "command not found" because it is not in your $PATH (it is not user command). It is in /usr/sbin IIRC.

jbech-linaro commented 5 years ago

As the instructions says, if unsure whether it's loaded or not, run ps aux | grep tee-supplicant. But as also mentioned in the docs, it's started by default on almost all OP-TEE developer builds. With successful run of xtest, you can be sure that it's running as it should.

piachristel commented 5 years ago

Thank you!