1.对tf-a源码进行解压
$> tar xfz tf-a-stm32mp-2.2.r2-r0.tar.gz
2.打补丁
进入/home/ubuntu/FSMP1A/tf-a-stm32mp-2.2.r2-r0/tf-a-stm32mp-2.2.r2-r0/tf-a-stm32mp-2.2.r2目录
执行
for p in `ls -1 ../../*.patch`; do patch -p1 < $p; done
3.配置工具链
1)进入/home/ubuntu/FSMP1A/tf-a-stm32mp-2.2.r2-r0目录
2)打开Makefile.sdk文件搜索CROSS_COMPILE
将CROSS_COMPILE后第一段内容更改为arm-linux-gnueabihf-
4.复制设备树
执行
1)cp fdts/stm32mp15xx-dkx.dtsi fdts/stm32mp15xx-fsmp1x.dtsi
2)cp fdts/stm32mp157a-dk1.dts fdts/stm32mp157a-fsmp1a.dts
3)修改上上层目录下的 Makefile.sdk 编译脚本在 TFA_DEVICETREE 配置项中添加 stm32mp157a-fsmp1a
TFA_DEVICETREE ?= stm32mp157a-fsmp1a stm32mp157a-dk1 stm32mp157d-dk1 stm32
mp157c-dk2 stm32mp157f-dk2 stm32mp157c-ed1 stm32mp157f-ed1 stm32mp157a-ev1 stm32m
p157c-ev1 stm32mp157d-ev1 stm32mp157f-ev1
4)修改 fdts/stm32mp157a-fsmp1a.dts 将
#include "stm32mp15xx-dkx.dtsi"
修改为
#include "stm32mp15xx-fsmp1x.dtsi"
5.编译源码
进入/home/ubuntu/FSMP1A/tf-a-stm32mp-2.2.r2-r0/tf-a-stm32mp-2.2.r2-r0/tf-a-stm32mp-2.2.r2目录
执行
make -f $PWD/../../Makefile.sdk TFA_DEVICETREE=stm32mp157a-fsmp1a TF_A_CONFIG=trusted ELF_DEBUG_ENABLE='1' all
6.移动镜像文件
将/home/ubuntu/FSMP1A/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/u-boot-stm32mp-v2020.10-stm32mp-r2目录下的u-boot-stm32mp157a-fspm1a-trusted.stm32文件移动到/home/ubuntu/FSMP1A/tf-a-stm32mp-2.2.r2-r0/tf-a-stm32mp-2.2.r2-r0/build/trusted目录
cp /home/ubuntu/FSMP1A/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/u-boot-stm32mp-v2020.10-stm32mp-r2/u-boot-stm32mp157a-fspm1a-trusted.stm32 /home/ubuntu/FSMP1A/tf-a-stm32mp-2.2.r2-r0/tf-a-stm32mp-2.2.r2-r0/build/trusted
7.固件烧写
1)进入/home/ubuntu/FSMP1A/tf-a-stm32mp-2.2.r2-r0/tf-a-stm32mp-2.2.r2-r0/build/trusted目录
执行
2)sudo dd if=tf-a-stm32mp157a-fsmp1a-trusted.stm32 of=/dev/sdb1 conv=fdatasync
3)sudo dd if=tf-a-stm32mp157a-fsmp1a-trusted.stm32 of=/dev/sdb2 conv=fdatasync
4) sudo dd if=u-boot-stm32mp157a-fsmp1a-trusted.stm32 of=/dev/sdb3 conv=fdatasync