FVP下载编译教程

OP-TEE下载

optee的下载可以通过repo下载或者可以自己在github 上面直接下载压缩包然后解压到目录下就可以了.

下载步骤:

方法一:

1.mkdir op-tee
2.cd op-tee
3.curl https://storage.googleapis.com/git-repo-downloads/repo > ./repo1 
4.chmod a+x ./repo1
5../repo1 init -u https://github.com/OP-TEE/manifest.git
6../repo1 sync 

下载完成后会有以下文件夹:(可能会有点出入,因为我的已经编译了)

build optee_benchmark  optee_examples  optee_test  out-br  repo1 toolchains 
u-boot buildroot linux optee_client     optee_os   out   qemu    soc_term
trusted-firmware-a

这个curl的时候我第一次可以,然而第二次就不行了,我也不知道是为什么

方法二:
选择清华源下载

1.curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
2.chmod +x repo
3.repo init -u https://github.com/OP-TEE/manifest.git -m default.xml -b 3.6 --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo
4.repo sync

这个是看别的文章的,可以参考一下,
op-tee下载

编译

第一步:获取编译工具链

1.cd build 
2.make -f toolchain.mk 

这个编译一般不会有什么问题的,很容易就编译过去了

第二步:下载FVP虚拟平台
方法一:在官网的平台上面下载

https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms

要先注册账号,然后选择ARM V8 我记得好像是没有的,所以我是方法二下载的
然后还需要个hostid
命令行下执行:ifconfig 然后HWaddr的值就是了(eth0那个是)

方法二:

https://silver.arm.com/download/download.tm?pv=2033755

下载都是需要创建账号的,原文前前往
FVP下载

下载完成之后记得把解压出来的文件夹移到op-tee目录下
如果文件名不是Foundation_Platformpkg需要把文件名改为这个名字

第三步:下载edk2 和 edk2-platforms

git clone git://github.com/tianocore/edk2.git
git clone https://github.com/tianocore/edk2-platforms.git

下载后解压到目录op-tee下面,然后需要编译

1. cd edk2
2. make -C BaseTools
3. . edksetup.sh
4. vim Conf/target.txt
将ACTIVE_PLATFORM = Nt32Pkg/Nt32Pkg.dsc 改为 ACTIVE_PLATFORM = MdeModulePkg/MdeModulePkg.dsc
将TOOL_CHAIN_TAG = MYTOOLS 改为 TOOL_CHAIN_TAG = GCC46
将TARGET_ARCH = IA32 改为 TARGET_ARCH = X64
5. export WORKSPACE=你文件的放置目录/edk2
6. build -p $WORKSPACE/EmulatorPkg/EmulatorPkg.dsc -a X64 -b DEBUG -t GCC5 -D BUILD_64 -D UNIX_SEC_BUILD -n 3 

我编译的时候会发生错误

gcc: error: brotli/c/tools/brotli.o: No such file or directory
gcc: error: brotli/c/common/dictionary.o: No such file or directory
gcc: error: brotli/c/common/transform.o: No such file or directory
gcc: error: brotli/c/dec/bit_reader.o: No such file or directory
gcc: error: brotli/c/dec/decode.o: No such file or directory
gcc: error: brotli/c/dec/huffman.o: No such file or directory
gcc: error: brotli/c/dec/state.o: No such file or directory
gcc: error: brotli/c/enc/backward_references.o: No such file or directory
gcc: error: brotli/c/enc/backward_references_hq.o: No such file or directory

原因是不知道为什么brotli文件夹clone下来是空的,所以编译不成功,然后我单个下载下来就好了.

第四步: 编译基于FVP的OP-TEE
编译基于FVP的OP-TEE的时候比较容易出现问题的,特别是Python的环境没有配置好的话,所以建议先执行以下程序:

pip install pycrypto
pip install pyelftools
pip install pycryptodomex

然后执行一下程序:

cd build
make -f fvp.mk
make run

出现以下三个界面:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
其中:
54321是TEE调试窗口
54320是REE调试窗口

然后在qemu窗口按下:c
回车,恢复一下链接,之后三个窗口变为
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
然后REE窗口选择登录方式:test或者是root,
OP-TEE代码里面有一个已经自动编译生成的代码的了,在REE窗口输入

optee_example_hello_world

就会看到你的REE窗口输出:
在这里插入图片描述
这个可能不同的op-tee代码是不一样的,需要看
optee/optee_examples/hello_world/host里面的Makefile文件;BINARY后面的那个就是了

记录一些编译fvp的时候出现的错误.
①错误一:
make[1]: Leaving directory ‘/home/meizu/project/optee/trusted-firmware-a’
make -C /home/meizu/project/optee/build/…/linux LOCALVERSION= CROSS_COMPILE="/usr/bin/ccache /home/meizu/project/optee/build/…/toolchains/aarch64/bin/aarch64-linux-gnu-" ARCH=arm64
make[1]: Entering directory ‘/home/meizu/project/optee/linux’
16:09:53.266252 git.c:439 trace: built-in: git config --get svn-remote.svn.url
CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
CHK include/generated/compile.h
Building modules, stage 2.
MODPOST 541 modules
make[1]: Leaving directory ‘/home/meizu/project/optee/linux’
make: *** No rule to make target ‘你的文件的路径/optee/build/…/grub/configure.ac’, needed by ‘/home/meizu/project/optee/build/…/grub/configure’. Stop.

产生错误的原因:linux kernel编译需要指定config文件

解决办法:
config文件放在:linux/arch/arm64/configs
根据错误执行

make defconfig CROSS_COMPILE="/usr/bin/ccache 你的错误的路径/…/toolchains/aarch64/bin/aarch64-linux-gnu-" ARCH=arm64

②错误二:
/bin/sh: 1: iasl: not found
解决办法:执行

sudo apt install iasl

③错误三:
make: *** No rule to make target ‘/project/optee/build/…/grub/configure.ac’, needed by ‘/project/optee/build/…/grub/configure’. Stop.
解决办法:
将,/project/optee/linux/tools/usb/usbip/Makefile.am
dist_man_MANS := $(addprefix doc/, usbip.8 usbipd.8)改为
dist_man_MANS := $(addprefix doc/,
usbip.8 usbipd.8)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值