👹
Carlos's Tech Blog
  • 🧔ECUs
    • ZYNQ_Documents
      • [ZYNQ] 构建ZYNQ的BSP工程
      • [ZYNQ] 启动流程
      • [ZYNQ] Secure Boot Flow
      • [ZYNQ] Provisioning Guideline
      • [ZYNQ] Decrypting Partition by the Decrypt Agent Using PUF key
      • [ZYNQ] enabling the cryptsetup on ramdisk
      • [ZYNQ] Encrypt external files based on file system using PUF key
      • [ZYNQ] Loading an Encrypted Linux kernel at U-Boot with a KUP Key
      • [ZYNQ] cross-compile the cryptsetup on Xilinx ZYNQ aarch64 platform
      • [ZYNQ] Linux Linaro系统镜像制作SD卡启动
    • S32G_Documents
      • [S32G] Going through the s32g hard/soft platform
      • [S32G] S32g247's Secure Boot using HSE firmware
        • S32g2 HSE key config
        • How S32g verify secure boot image
        • S32g secure boot signature generation
        • How to download and build S32g Secure boot image
        • [S32G] OTA with Secure Boot
    • RT117x_Documents
      • [RT-117x]IMX RT1170 Provisioning Guideline
      • [RT-117x] Going through the MX-RT1170 hard/soft platform
      • [RT-117x] i.MX-RT1170's Secure Boot
        • [RT-117x]Signing image with the HSM (SignServer)
    • LS104x_Documents
      • [LS104x] bsp project
      • [LS104x] boot flow
      • [LS104x] secure boot
      • [LS104x] Application Note, Using the PKCS#11 in TCU platform
      • [LS104x] 使用ostree更新rootfs
      • [LS104x] ostree的移植
      • [LS104x] Starting with Yocto
      • [LS104x] 使用FIT的kernel格式和initramfs
    • IMX6/8_Documents
      • [IMX6] Defining A U-Boot Command
      • NXP IMX6 嵌入式板子一些笔记
      • NXP-imx6 initialization
    • Vehicle_Apps
      • [SecOC] Tree
        • [SecOC] SecOC Freshness and MAC Truncation
  • 😾TECH
    • Rust Arm OS
      • ARMv7m_Using_The_RUST_Cross_Compiler
    • ARM
      • ARM-v7-M
        • 01_ARMv7-M_处理器架构技术综述
        • 02_ARMv7-M_编程模型与模式
        • 03_ARMv7-M_存储系统结构
        • 04_ARMv7-M_异常处理及中断处理
      • ARM-v8-A
        • 02_ARMv8_基本概念
        • 03_ARMv8_指令集介绍_加载指令集和存储指令集
        • 04_ARMv8_指令集_运算指令集
        • 05_ARMv8_指令集_跳转_比较与返回指令
        • 06_ARMv8_指令集_一些重要的指令
        • 0X_ARMv8_指令集_基于汇编的UART驱动
        • 07_ARMv8_汇编器Using as
        • 08_ARMv8_链接器和链接脚本
        • 09_ARMv8_内嵌汇编(内联汇编)Inline assembly
        • 10_ARMv8_异常处理(一) - 入口与返回、栈选择、异常向量表
        • 11_ARMv8_异常处理(二)- Legacy 中断处理
        • 12_ARMv8_异常处理(三)- GICv1/v2中断处理
        • 13_ARMv8_内存管理(一)-内存管理要素
        • 14_ARMv8_内存管理(二)-ARM的MMU设计
        • 15_ARMv8_内存管理(三)-MMU恒等映射及Linux实现
        • 16_ARMv8_高速缓存(一)cache要素
        • 17_ARMv8_高速缓存(二)ARM cache设计
        • 18_ARMv8_高速缓存(三)多核与一致性要素
        • 19_ARMv8_TLB管理(Translation Lookaside buffer)
        • 20_ARMv8_barrier(一)流水线和一致性模型
        • 21_ARMv8_barrier(二)内存屏障案例
      • ARM Boot Flow
        • 01_Embedded_ARMv7/v8 non-secure Boot Flow
        • 02_Embedded_ARMv8 ATF Secure Boot Flow (BL1/BL2/BL31)
        • 03_Embedded_ARMv8 BL33 Uboot Booting Flow
      • ARM Compiler
        • Compiler optimization and the volatile keyword
      • ARM Development
        • 在MACBOOK上搭建ARMv8架构的ARM开发环境
        • Starting with JLink debugger or QEMU
    • Linux
      • Kernel
        • 0x01_LinuxKernel_内核的启动(一)之启动前准备
        • 0x02_LinuxKernel_内核的启动(二)SMP多核处理器启动过程分析
        • 0x21_LinuxKernel_内核活动(一)之系统调用
        • 0x22_LinuxKernel_内核活动(二)中断体系结构(中断上文)
        • 0x23_LinuxKernel_内核活动(三)中断体系结构(中断下文)
        • 0x24_LinuxKernel_进程(一)进程的管理(生命周期、进程表示)
        • 0x25_LinuxKernel_进程(二)进程的调度器的实现
        • 0x26_LinuxKernel_设备驱动(一)综述与文件系统关联
        • 0x27_LinuxKernel_设备驱动(二)字符设备操作
        • 0x28_LinuxKernel_设备驱动(三)块设备操作
        • 0x29_LinuxKernel_设备驱动(四)资源与总线系统
        • 0x30_LinuxKernel_设备驱动(五)模块
        • 0x31_LinuxKernel_内存管理(一)物理页面、伙伴系统和slab分配器
        • 0x32_LinuxKernel_内存管理(二)虚拟内存管理、缺页与调试工具
        • 0x33_LinuxKernel_同步管理_原子操作_内存屏障_锁机制等
        • 01_LinuxDebug_调试理论和基础综述
      • Userspace
        • Linux-用户空间-多线程与同步
        • Linux进程之间的通信-管道(上)
        • Linux进程之间的通信-管道(下)
        • Linux进程之间的通信-信号量(System V)
        • Linux进程之间的通信-内存共享(System V)
        • Linux进程之间的通信-消息队列(System V)
        • Linux应用调试(一)方法、技巧和工具 - 综述
        • Linux应用调试(二)工具之coredump
        • Linux应用调试(三)工具之Valgrind
        • Linux机制之内存池
        • Linux机制之对象管理和引用计数(kobject/ktype/kset)
        • Linux机制copy_{to, from}_user
        • Linux设备树 - DTS语法、节点、设备树解析等
        • Linux System : Managing Linux Services - inittab & init.d
        • Linux System : Managing Linux Services - initramfs
      • Kernel Examples
        • Linux Driver - GPIO键盘驱动开发记录_OMAPL138
        • 基于OMAPL138的Linux字符驱动_GPIO驱动AD9833(一)之miscdevice和ioctl
        • 基于OMAPL138的Linux字符驱动_GPIO驱动AD9833(二)之cdev与read、write
        • 基于OMAPL138的字符驱动_GPIO驱动AD9833(三)之中断申请IRQ
        • Linux内核调用SPI驱动_实现OLED显示功能
        • Linux内核调用I2C驱动_驱动嵌套驱动方法MPU6050
    • OPTEE
      • 01_OPTEE-OS_基础之(一)功能综述、简要介绍
      • 02_OPTEE-OS_基础之(二)TrustZone和ATF功能综述、简要介绍
      • 03_OPTEE-OS_系统集成之(一)编译、实例、在QEMU上执行
      • 05_OPTEE-OS_系统集成之(三)ATF启动过程
      • 06_OPTEE-OS_系统集成之(四)OPTEE镜像启动过程
      • 07_OPTEE-OS_系统集成之(五)REE侧上层软件
      • 08_OPTEE-OS_系统集成之(六)TEE的驱动
      • 09_OPTEE-OS_内核之(一)ARM核安全态和非安全态的切换
      • 10_OPTEE-OS_内核之(二)对安全监控模式的调用的处理
      • 11_OPTEE-OS_内核之(三)中断与异常的处理
      • 12_OPTEE-OS_内核之(四)对TA请求的处理
      • 13_OPTEE-OS_内核之(五)内存和cache管理
      • 14_OPTEE-OS_内核之(六)线程管理与并发
      • 15_OPTEE-OS_内核之(七)系统调用及IPC机制
      • 16_OPTEE-OS_应用之(一)TA镜像的签名和加载
      • 17_OPTEE-OS_应用之(二)密码学算法和安全存储
      • 18_OPTEE-OS_应用之(三)可信应用的开发
      • 19_OPTEE-OS_应用之(四)安全驱动开发
      • 20_OPTEE-OS_应用之(五)终端密钥在线下发系统
    • Binary
      • 01_ELF文件_目标文件格式
      • 02_ELF文件结构_浅析内部文件结构
      • 03_ELF文件_静态链接
      • 04_ELF文件_加载进程虚拟地址空间
      • 05_ELF文件_动态链接
      • 06_Linux的动态共享库
      • 07_ELF文件_堆和栈调用惯例以ARMv8为例
      • 08_ELF文件_运行库(入口、库、多线程)
      • 09_ELF文件_基于ARMv7的Linux系统调用原理
      • 10_ELF文件_ARM的镜像文件(.bin/.hex/.s19)
    • Build
      • 01_Script_makefile_summary
    • Rust
      • 02_SYS_RUST_文件IO
    • Security
      • Crypto
        • 1.0_Security_计算机安全概述及安全需求
        • 2.0_Security_随机数(伪随机数)
        • 3.0_Security_对称密钥算法加解密
        • 3.1_Security_对称密钥算法之AES
        • 3.2_Security_对称密钥算法之MAC(CMAC/HMAC)
        • 3.3_Security_对称密钥算法之AEAD
        • 8.0_Security_pkcs7(CMS)_embedded
        • 9.0_Security_pkcs11(HSM)_embedded
      • Tools
        • Openssl EVP to implement RSA and SM2 en/dec sign/verify
        • 基于Mac Silicon M1 的OpenSSL 编译
        • How to compile mbedtls library on Linux/Mac/Windows
    • Embedded
      • eMMC启动介质
  • 😃Design
    • Secure Boot
      • JY Secure Boot Desgin
    • FOTA
      • [FOTA] Module of ECUs' FOTA unit design
        • [FOTA] Tech key point: OSTree Deployment
        • [FOTA] Tech key point: repositories role for onboard
        • [FOTA] Tech key point: metadata management
        • [FOTA] Tech key point: ECU verifying and Decrpting
        • [FOTA] Tech key point: time server
      • [FOTA] Local-OTA for Embedded Linux System
    • Provisioning
      • [X-Shield] Module of the Embedded Boards initialization
    • Report
