Skip to main content
Zondax Github LinkZondax Github Link
Theme SwitchTheme Switch

Running Qemu

This section describes the tools that we include in this project to facilitate the development and testing of applications that should be compiled for any of the supported targets.

Clone the repo

First of all, we need to clone the images repo en cd into it.

git clone --recursive --branch master https://github.com/Zondax/buildroot-zondax.git
cd buildroot-zondax

Build the image

To build the image, please run the following command:

make zondaxtee_qemu_defconfig; make

Run

Start the emulator:

make qemu

You will then see the "machine" booting. After a few seconds, you will see a login prompt, in development images you can use root as user and no password is set.

:::tips Tips

  • To exit qemu, you can use CTRL+A X
  • If you want to get access to the TEE console, you can use telnet 127.0.0.1 54321 :::

once you login, you can run your app (hello-rustee) and see the outputs both in REE and TEE

REE

# hello-rustee
Requesting session
running client service
Clossing session#

TEE

> telnet 127.0.0.1 54321
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
D/TA: TA_CreateEntryPoint:8 Create entry point
Creating
D/TA: TA_OpenSessionEntryPoint:21 Open Session entry point
Opening session
D/TA: TA_InvokeCommandEntryPoint:35 Invoke Command entry point
Invoked command
D/TA: TA_CloseSessionEntryPoint:27 Close Session entry point
Closing session
D/TA: TA_DestroyEntryPoint:14 Destroy entry point
Destroying

Applying changes

You can find the source code of the demo app in external/hello-rustee (git submodule pointing to the repository)

In this example, please edit a file, for instance:

vim external/hello-rustee/TEE/lib/src/optee.rs

Look for the line trace!("Invoked command.."); and replace that with trace!("Hi!!!!");

If you modify the source code, there are some handy make targets that help rebuilding specific packages:

make hellorustee-dirclean; make hellorustee-build; make hellorustee-install
make

These are applicable to any package, i.e. make {PACKAGE}-build would work

Now you can run qemu again, and test hello-rustee and you will see your changes appearing! 🎉🎉🎉

The next section will provide a brief overview of Hello-Rustee 😎