lcu14_optee_hello_world icon indicating copy to clipboard operation
lcu14_optee_hello_world copied to clipboard

How to execute this example on QEMU

Open MALATTAR opened this issue 9 years ago • 13 comments

Hi, I run OP-TEE using QEMU where the host machine is Ubuntu 14.10 (I followed the tutorial at https://github.com/OP-TEE/optee_os). So, I have to launch 3 shells: serial_0 (Rich Os), serial_1 (Secure OS), and run_qemu.sh (the monitor if I am not wrong). Where to do the compiling? in Rich OS shell? or another shell on the host ? I would like to know what are the configuration of cross compiler/ env. variables to do?

Thanks, MALATTAR

MALATTAR avatar May 29 '15 09:05 MALATTAR

Hi,

I believe the question is answered in #3

Regards, Jens

jenswi-linaro avatar May 29 '15 09:05 jenswi-linaro

Hi Jens, In fact, I am trying to following the details in #3. But I cannot see if the compilation is done in host machine or in the normal world shell (Serial_0)?

Regards, MALATTAR

MALATTAR avatar May 29 '15 09:05 MALATTAR

Sorry, you compile it on the host machine.

jenswi-linaro avatar May 29 '15 09:05 jenswi-linaro

It is me again, I defined all theEnv. parameters correctly and I hopefully was able to launch the compiling but I affroned the following errors: make[1]: Entering directory '/home/tee/devel/qemu_optee/lcu14_optee_hello_world/ta' CC hello_world_ta.o gcc: warning: ‘-mcpu=’ is deprecated; use ‘-mtune=’ or ‘-march=’ instead gcc: error: unrecognized command line option ‘-mthumb’ gcc: error: unrecognized command line option ‘-mthumb-interwork’ gcc: error: unrecognized command line option ‘-mlong-calls’ gcc: error: unrecognized command line option ‘-mno-apcs-float’ gcc: error: unrecognized command line option ‘-mfloat-abi=soft’ gcc: error: unrecognized command line option ‘-mno-unaligned-access’

Have you any idea about the reason of this error? Is it possible that I am not using the correct gcc version (I used gcc-linaro-arm-linux-gnueabihf-4.9-2014.08_linux) ?

Regards, MALATTAR

MALATTAR avatar May 29 '15 10:05 MALATTAR

Are you using latest from https://github.com/OP-TEE/optee_os?

jenswi-linaro avatar May 29 '15 11:05 jenswi-linaro

Yes, I followed https://github.com/OP-TEE/optee_os for installation. In addition, I downloaded gcc-linaro-arm-linux-gnueabihf-4.8-2013.12_linux (the one that is mentioned in #3) and used it instead the one coming by the default installation (export PATH="${HOME}/qemu_optee/toolchains/gcc-linaro-arm-linux-gnueabihf-4.8-2013.12_linux/arm-linux-gnueabihf/bin:${PATH}").....but I still have the same errors !!!

MALATTAR avatar May 29 '15 14:05 MALATTAR

It looks like you're using the host compiler instead of the cross compiler.

jenswi-linaro avatar May 29 '15 14:05 jenswi-linaro

Hi Jens, I finally succeeded in building the TA :) As you said, the cross compiler was not correctly called. The result of comiling was 8aaaf200-2450-11e4-abe20002a5d5c51b.ta file and many others under ../ta/ folder. To launch the example, I did the following:

  • creating the folder /lib/teetz on the host
  • copying 8aaaf200-2450-11e4-abe20002a5d5c51b.ta to /lib/teetz -copying .../host/hello_world (the executable one) to /bin on the host and change its permission to 755
  • launching the normal OS (using ./serial_0.sh), the secure OS (using serial_1.sh) and then the monitor (using run_qemu.sh)
  • on the shell of the normal OS, I executed the following commands: modeprobe optee tee-supplicant & then I tried to execute: "hello_world" but the result was: "/bin/sh: hello_world: not found"

Do you have an idea about this error?

Kind regards, MALATTAR

--

MALATTAR avatar Jun 01 '15 13:06 MALATTAR

I found that I should push the TA to the normal world by modifying gen_rootfs/filelist-tee.txt and launching update_rootfs.sh ( found in https://github.com/jbech-linaro/comcast_cryptoapi_ta_example) I think the update_rootfs.sh creats the image filesystem.cpio.gz, but the run_qemu.sh, which launches qemu emulator, does not take into consideration the new updated image.

NB: I found that filesystem.cpio.gz contains the TA and the hellow-world in /lib/teetz and /bin respectively !

MALATTAR avatar Jun 01 '15 15:06 MALATTAR

Hi all, I'm trying to run this example on qemu too and I met a compile problem. I am using 64-bit ubuntu 14.04. And after running the latest OP-TEE and qemu, i am going to build this example. As #3 detailed, my $PATH now looks like this:

/home/zhenyu/toolchains/gcc-linaro-arm-linux-gnueabihf-4.9-2014.05_linux/bin:/home/zhenyu/devel/optee/toolchains/aarch64/bin:

and the other environment variables are also set. When I try to compile the example, it shows that "tee_client_api.h" cound not be found. Then I manually copied this file to the include directory of ta(I guess this is not correct). And after that, another error show as following:

/home/zhenyu/devel/optee/toolchains/aarch64/bin/../lib/gcc/aarch64-linux-gnu/4.9.1/../../../../aarch64-linux-gnu/bin/ld: cannot find -lteec collect2: error: ld returned 1 exit status

Am I using the wrong cross toolchains?

Thanks for your help.

ningzhenyu avatar Sep 12 '15 15:09 ningzhenyu

Does anyone have proper instructions to deploy and run TA examples in QEMU.

saurabhsamanta avatar May 08 '18 21:05 saurabhsamanta

This repo is outdated. Please follow instructions in https://github.com/OP-TEE/build/blob/master/docs/qemu.md. https://github.com/linaro-swg/optee_examples/tree/master/hello_world is included in the build.

vchong avatar May 09 '18 01:05 vchong

Thanks

saurabhsamanta avatar May 09 '18 12:05 saurabhsamanta