Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to execute this example on QEMU #4

Open
MALATTAR opened this issue May 29, 2015 · 13 comments
Open

How to execute this example on QEMU #4

MALATTAR opened this issue May 29, 2015 · 13 comments

Comments

@MALATTAR
Copy link

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

@jenswi-linaro
Copy link
Owner

Hi,

I believe the question is answered in #3

Regards,
Jens

@MALATTAR
Copy link
Author

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

@jenswi-linaro
Copy link
Owner

Sorry, you compile it on the host machine.

@MALATTAR
Copy link
Author

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

@jenswi-linaro
Copy link
Owner

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

@MALATTAR
Copy link
Author

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 !!!

@jenswi-linaro
Copy link
Owner

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

@MALATTAR
Copy link
Author

MALATTAR commented Jun 1, 2015

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
Copy link
Author

MALATTAR commented Jun 1, 2015

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 !

@ningzhenyu
Copy link

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.

@MALATTAR MALATTAR reopened this Jan 19, 2016
@saurabhsamanta
Copy link

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

@vchong
Copy link
Contributor

vchong commented May 9, 2018

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.

@saurabhsamanta
Copy link

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants