Commit b3532883 authored by Dan's avatar Dan
Browse files

Initial commit

parents
The first thing to make sure is that you have the latest version of repo, as older versions might not work.
Follow the instructions from: https://source.android.com/setup/build/downloading#installing-repo
It is necessary to clone the `3.3.0` branch.
`python repo init -u https://github.com/OP-TEE/manifest.git -b 3.3.0`
If you wish to build the project with QEMU v8 for Aarch64 support, I have included the required modified manifest `qemu_v8.xml`, this is for QEMU v8 with the 3.3.0 versions of sources. The remote version does not have the correct version for the core OP-TEE repos and will not work.
Pass this local manifest file using `python repo init -m qemu_v8.xml"
Clone the `optee_fuzzer` project from https://github.com/Riscure/optee_fuzzer into the build directory. However it expects the directory name to be `afl-tee`, so you can run `cp -r optee_fuzzer afl-tee`.
Next, apply `build.diff` and `optee_client.diff` patches from `optee_fuzzer`, and use the `optee_os.diff` which I have provided and modified from the original.
Git apply may not work so it is necessary to manually apply the patches.
Inside the OP-TEE build directory:
`patch -p1 < ../optee_os.diff` # Do not use the optee_os.diff from `optee_fuzzer`
`patch -p1 < ../optee_fuzzer/build.diff`
`patch -p1 < ../optee_fuzzer/optee_client.diff`
Finally we can build using:
```
cd build
make edk2 linux soc-term buildroot qemu
make run
```
I have also included `run.sh`, these include instructions to execute inside QEMU.
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="github" fetch="https://github.com" />
<default remote="github" revision="master" />
<!-- OP-TEE gits -->
<project path="optee_client" name="OP-TEE/optee_client.git" revision="refs/tags/3.3.0" clone-depth="1" />
<project path="optee_os" name="OP-TEE/optee_os.git" revision="refs/tags/3.3.0" clone-depth="1" />
<project path="optee_test" name="OP-TEE/optee_test.git" revision="refs/tags/3.3.0" clone-depth="1" />
<project path="build" name="OP-TEE/build.git" revision="refs/tags/3.3.0" clone-depth="1">
<linkfile src="qemu_v8.mk" dest="build/Makefile" />
<linkfile src="../toolchains/aarch64/bin/aarch64-linux-gnu-gdb" dest="build/gdb" />
</project>
<!-- linaro-swg gits -->
<project path="linux" name="linaro-swg/linux.git" revision="75065d7a22b08115477ae75b42139c5336e28293" />
<project path="optee_benchmark" name="linaro-swg/optee_benchmark.git" revision="refs/tags/3.3.0" clone-depth="1"/>
<project path="optee_examples" name="linaro-swg/optee_examples.git" revision="refs/tags/3.3.0" clone-depth="1" />
<project path="soc_term" name="linaro-swg/soc_term.git" revision="5493a6e7c264536f5ca63fe7511e5eed991e4f20" />
<!-- Misc gits -->
<project path="arm-trusted-firmware" name="ARM-software/arm-trusted-firmware.git" revision="refs/tags/v1.5-rc2" clone-depth="1" />
<project path="edk2" name="tianocore/edk2.git" revision="dd4cae4d82c7477273f3da455084844db5cca0c0" />
<project path="qemu" name="qemu/qemu.git" revision="refs/tags/v2.12.0" clone-depth="1" />
<project path="buildroot" name="buildroot/buildroot.git" revision="refs/tags/2018.08" clone-depth="1" />
</manifest>
# Mount the shared folder
mkdir -p /mnt/host
mount -t 9p -o trans=virtio host /mnt/host
# Invoking the example usage command
LD_LIBRARY_PATH=/mnt/host/optee_client/out/libteec/ AFL_POST_LIBRARY=/mnt/host/afl-tee/out/afl_validate.so /mnt/host/afl/afl-fuzz -i /mnt/host/afl/seeds -t 300+ -o /tmp/state -M $1 -- /mnt/host/afl-tee/ca/tee_invoke_svc
Open-TEE successfully builds on Ubuntu 18.04 using the autotools build path.
Follow the instructions here:
http://open-tee.github.io/documentation/#autotools
However when the makefiles have been generated after running `../autogen.sh`, it was necessary for me to change `-rdynamic` to `--export-dynamic` in all generated makefiles due to my compiler.
It also may be necessary to use `-export-dynamic` instead, using only one dash.
While Open-TEE works successfully on 18.04, there are issues running the engine on 20.10.
Specifically the `tee_launcher` process is not created as expected in `emulator/opentee-main/main.c`
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment