快速链接:
.
👉👉👉 个人博客笔记导读目录(全部) 👈👈👈
在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