运行环境 ubuntu20.04
0、使能系统对i386的支持。
$ sudo dpkg --add-architecture i386
$ sudo apt-get update
1、安装依赖项
sudo apt-get install android-tools-adb android-tools-fastboot autoconf \
automake bc bison build-essential ccache cscope curl device-tree-compiler \
expect flex ftp-upload gdisk iasl libattr1-dev libcap-dev \
libfdt-dev libftdi-dev libglib2.0-dev libgmp-dev libhidapi-dev \
libmpc-dev libncurses5-dev libpixman-1-dev libssl-dev libtool make \
mtools netcat ninja-build python3-crypto \
python3-pycryptodome python3-pyelftools python3-serial \
rsync unzip uuid-dev xdg-utils xterm xz-utils zlib1g-dev
2、安装repo
我看网上一般有两种方式:
1、对于可以翻墙的用户用这种
mkdir ~/bin
vim ~/.bashrc
export PATH=~/bin:$PATH
source ~/.bashrc
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
2、不能翻墙的用这种
wget https://mirrors.tuna.tsinghua.edu.cn/git/git-repo
chmod 777 git-repo
sudo mv git-repo /usr/bin/repo
3、配置git
git config --global user.email "your email"
git config --global user.name "your name"
4、初始化repo 获取optee源码
翻墙版本
mkdir -p optee
cd optee
repo init -u https://github.com/OP-TEE/manifest.git -m qemu_v8.xml -b 3.8.0
repo sync -j4 --no-clone-bundle
不翻墙版本
repo init -u https://github.com/OP-TEE/manifest.git -m qemu_v8.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -b 3.14.0
repo sync -c -j4
5、安装交叉编译器
cd build
make -f toolchain.mk toolchains
6、编译optee源码
make -f qemu_v8.mk all -j4 //编译
make -f qemu_v8.mk run-only //运行
可能遇到的问题
解决方法:
sudo ln -s /usr/bin/python3.8 /usr/bin/python