ZHCAG72 September   2026

 

  1.   1
  2.   摘要
  3.   商标
  4. 1简介
  5. 2启动流程
    1. 2.1 SPL启动流程
      1. 2.1.1 R5 SPL
      2. 2.1.2 TF-A+OPTEE+A53 SPL
      3. 2.1.3 U-Boot
      4. 2.1.4 Linux以及用户态
    2. 2.2 SPL Falcon模式
      1. 2.2.1 实现步骤
        1. 2.2.1.1 安装Linux SDK
        2. 2.2.1.2 添加falcon脚本
        3. 2.2.1.3 编译Linux设备树
        4. 2.2.1.4 制作tispl.bin
        5. 2.2.1.5 制卡启动
    3. 2.3 从SPL替换为SBL
      1. 2.3.1 在SBL中进行Falcon启动
  6. 3启动介质
  7. 4操作系统启动优化
    1. 4.1 裁剪操作系统
      1. 4.1.1 使用预设的裁剪
      2. 4.1.2 自定义裁剪
    2. 4.2 减少log输出
  8. 5用户空间优化
    1. 5.1 使用systemd自定义启动服务
  9. 6使用init脚本最小化启动服务
  10. 7总结
  11. 8参考文献

R5 SPL

R5 SPL首先从ROM中读取启动信息,启动信息是一些基本的芯片属性;接着初始化R5F核本身,查找并初始化串口,以便于输出一些启动log,加载 System firmware,最后初始化DDR。具体代码详见链接,代码也可以通过安装LINUX SDK获得。

在LINUX SDK中,通过编译U-boot可以编译获得R5 SPL对应的镜像文件tiboot3.bin。TI的U-Boot使用设备树作为启动的最小硬件描述,确保基础外设可用,使用am62ax_evm_r5_defconfig进行配置,采用Binman作为固件镜像的打包工具,Binman通过设备树统一配置管理,k3-am62a-sk-binman.dtsi描述tiboot3镜像布局,Binman按照镜像布局打包镜像,将多个组件集合在一个或少数几个文件中。修改R5 SPL时要注意对应的设备树和defconfig。

Binman按照对应的设备树打包完的tiboot3.bin镜像文件如下图所示,整个包有一个X.509证书作为包头,其下有对应的R5 u-boot-spl.bin作为实际的R5 SPL代码,除此以外,包中还有sys-firmware(又名TIFS),TIFS被加载到片内SMS子系统中M4F_0小核。包中还包含了最小的设备树,用于描述启动所需的最小设备配置。

 tiboot3镜像打包 图 2-4 tiboot3镜像打包

在编译时,设置环境变量BINMAN_VERBOSE=3以及BINMAN_DEBUG=1可以看到对应Binman打包镜像的过程,以下Binman log中显示的打包项与设备树中描述的一致。

Pack completed after 1 pass(es)
Writing image to './custMpk.pem'
Wrote 0xcab bytes
Pack completed after 1 pass(es)
Writing image to './ti-degenerate-key.pem'
Wrote 0x21a bytes
Pack completed after 1 pass(es)
Writing image to './board-cfg.bin'
Wrote 0x1d bytes
Pack completed after 1 pass(es)
Writing image to './pm-cfg.bin'
Wrote 0x2 bytes
Pack completed after 1 pass(es)
Writing image to './rm-cfg.bin'
Wrote 0x596 bytes
Pack completed after 1 pass(es)
Writing image to './sec-cfg.bin'
Wrote 0x15d bytes
Pack completed after 1 pass(es)
Writing image to './combined-tifs-cfg.bin'
Wrote 0x674 bytes
Pack completed after 1 pass(es)
Writing image to './combined-dm-cfg.bin'
Wrote 0x5aa bytes
Pack completed after 1 pass(es)
Writing image to './combined-sysfw-cfg.bin'
Wrote 0x734 bytes
Pack completed after 1 pass(es)
Writing image to './tiboot3-am62ax-hs-evm.bin'
Wrote 0x50981 bytes
Pack completed after 1 pass(es)
Writing image to './tiboot3-am62ax-hs-fs-evm.bin'
Wrote 0x50981 bytes
Pack completed after 1 pass(es)
Writing image to './tiboot3-am62ax-gp-evm.bin'
Wrote 0x4ff64 bytes

在启动过程中,R5 SPL对应log如下:

[2025-08-05 19:53:27.057] U-Boot SPL 2024.04-ti-g29d0c23d67ee (Nov 29 2024 - 11:41:54 +0000)
[2025-08-05 19:53:27.057] SYSFW ABI: 4.0 (firmware rev 0x000a '10.1.8--v10.01.08 (Fiery Fox)')
[2025-08-05 19:53:27.120] SPL initial stack usage: 13568 bytes
[2025-08-05 19:53:27.120] Trying to boot from MMC2
[2025-08-05 19:53:27.265] Authentication passed
[2025-08-05 19:53:27.265] Authentication passed
[2025-08-05 19:53:27.281] Authentication passed
[2025-08-05 19:53:27.409] Authentication passed
[2025-08-05 19:53:27.409] Authentication passed
[2025-08-05 19:53:27.425] Starting ATF on ARM64 core...

R5 SPL流程耗时短,这部分的耗时主要来自于从启动介质往SOC内部RAM的数据搬运以及一些资源的初始化。资源初始化的部分几乎不可省略,因此提高这部分的启动速度关键在于使用快速的启动介质。