由 GitBook 提供支持
在本页
  • 1. Boot High-Level Design
  • 1.1 Boot flow with PPA mode
  • 1.2 Boot flow with TF-A mode
  • 2. Boot Low-Level Design
  • 2.1 ATF
  • 2.2 U-Boot
  • 2.3 UEFI
  • Ref
  1. ECUs
  2. LS104x_Documents

[LS104x] boot flow

上一页[LS104x] bsp project下一页[LS104x] secure boot

最后更新于1年前

NXP-LS1046的启动流程可以分为两个stages:

  • SoC阶段(SoC init + BootROM)

  • Bootloader阶段(ATF/PPA/U-Boot)

在Bootloader阶段,也可以选择两种模式:

  • PPA模式(传统的启动方式)

  • ATF模式(采用ARM的ATF作为启动方式)

Note, 如果要使能secure boot,则需要采用ATF启动模式。

1. Boot High-Level Design

1.1 Boot flow with PPA mode

传统的启动模式(PPA mode)如图所示:

我们可以把boot flow分解为两部分:

  • SoC阶段(SoC init / BootROM)

  • Bootloader阶段(uboot)

1.1.2 SoC阶段

SoC阶段分为,SoC init和bootrom阶段。

SoC init

SoC 被释放reset之后,关于boot的主要是,从启动介质(SD/NorFLASH/eMMC)中读取RCW/PBLimage,关于RCW文件可见本小节参引部分。RCW文件主要是对SoC寄存器、外设、DDR的一些配置。SoC通过解析RCW文件,做的工作如下:

  • pin功能复用初始化;

  • 时钟参数,PLL分频初始化;

  • 加载BootROM。

