MTK方案下tee.img的打包方式的详细拆解

快速链接:
.
👉👉👉 个人博客笔记导读目录(全部) 👈👈👈

在MTK手机方案中,有一个tee分区,对应的tee.img,它是由ATF Image和TEE Image拼在一起而来的.
那么它是怎么拼的呢?步骤:

  • 制作tee.img,需要ATF image 和 mt6761_microtrust_release_pad.img
  • 制作mt6761_microtrust_release_pad.img, 需要mt6761_microtrust_release_pad.txt 和 mt6761_microtrust.img
  • mt6761_microtrust_release_pad.txt,是根据tee image以及几个宏变量的配置而生成的一个头部信息
  • mt6761_microtrust.img,由teei.raw重命名而来

下列精简了MTK代码,是一个简易的makefile,诠释了tee.img的制作过程

atfimage=~/code/r0-truck/out_vnd/target/product/PROJECT/obj/ETC/atf_teeid.img_intermediates/ATF/bin/mt6761_atf.img
teeiraw=~/code/r0-truck/vendor/mediatek/proprietary/trustzone/microtrust/source/common/300/teei/launched_with_q/teei.raw

.PHONY:tee.img
tee.img:$(atfimage) mt6761_microtrust_release_pad.img
	@echo "Trustzone build: $@ <= $^"
	$(hide) cat $^ > $@

mt6761_microtrust_release_pad.img:mt6761_microtrust_release_pad.txt mt6761_microtrust.img
	@echo Microtrust build: $@
	$(hide) cat $^ > $@
	

ALIGNMENT := 512
MKIMAGE_HDR_SIZE := 512
RSA_SIGN_HDR_SIZE := 576
mt6761_microtrust_release_pad.txt:teei.raw
	$(hide) FILE_SIZE=$$(($$(wc -c < "$<")+$(MKIMAGE_HDR_SIZE)+$(RSA_SIGN_HDR_SIZE)));\
	REMAINDER=$$(($${FILE_SIZE} % $(ALIGNMENT)));\
	if [ $${REMAINDER} -ne 0 ]; then dd if=/dev/zero of=$@ bs=$$(($(ALIGNMENT)-$${REMAINDER})) count=1; else touch $@; fi

mt6761_microtrust.img:teei.raw
	cp $(teeiraw) mt6761_microtrust.img

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

代码改变世界ctw

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值