Image Layout
需要 2 個 CSF 二進製文件,每個驗證階段一個:
- 引導 ROM 用於驗證 SPL + DDR FW 的CSF SPL
- SPL(通過 HAB API)用來驗證 FIT 組件的CSF FIT
First, i.MX Boot ROM reads the eFuses to determine the security configuration of the SoC and the type of the boot device.
The ROM then loads the SPL image into the OCRAM memory along with the DDR training binaries. Next it verifies the authenticity of the SPL code both in flash and memory against the signature embedded in the binary (CSF).
That is the first stage verification. If it fails, execution is not allowed to leave the ROM for securely configured SoCs, also called “closed” devices.
However, with an “open” device, you will be able to see HAB events which will tell you if the image would pass the authentication process.
If it succeeds (or if the device is open), the Boot ROM executes the HDMI/DP Firmware first which in turn jumps to SPL. For other i.MX8M processors, there’s no such firmware so it goes straight to SPL.
SPL initializes the clocks, PMIC, (LP)DDR4 and UART. Then it is able to load and verify the rest of the components using the HAB APIs to extend the root of trust
A FIT image (see here for details) is used to package all those components which are:
- U-Boot binary + device tree blob (dtb)
- ARM Trusted Firmware (ATF)
- OP-TEE binary (TrustZone, optional, not covered in this blog post)
Finally, if that second stage verification succeeds, ATF is executed which will in turn execute U-Boot.
The root of trust can be extended again at U-Boot level to authenticate Kernel and M4 images.
原文链接:https://boundarydevices.com/high-assurance-boot-hab-i-mx8m-edition/
========================================================================
i.MX8M系列bootloader镜像flash.bin所需的文件:
- U-Boot:
u-boot-nodtb.bin
u-boot-spl.bin
U-Boot DTB file (e.g. fsl-imx8mq-evk.dtb)
- ATF image:
bl31.bin
- DDR firmware:
lpddr4_pmu_train_1d_dmem.bin
lpddr4_pmu_train_1d_imem.bin
lpddr4_pmu_train_2d_dmem.bin
lpddr4_pmu_train_2d_imem.bin
- HDMI firmware (Only in i.MX8M):
signed_hdmi_imx8m.bin
- DisplayPort firmware (Only in i.MX8M):
signed_dp_imx8m.bin
- OP-TEE (Optional):
tee.bin
i.mx8m系列的启动流程如下,fit image被烧录进系统,
1.系统上电时,ROM code首先加载的hdmi/dp的固件,然后加载并验证SPL 和 DDR 固件,这些images在内部 RAM 中执行并负责初始化基本功能,例如 DDR、UART、PMIC 和时钟。
2.一旦 DDR 可用,SPL 代码就会将FIT 中的images(ATF,TEE)到它们的特定执行地址,HAB API 会验证 U-Boot,ATF 和 OPTEE(可选项)。
3.SPL首先会跳转到ATF固件,验证成功后ATF会将控制权移交给optee,一旦optee初始化完成,optee就会切换到非安全世界启动uboot,再启动内核。而optee会继续驻留在内存中,为linux内核提供安全相关的服务。