Note,这部分程序是SoC内部,在流片阶段已经确定,由NXP公司开发集成,不需要做任何修改,需要用户配置的仅仅是RCW文件。

BootROM

SoC init程序把程序控制权hands off给BootROM,开始执行BootROM中的程序,BootROM此时处于ARMv8的异常等级EL3。BootROM需要完成:

  • 配置SoC的一些low-level方面的工作;

  • 加载uboot的image从存储介质中(SD/eMMC/NorFLASH);

  • 跳转uboot

Note,这部分程序是SoC内部,在流片阶段已经确定,由NXP公司开发集成,不需要做任何修改,也无法修改。。

1.1.3 bootloader阶段

bootloader阶段支持两个引导固件,一个是uboot,一个是UEFI。对于NorFLASH存储介质,BootROM无需将其加载到OCRAM(on-chip-ram)上面,支持XIP技术,直接在NorFlash上执行。对于存储在SD/EMMC介质上的程序,需要被BootROM加载到OCRAM上执行。在这个阶段需要bootloader完成:

  • DDR初始化;

  • Platform内部的一些设定;

  • ARMv8 SoC在EL3/secure world中的一些配置。

接着bootloader会从NOR flash或者SD/emmc 加载PPA image。PPA image是一种常驻固件(resident firmware),该固件运行在ARMv8的最高特权等级EL3,为bootloader和操作系统提供一些控制CPU功率,把多核复位的操作。

