apache / incubator-teaclave-trustzone-sdk

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

Emulator example unclear #61

Closed abhath-labs closed 2 years ago

abhath-labs commented 2 years ago

Hi, I've been trying to run the example program as described here but I am confused on what to be done in this step mkdir shared && mount -t 9p -o trans=virtio host shared

Running it inside the qemu emulator results in error : Unrecognised command Running it outside results in error : No Permission

Could you pls suggest what I might be doing wrong. Thanks

DemesneGH commented 2 years ago

Hi @abhath-labs

mkdir shared && mount -t 9p -o trans=virtio host shared

should be executed inside the QEMU guest terminal (which is listening on the 54320 port).

abhath-labs commented 2 years ago
Screenshot 2022-03-08 at 11 05 44 AM

Thanks for the quick response, I tried that and get this error, to clarify I'm running this inside the docker container so I'm following the steps for the non GUI version

DemesneGH commented 2 years ago

Hi @abhath-labs It seems like the QEMU monitor terminal, not the guest terminal. Enter "c" in QEMU monitor terminal to boot up. Then you will see the guest terminal spawned by:

$ nc -l 127.0.0.1 -p 54320
abhath-labs commented 2 years ago

I see, thanks, but the emulator boot up fails for me, this is the output I'm seeing

QEMU monitor

Screenshot 2022-03-08 at 11 49 14 AM

nc -l 127.0.0.1 -p 54320

Screenshot 2022-03-08 at 11 49 28 AM

nc -l 127.0.0.1 -p 54321

Screenshot 2022-03-08 at 11 49 39 AM
DemesneGH commented 2 years ago

@abhath-labs Try to rebuild the Linux kernel image? Nothing wrong with QEMU and OP-TEE OS.

abhath-labs commented 2 years ago

Hi @DemesneGH Thankyou, rebuilding the kernel with the default options fixed the error, I chose some non-default settings which led to the kernel error. No when I try to run the command mount -t 9p -o trans=virtio host shared I get the error, mount: /home/incubator-teaclave-trustzone-sdk/optee-qemuv8-3.14.0/build/shared: permission denied.

The output in the QEMU terminal after starting it with make run-only is as follows

* QEMU is now waiting to start the execution
* Start execution with either a 'c' followed by <enter> in the QEMU console or
* attach a debugger and continue from there.
*
* To run OP-TEE tests, use the xtest command in the 'Normal World' terminal
* Enter 'xtest -h' for help.

c

The same user (sudo) is used to start the QEMU and mount, not sure why the permission denied error is occuring.

DemesneGH commented 2 years ago

Hi @abhath-labs

I get the error, mount: /home/incubator-teaclave-trustzone-sdk/optee-qemuv8-3.14.0/build/shared: permission denied.

Is that error message printed from the QEMU guest terminal (port 54320)?

The mount command should be executed inside QEMU guest, and

/home/incubator-teaclave-trustzone-sdk/optee-qemuv8-3.14.0/build/shared

that path should not exist in the QEMU guest.

abhath-labs commented 2 years ago

Is that error message printed from the QEMU guest terminal (port 54320)?

Yes, also when I run make-only and then c in terminal, the QEMU guest terminal exits, is this normal?

that path should not exist in the QEMU guest.

Not sure I understand, this directory is created just before this command right? mkdir shared && mount -t 9p -o trans=virtio host shared, are you saying it should not exist before mkdir, then you're right, it does not exist

DemesneGH commented 2 years ago

hi @abhath-labs

/home/incubator-teaclave-trustzone-sdk/optee-qemuv8-3.14.0/build/

I mean that path is probably the host path (not the guest path). I'm not sure whether the mount command was executed inside the guest.

Can you paste all the guest terminal's output here?