• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Development Notes
2
3*    First get [repo_pull.py and gerrit.py](https://android.googlesource.com/platform/development/+/master/tools/repo_pull/) from aosp.
4
5*    Although this repo is not currently in Trusty’s manifest, it’s sufficient to copy these two python scripts to the root of the Trusty project and run them from there. Make sure to follow the [repo_pull installation](https://android.googlesource.com/platform/development/+/master/tools/repo_pull/#installation) steps if necessary.
6
7## Build
8
9Build Android:
10
11```sh
12source build/envsetup.sh
13lunch qemu_trusty_arm64-userdebug
14m
15```
16
17Build Trusty:
18
19```sh
20./trusty/vendor/google/aosp/scripts/build.py qemu-generic-arm64-test-debug --skip-tests 2>stderr.log
21```
22
23## Trusty PORT_TEST
24
25On QEmu:
26
27```sh
28./build-root/build-qemu-generic-arm64-test-debug/run --headless --boot-test "com.android.trusty.stats.test" --verbose
29```
30
31On device: (Build for your device's debug target on both Adroid and Trusty)
32
33```sh
34/vendor/bin/trusty-ut-ctrl -D /dev/trusty-ipc-dev0 "com.android.trusty.stats.test"
35```
36
37On device, in a loop:
38
39```sh
40cat << 'EOF' > metrics.sh
41#!/system/bin/sh
42TIMES=${1:-0}
43X=0
44while [ "$TIMES" -eq 0 -o "$TIMES" -gt "$X" ]
45do
46  echo "######################## stats.test $X " $(( X++ ));
47  /vendor/bin/trusty-ut-ctrl -D /dev/trusty-ipc-dev0 "com.android.trusty.stats.test"
48done
49EOF
50
51adb wait-for-device
52adb push metrics.sh /data/user/test/metrics.sh
53adb shell sh /data/user/test/metrics.sh
54```
55
56## Android Native Test
57
58On QEmu:
59
60```sh
61./build-root/build-qemu-generic-arm64-test-debug/run --headless --android $ANDROID_PROJECT_ROOT --shell-command "/data/nativetest64/vendor/trusty_stats_test/trusty_stats_test" --verbose
62```
63
64On device: (Build for your device's debug target on both Adroid and Trusty)
65
66```sh
67/data/nativetest64/vendor/trusty_stats_test/trusty_stats_test
68```
69
70On device, in a loop:
71
72```sh
73cat << 'EOF' > metrics-nw.sh
74#!/system/bin/sh
75TIMES=${1:-0}
76X=0
77while [ "$TIMES" -eq 0 -o "$TIMES" -gt "$X" ]
78do
79  echo "######################## stats.test $X " $(( X++ ));
80  /data/nativetest64/vendor/trusty_stats_test/trusty_stats_test
81done
82EOF
83
84adb wait-for-device
85adb push metrics.sh /data/user/test/metrics-nw.sh
86adb shell sh /data/user/test/metrics-nw.sh
87```
88
89## Trusty Backtrace analysis
90
91
92```
93$ export A2L=./prebuilts/clang/host/linux-x86/llvm-binutils-stable/llvm-addr2line
94$ export OD=./prebuilts/clang/host/linux-x86/llvm-binutils-stable/llvm-objdump
95$ $OD -d -C build-root/build-qemu-generic-arm64-test-debug/user_tasks/trusty/user/base/app/metrics/metrics.syms.elf > objdump.lst
96$ $A2L -e build-root/build-qemu-generic-arm64-test-debug/user_tasks/trusty/user/base/app/metrics/metrics.syms.elf 0xe5104
97```
98