PPA固件会加载和执行OPTEE,接着会返回PPA固件,PPA固件最后跳回Uboot,切换到非安全模式,来启动内核。

uboot的ppa驱动在: https://github.com/u-boot/u-boot/blob/master/arch/arm/cpu/armv8/fsl-layerscape/ppa.c

1.2 Boot flow with TF-A mode

Trusted Firmware (TF-A) 是一个针对ARMv8-A架构安全世界的实现,是启动secure boot不可或缺的基础组件。TFA提供了trustzone的软件实现。TFA包含5个独立的引导阶段:

Boot stage

Exception level

Description

BL1

EL3

Boot ROM firmware. NOTE:BL1 is embedded in hardware (Boot ROM + PBL commands)

BL2

EL3

Platform initialization firmware

BL31

EL3

Resident runtime firmware

BL32

EL1S

[Optional] Trusted operating system. For example, OP-TEE

BL33

EL2

Normal world bootloader. For example, U-Boot, UEFI

简单的说,TF-A模式的 Boot ROM -> BL2 -> BL31 ->U-boot/UEFI -> Linux,具体如图所示:

1.2.1 SoC阶段

和Boot flow with PPA mode一致。但是BootROM是加载BL2的二进制文件bl2.bin到OCRAM上。

1.2.2 Bootloader阶段

在BL2阶段主要做:

  • 初始化DRAM,配置TZASC(TrustZone寄存器)

  • 验证BL31/BL32/BL33的images(在fip.bin中)是否正确,如果正确加载到DDR上。

  • BL2 hands off控制权给BL31(图中 1);

