Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7e037bd authored by Andrei Homescu's avatar Andrei Homescu
Browse files

libbinder: update Trusty README

Bug: 224644083
Test: N/A
Change-Id: Ic4716ad06a834d1148e00efd11ba0ea6bcc12b26
parent 5e74d2db
Loading
Loading
Loading
Loading
+39 −33
Original line number Diff line number Diff line
# Binder for Trusty

This is the Trusty port of the libbinder library.
To build it, take the following steps:

* Check out copies of the Trusty and AOSP repositories.
* Apply the patches from the `trusty_binder` topic on both repositories.
* Build Trusty normally using `build.py`.
* Run the sample AIDL test for Trusty:
To build it, first you will need a checkout of the Trusty tree:
```shell
  $ ./build-root/.../run --headless --boot-test com.android.trusty.aidl.test
$ mkdir /path/to/trusty
$ cd /path/to/trusty
$ repo init -u https://android.googlesource.com/trusty/manifest -b master
$ repo sync -j$(nproc) -c --no-tags
```

To run the Android-Trusty IPC test, do the following:

* Build AOSP for the `qemu_trusty_arm64-userdebug` target:
After the checkout is complete, you can use the `build.py` script for both
building and testing Trusty. For a quick build without any tests, run:
```shell
  $ lunch qemu_trusty_arm64-userdebug
  $ m
$ ./trusty/vendor/google/aosp/scripts/build.py generic-arm64-test-debug
```
* In the Trusty directory, run the emulator with the newly built Android:
This will build the smaller `generic-arm64-test-debug` project which
does not run any tests.

The qemu-generic-arm64-test-debug` project includes the QEMU emulator and
a full Trusty test suite, including a set of libbinder tests.
To run the latter, use the command:
```shell
  $ ./build-root/.../run --android /path/to/aosp
$ ./trusty/vendor/google/aosp/scripts/build.py \
    --test "boot-test:com.android.trusty.binder.test" \
    qemu-generic-arm64-test-debug
```
* Using either `adb` or the shell inside the emulator itself, run the Trusty
  Binder test as root:
  ```shell
  # /data/nativetest64/vendor/trusty_binder_test/trusty_binder_test

## Building AIDL files on Trusty
To compile AIDL interfaces into Trusty libraries, include the `make/aidl.mk`
in your `rules.mk` file, e.g.:
```
LOCAL_DIR := $(GET_LOCAL_DIR)

## Running the AIDL compiler
For now, you will need to run the AIDL compiler manually to generate the C++
source code for Trusty clients and services. The general syntax is:
```shell
$ aidl --lang=cpp -o <output directory> -h <output header directory> <AIDL files...>
MODULE := $(LOCAL_DIR)

MODULE_AIDLS := \
        $(LOCAL_DIR)/IFoo.aidl \

include make/aidl.mk
```

The compiler will emit some `.cpp` files in the output directory and their
corresponding `.h` files in the header directory.
## Examples
The Trusty tree contains some sample test apps at
`trusty/user/app/sample/binder-test`.