apache / incubator-teaclave-trustzone-sdk

Teaclave TrustZone SDK enables safe, functional, and ergonomic development of trustlets.
https://teaclave.apache.org
Apache License 2.0
206 stars 59 forks source link

make QEMU_VIRTFS_ENABLE=y CFG_TEE_RAM_VA_SIZE=0x00300000 failed #13

Closed laurencechan closed 4 years ago

laurencechan commented 4 years ago

Hi, When I execuited the command "sudo make QEMU_VIRTFS_ENABLE=y CFG_TEE_RAM_VA_SIZE=0x00300000 failed" in path "/home/laurencechan/rust-optee-trustzone-sdk/optee-qemuv8-3.4.0/build" , but got this error message.

LINK    aarch64-softmmu/qemu-system-aarch64
make[1]: Leaving directory '/home/laurencechan/rust-optee-trustzone-sdk/optee-qemuv8-3.4.0/qemu'
make -C /home/laurencechan/rust-optee-trustzone-sdk/optee-qemuv8-3.4.0/build/../soc_term
make[1]: Entering directory '/home/laurencechan/rust-optee-trustzone-sdk/optee-qemuv8-3.4.0/soc_term'
gcc -o soc_term soc_term.o
/usr/bin/ld: soc_term.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: soc_term.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: soc_term.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: soc_term.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: soc_term.o: Relocations in generic ELF (EM: 183)
soc_term.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
Makefile:9: recipe for target 'soc_term' failed
make[1]: *** [soc_term] Error 1
make[1]: Leaving directory '/home/laurencechan/rust-optee-trustzone-sdk/optee-qemuv8-3.4.0/soc_term'
Makefile:146: recipe for target 'soc-term' failed
make: *** [soc-term] Error 2
laurencechan commented 4 years ago

Maybe I just did wrong. After I compiled all the examples, what should I do next? follow the instuction in the link? But if I do so, I will got duplicated source code of optee? I was confused. image

mssun commented 4 years ago

Seems that you failed to build QEMU. I believe there is something wrong with the dependencies. Can you use our Dockerfile as the building environment and try again.

mssun commented 4 years ago

Actually, there is a daily Travis CI job to run the code with the following steps:

https://github.com/mesalock-linux/rust-optee-trustzone-sdk/blob/master/.travis.yml

laurencechan commented 4 years ago

Seems that you failed to build QEMU. I believe there is something wrong with the dependencies. Can you use our Dockerfile as the building environment and try again.

After I finished "make examples", How should I build the QEMU? Start from the first red frame or the second? I‘ve tried both of them.The first case, it was actually a pure original optee env, It runs well with its own C demo, but not the rust ones. The second case, I encoutered the error I described above. Again, I think the doc in this page (https://github.com/mesalock-linux/rust-optee-trustzone-sdk) is not so pricise, maybe you could add the following actions to this one page, but not a link to another page with some other actions which is duplicated and unnecessary for the current case. image

laurencechan commented 4 years ago

Seems that you failed to build QEMU. I believe there is something wrong with the dependencies. Can you use our Dockerfile as the building environment and try again.

How to use your dockerfile?I did not find any docs from your project about this except a dockerfile. I just build a image from it and run a container from this image without any specified args and it will runs well?

I've tried your dockerfile but still failed.

$ sudo docker run --rm -it -v$(pwd):/rust-optee-trustzone-sdk -w /rust-optee-trustzone-sdk mesalocklinux/rust-optee-trustzone-sdk-qemuv8-ci bash -c "cd ci && ./ci.sh"
+ pushd ../tests
/rust-optee-trustzone-sdk/tests /rust-optee-trustzone-sdk/ci
+ ./test_hello_world.sh
+ rm -rf screenlog.0
+ rm -rf optee-qemuv8-3.4.0
+ rm -rf shared
+ curl http://mesalock-linux.org/assets/optee-qemuv8-3.4.0.tar.gz
+ tar zxv
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:39 --:--:--     0curl: (6) Could not resolve host: mesalock-linux.org

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now

I do have a proxy and when I use docker pull to fetch a image, It works well. image

laurencechan commented 4 years ago

I exec the container and it works well.

#sudo docker run -it -d --network host --name complie -v$(pwd):/rust-optee-trustzone-sdk -w /rust-optee-trustzone-sdk mesalocklinux/rust-optee-trustzone-sdk-qemuv8-ci:v1 /bin/bash
#sudo docker exec -it complie /bin/bash
# cd ci/
# ls
ci.sh
 ./ci.sh 
+ pushd ../tests
/rust-optee-trustzone-sdk/tests /rust-optee-trustzone-sdk/ci
+ ./test_hello_world.sh
+ rm -rf screenlog.0
+ rm -rf optee-qemuv8-3.4.0
+ rm -rf shared
+ source /root/.bashrc
++ '[' -z '' ']'
++ return
+ curl --connect-timeout 200 http://mesalock-linux.org/assets/optee-qemuv8-3.4.0.tar.gz
+ tar zxv
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0 34.1M    0 15789    0     0    970      0 10:14:54  0:00:16 10:14:38  3332optee-qemuv8-3.4.0/

But outside the container, it won't. seems wired.

$sudo docker run --rm -it --network host --dns 8.8.4.4 -v$(pwd):/rust-optee-trustzone-sdk -w /rust-optee-trustzone-sdk mesalocklinux/rust-optee-trustzone-sdk-qemuv8-ci:v1 bash -c "cd ci && ./ci.sh"
+ pushd ../tests
/rust-optee-trustzone-sdk/tests /rust-optee-trustzone-sdk/ci
+ ./test_hello_world.sh
+ rm -rf screenlog.0
+ rm -rf optee-qemuv8-3.4.0
+ rm -rf shared
+ source /root/.bashrc
++ '[' -z '' ']'
++ return
+ tar zxv
+ curl --connect-timeout 200 http://mesalock-linux.org/assets/optee-qemuv8-3.4.0.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:19 --:--:--     0curl: (6) Could not resolve host: mesalock-linux.org

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
laurencechan commented 4 years ago

Actually, there is a daily Travis CI job to run the code with the following steps:

https://github.com/mesalock-linux/rust-optee-trustzone-sdk/blob/master/.travis.yml

Hi @mssun , I still Got another question. If I use rust write a TA, is it possible to use C to write the corresponding CA?

mssun commented 4 years ago

Yes, you can use any language to write CA (same as OPTEE's client).

laurencechan commented 4 years ago

Yes, you can use any language to write CA (same as OPTEE's client).

@mssun I see, thank you~~

SimonWan commented 4 years ago

Looks like the titled issue has been resolved. Feel free to reopen the issue if it's not.