BL31阶段主要:

  • 配置EL31的异常向量表;

  • 配置安全相关的属性(TZPC:TZ保护控制器组件);

  • 提供bootloader和操作系统一些服务,比如控制多核功率和复位管理;

  • 如果使能trusted os,启动trusted os(图中 2),没有则不启动。

BL32阶段主要:

  • 初始化之后,BL32返回BL31(图中 3);

再次回到BL31阶段主要:

  • 控制权交给uboot/uefi,切换异常等级到EL2(图中 4)

再次回到BL31阶段主要:

  • 控制权交给uboot/uefi,切换异常等级到EL2,引导内核启动(图中 5)

注意,ATF模式下,DDR已经被ATF初始化,就无需Uboot对DDR重新进行初始化。从PPA模式转为ATF模式要注意此点。

2. Boot Low-Level Design

因为后续要使能secure boot,因此,只讨论ATF模式的Low Level设计和实验,关于PPA模式不做研究。本节结合flex-builder,讨论bootloader中的一些设计、配置和编译及最终的加载运行。

2.1 ATF

ATF需要注意的问题是:

  • TF-A的DDR driver的问题;

  • Flash layout的问题(可能会有);

  • 和uboot配合的问题(可能会有);

2.1.1 ddr driver

在ATF启动模式下,DDR是由ATF进行初始化的,因为ATF需要把fip.bin的image加载到DDR中。这样以来,uboot不需要进行ddr的初始化。Boot ROM -> BL2 (DDR Init) -> BL31 -> U-boot/UEFI -> Linux Kernel。 而ddr的初始化,需要在两个地方改动:

  • DDR controller

  • PHY

需要注意TFA的版本问题:

* Platforms

* TFA version

LS1012A, LS1043A, LS1046A, LS1088A, LS2088A

TFA 1.5

LX2160A Rev2, LX2162A

TFA 2.3

DDR Board参数:

* Macro

* File Path

DDRC_NUM_DIMM

Plat/nxp/<SOC>/<Board>/platform_def.h

NUM_OF_DDRC

Plat/nxp/<SOC>/<Board>/platform_def.h

参考: https://docs.nxp.com/bundle/GUID-487B2E69-BB19-42CB-AC38-7EF18C0FE3AE/page/GUID-903DCB6A-FA4B-4A1C-B29D-F75A8CDBA976.html

2.1.2 flash layout

这部分需要关注,不同的开发板或设计可能不一致,例如:

而在飞凌嵌入式的板子中,ATF和PPA模式flash空间已经划分好,各个分区已经共存:

2.1.3 uboot配合

在新版本中不存在这个问题,老版本的LSDK中存在这个问题,需要参考:

https://docs.nxp.com/bundle/GUID-9160E9B1-ADBC-4313-9837-773DA05262FB/page/GUID-FFAB4CBC-D987-474E-ABAA-A7120005FCCC.html

2.1.4 ATF的编译

ATF由两部分组成,分别是PBL和fip.bin:

  • PBL (RCW + PBL_cmd + bl2.bin)

  • fip.bin ( BL31 + BL32(optee.bin) + BL33(uboot/uefi) )

Note:

  • <platform> = ls1012ardb | ls1012afrdm | ls1012afrwy | ls1043ardb | ls1046ardb | ls1088ardb | ls2088ardb | lx2160ardb_rev2 | lx2162aqds

  • <boot_mode> = nor, nand, sd, emmc, qspi, flexspi_nor

下面的步骤是用来部署TFA的(bl2_<boot_mode>.pbl and fip.bin):

  1. Compile PBL binary from RCW source file

  2. Compile U-Boot binary

  3. [Optional] Compile OP-TEE binary

  4. Compile TF-A binaries (bl2_<boot_mode>.pbl and fip.bin)

  5. Program TF-A binaries on specific boot mode

PBL

RCW

编译 rcw_<boot_mode>.bin 二进制文件,这个文件是 bl2_<boot_mode>.pbl 二进制文件所需要的。

  1. $ git clone https://source.codeaurora.org/external/qoriq/qoriq-components/rcw

  2. $ cd rcw

  3. $ git checkout -b <new branch name> <LSDK tag>. For example, $ git checkout -b LSDK-19.03 LSDK-19.03

  4. $ cd <platform>

  5. If required, make changes to the rcw files.

  6. $ make

最后会输出文件:

bl2.bin

Clone the atf repository and compile the TF-A binaries, bl2_<boot_mode>.pbl and fip.bin.

  1. $ git clone https://source.codeaurora.org/external/qoriq/qoriq-components/atf

  2. $ cd atf

  3. $ git checkout -b <new branch name> LSDK-<LSDK version>. For example, $ git checkout -b LSDK-21.08 LSDK-21.08

  4. $ export ARCH=arm64

  5. $ export CROSS_COMPILE=aarch64-linux-gnu-

编译BL2 binary 带 OPTEE, run this command:

$ make PLAT=<platform> bl2 SPD=opteed BOOT_MODE=<boot_mode> BL32=<optee_binary> pbl RCW=<path_to_rcw_binary>/<rcw_binary_for_specific_boot_mode>

编译bl2需要的 bl2.bin and bl2_<boot_mode>.pbl在aatf/build/<platform>/release/. For any update in the BL2 source code or RCW binary, the bl2_<boot_mode>.pbl binary needs to be recompiled.

也可以不使用optee.bin生成pbl文件:

make PLAT=ls1046ardb BOOT_MODE=sd pbl RCW=../rcw/ls1046ardb/RR_FFSSPPPH_1133_5559/rcw_1800_sdboot.bin

编译的输出文件如图所示:

fip.bin

FIB二进制文件布局如下:

在ATF编译带着OPTEE,命令:

make PLAT=<platform> fip BL33=<path_to_u-boot_binary>/u-boot.bin SPD=opteed BL32=<path_to_optee_binary>/tee.bin

也可以不带OPTEE,命令:

make PLAT=<platform> fip BL33=<path_to_u-boot_binary>/u-boot.bin

2.1.5 ATF的烧录

ATF可以烧录以QSPI启动模式启动,也可以以SD/EMMC的启动模式启动。

QSPI NOR Flash

进入到uboot,的使用tftp加载数据,然后写入到NOR Flash

    1. Boot from QSPI NOR flash0

    2. Program QSPI NOR flash1: => sf probe 0:1

    3. Flash bl2_qspi.pbl:

      => tftp 0xa0000000 bl2_qspi.pbl
      => sf erase 0x0 +$filesize && sf write 0xa0000000 0x0 $filesize
    4. Flash fip.bin:

      => tftp 0xa0000000 fip.bin
      => sf erase 0x100000 +$filesize && sf write 0xa0000000 0x100000 $filesize
    5. Flash DDR FIP binary (Supported only for LX2162AQDS or LX2160ARDB Rev2):

      => tftp 0x82000000 fip_ddr_all.bin
      => sf erase 0x800000 +$filesize; sf write 0x82000000 0x800000 $filesize
    6. Boot from QSPI NOR flash1. The board will boot with TF-A

SD/eMMC Card

  1. Boot from QSPI NOR flash0.

  2. Flash bl2_sd.pbl on SD/eMMC card:

    => tftp 82000000 bl2_sd.pbl
    => mmc write 82000000 8 <blk_cnt>

    Here, blk_cnt refers to number of blocks in SD card that need to be written as per the file size. For example, when you load bl2_sd.pbl from the TFTP server, if the bytes transferred is 82809 (14379 hex), then blk_cnt is calculated as 82809/512 = 161 (A1 hex). For this example, mmc write command will be: => mmc write 82000000 8 A1.

  3. Flash fip.bin on SD/eMMC card

    => tftp 82000000 fip.bin
    => mmc write 82000000 800 <blk_cnt>

    Here, blk_cnt refers to number of blocks in SD card that need to be written as per the file size. For example, when you load fip.bin from the TFTP server, if the bytes transferred is 1077157 (106fa5 hex) , then blk_cnt is calculated as1077157/512 = 2103 (837 hex) . For this example, mmc write command will be: => mmc write 82000000 800 837.

  4. Flash DDR FIP binary (Supported only for LX2162AQDS or LX2160ARDB Rev2):

    => tftp 82000000 fip_ddr_all.bin
    => mmc write 82000000 0x04000 <blk_cnt>

    Here, blk_cnt refers to number of blocks in SD card that need to be written as per the file size.

  5. Boot from SD card. The board will boot with TF-A.

2.2 U-Boot

2.2.1 需要在uboot上做的调整

  • 在TF-A的启动流程,DDR不需要再被uboot初始化,而是被ATF进行初始化,DDR的初始化程序可以被加入到<atf_dir>/plat/nxp/soc-<soc-name>/<soc-name>ardb/ddr_init.c 。DDR驱动可以被找到在<atf_dir>/plat/nxp/drivers/ddr

  • 任何内部状态的初始化都可以加入到soc.c在<atf_dir>/plat/nxp/soc-<soc-name>/

  • defconfig文件,格式应该是:<platform>_tfa_defconfig. For example, for LX1046ARDB Rev2, defconfig needs to be used is lx1046ardb_tfa_defconfig

  • TF-A的defconfig被创建主要修改:

    • PPA模式 disable

    • 启动环境支持 sd boot或者Flex SPI

  • 一些其他的改变:

    • Boot command改变支持autoboot:

      • XSPI_NOR_BOOTCOMMAND

      • SD_BOOTCOMMAND

    • MC init命令改变:

      • XSPI_MC_INIT_CMD

      • SD_MC_INIT_CMD

2.2.2 编译uboot

boot.bin文件被fip.bin所依赖:

  1. $ git clone https://source.codeaurora.org/external/qoriq/qoriq-components/u-boot.git

  2. $ cd u-boot

  3. $ git checkout -b <new branch name> LSDK-<LSDK version>. For example, $ git checkout -b LSDK-21.08 LSDK-21.08

  4. $ export ARCH=arm64

  5. $ export CROSS_COMPILE=aarch64-linux-gnu-

  6. $ make distclean

  7. $ make <platform>_tfa_defconfig

  8. $ make

2.2.3 编译secure uboot

和上面的区别在于,$ make <platform>_tfa_defconfig 和 $ make <platform>_tfa_SECURE_BOOT_defconfig 配置文件不同。

You need to compile the u-boot.bin binary to build the fip.bin binary. Clone the u-boot repository and compile the U-Boot binary for TF-A.

  1. $ git clone https://source.codeaurora.org/external/qoriq/qoriq-components/u-boot.git

  2. $ cd u-boot

  3. $ git checkout -b <new branch name> <tag>. For example, $ git checkout -b LSDK-21.08 LSDK-21.08

  4. $ export ARCH=arm64

  5. $ export CROSS_COMPILE=aarch64-linux-gnu-

  6. $ make distclean

  7. $ make <platform>_tfa_SECURE_BOOT_defconfig

  8. $ make

NOTE:If the make command shows the error "*** Your GCC is older than 6.0 and is not supported", ensure that you are using Ubuntu 18.04 64-bit version for building 21.08 U-Boot binary.

The compiled secure U-Boot image, u-boot.bin-tfa-secure-boot, is available at u-boot/.

2.3 UEFI

Ref

PPA引导模式的layout:

ATF引导模式的layout:

🧔
02_OPTEE-OS_基础之(二)TrustZone和ATF功能综述、简要介绍