“STM32MP15 TF-A”的版本间的差异

来自百问网嵌入式Linux wiki
(创建页面,内容为“== Article Purpose == This section details the process used to build TF-A from sources and to deploy it on your target.<br> The build example is based on the OpenSTL…”)
 
 
(未显示同一用户的1个中间版本)
第1行: 第1行:
 
== Article Purpose ==
 
== Article Purpose ==
This section details the process used to build TF-A from sources and to deploy it on your target.<br>
+
本节详细介绍了从源构建TF-A并将其部署到目标上的过程。<br>
The build example is based on the OpenSTLinux environment:
+
构建示例基于OpenSTLinux环境:
* Developer Package
+
* 开发人员包
* Distribution Package
+
* 程序的发行包
  
 
== Overview ==
 
== Overview ==
TF-A is the FSBL for the ST trusted boot chain. It must be configured or updated depending on your platform.<br>
+
TF-A是ST受信任引导链的FSBL。它必须根据您的平台进行配置或更新。<br>
 
<br>
 
<br>
Cross compilation of TF-A is only required if it is to be modified. By default, in the Starter Package, the TF-A image is named: tf-<board>-trusted.stm32.<br>
+
TF-A的交叉编译仅在需要修改时才需要。 默认情况下,在入门包中,TF-A映像的名称为:
In changes are made, you must rebuild TF-A and update all the FSBL partitions of your boot device with this new image. A second FSBL image is used as a backup image.
+
tf-<board>-trusted.stm32.<br>
 +
进行更改后,您必须重建TF-A并使用此新映像更新引导设备的所有FSBL分区。 第二个FSBL映像用作备用映像。
 
<br>
 
<br>
  
The build process creates a full STM32 image that can be used for Flash integrating a specific [[STM32MP15 secure boot#STM32_Header|header]].<br>
+
构建过程将创建完整的STM32映像,该映像可用于Flash集成特定的[[STM32MP15 secure boot#STM32_Header|header]].<br>
This trusted firmware-A image contains a device tree, a BL2 and a BL32 stage.<br>
+
 
These binaries are built in a single step during the build process.
+
此受信任的固件-A映像包含设备树,BL2和BL32级。<br>
 +
这些二进制文件是在构建过程中一步完成的。
 
[[File:Atf.stm32.png|300px|center|link=]]
 
[[File:Atf.stm32.png|300px|center|link=]]
 
<br>
 
<br>
第20行: 第22行:
 
== Developer Package ==
 
== Developer Package ==
 
=== Install sources ===
 
=== Install sources ===
The Developer Package contains OpenSTLinux and TF-A sources:
+
开发包包含OpenSTLinux和TF-A源:
 
[[STM32MP1_Developer_Package#Installing the TF-A|TF-A Installation]]
 
[[STM32MP1_Developer_Package#Installing the TF-A|TF-A Installation]]
  
 
=== Official source tree ===
 
=== Official source tree ===
{{Warning|The STM32MP1 platform is not yet fully upstreamed. So features are not available from this repository}}
+
{{Warning|STM32MP1平台尚未完全上行。 因此此存储库中的功能不可用}}
Download source code from the official github
+
从官方GitHub下载源代码
 
   {{PC$}} git clone https://github.com/ARM-software/arm-trusted-firmware.git
 
   {{PC$}} git clone https://github.com/ARM-software/arm-trusted-firmware.git
  
{{InternalInfo |
+
从内部git下载源代码
Development source tree:
 
Download source code from the internal git
 
 
   {{PC$}} git clone ssh://gerrit.st.com:29418/mpu/oe/st/tf-a.git
 
   {{PC$}} git clone ssh://gerrit.st.com:29418/mpu/oe/st/tf-a.git
}}
 
  
 
=== Build Process ===
 
=== Build Process ===
第39行: 第38行:
  
 
==== TF-A Build flags ====
 
==== TF-A Build flags ====
'''For {{EcosystemRelease | revision=1.2.0 | range=and after}}'''<br>
+
 
Mandatory flags:
+
强制性标志:
* ARM_ARCH_MAJOR=7: the major version of ARM Architecture to target (STM32MP15 is ARMv7 architecture based)
+
* ARM_ARCH_MAJOR=7: 要针对的ARM体系结构的主要版本(STM32MP15基于ARMv7体系结构)
* ARCH=aarch32: specify aarch32 architecture to be built
+
* ARCH=aarch32: 指定要构建的aarch32体系结构
* PLAT=stm32mp1: builds an stm32mp1 platform
+
* PLAT=stm32mp1: 构建一个stm32mp1平台
* DTB_FILE_NAME=<fdt file name>.dtb: this must be defined to build the proper target and include the correct DTB file into the final file
+
* DTB_FILE_NAME=<fdt file name>.dtb: 必须定义此名称以构建适当的目标并将正确的DTB文件包括到最终文件中
 
* AARCH32_SP=<monitor>
 
* AARCH32_SP=<monitor>
** sp_min: builds the BL32 secure monitor if required
+
** sp_min: 如果需要,可构建BL32安全监视器
** optee: do not include BL32 and prepare BL2 for optee-specific load which also requires to build with the 'STM32MP_BOOT_ONLY{{=}}1' option.
+
** optee: 不要包括BL32,并准备BL2以应对optee专用的负载,这也需要使用'STM32MP_BOOT_ONLY {{=}} 1'选项进行构建。
 +
 
 +
可选标志:
 +
* STM32MP_BOOT_ONLY{{=}}1: 构建所有存储驱动程序支持(串行除外)(不支持stm32_programmer)。OP-TEE模式必需。
 +
* STM32MP_FLASHLOADER_ONLY{{=}}1: 仅构建串行链接驱动程序支持(UART / USB)和stm32_programmer支持。
 +
* DEBUG{{=}}1: 在所有二进制文件中添加调试信息
 +
* V{{=}}1: 打印详细的编译痕迹
 +
 
 +
* STM32MP_FPGA{{=}}1: 包括FPGA特定代码(与板不兼容)
 +
* STM32MP1_TEST{{=}}1: 启用特定SMC以进行测试(强制验证)
  
Optional flags:
 
* STM32MP_BOOT_ONLY{{=}}1: Build all storage driver supports except serial (no stm32_programmer support). Required for OP-TEE mode.
 
* STM32MP_FLASHLOADER_ONLY{{=}}1: Build only serial link driver support (UART/USB) and stm32_programmer support.
 
* DEBUG{{=}}1: add debug information in all binaries
 
* V{{=}}1: print verbose compilation traces
 
{{InternalInfo |
 
* STM32MP_FPGA{{=}}1: include FPGA specific code (not compatible with board)
 
* STM32MP1_TEST{{=}}1: enable specific SMC for test purposes (mandatory for validation)
 
}}
 
  
 
<div class="mw-collapsible mw-collapsed">
 
<div class="mw-collapsible mw-collapsed">
'''For {{EcosystemRelease | revision=1.1.0}}'''
+
 
 
<div class="mw-collapsible-content">
 
<div class="mw-collapsible-content">
Mandatory flags:
+
强制性标志:
* ARM_ARCH_MAJOR=7: the major version of ARM Architecture to target (STM32MP15 is ARMv7 architecture based)
+
* ARM_ARCH_MAJOR=7: 面向的主要ARM体系结构版本(STM32MP15基于ARMv7体系结构)
* ARCH=aarch32: specify aarch32 architecture to be built
+
* ARCH=aarch32: 指定要构建的aarch32体系结构
* PLAT=stm32mp1: builds an stm32mp1 platform
+
* PLAT=stm32mp1: 构建一个stm32mp1平台
* DTB_FILE_NAME=<fdt file name>.dtb: this must be defined to build the proper target and include the correct DTB file into the final file
+
* DTB_FILE_NAME=<fdt file name>.dtb: 必须定义此名称以构建适当的目标并将正确的DTB文件包括到最终文件中
 
* AARCH32_SP=<monitor>
 
* AARCH32_SP=<monitor>
** sp_min: builds the BL32 secure monitor if required
+
** sp_min: 如果需要,可构建BL32安全监视器
** optee: do not include BL32 and prepare BL2 for optee-specific load
+
** optee: 不包括BL32并准备BL2以应对Optee特定的负载
  
Optional flags:
+
可选标志:
* DEBUG{{=}}1: add debug information in all binaries
+
* DEBUG{{=}}1: 在所有二进制文件中添加调试信息
* V{{=}}1: print verbose compilation traces
+
* V{{=}}1: 打印详细的编译痕迹
{{InternalInfo |
+
* STM32MP_FPGA{{=}}1: 包括FPGA特定代码(与板不兼容)
* STM32MP_FPGA{{=}}1: include FPGA specific code (not compatible with board)
+
* STM32MP1_TEST{{=}}1: 启用特定SMC以进行测试(强制验证)
* STM32MP1_TEST{{=}}1: enable specific SMC for test purposes (mandatory for validation)
 
}}
 
 
</div></div>
 
</div></div>
 
=== Build command ===
 
=== Build command ===
From the Developer Package tarball, a Makefile.sdk is present and must be used to build the target.
+
在开发人员包 tarball 中,存在一个Makefile.sdk,必须使用它来构建目标。
It automatically sets the proper configuration for the TF-A build.<br>
+
它会自动为TF-A版本设置正确的配置。<br>
 
   {{PC$}} make -f Makefile.sdk TF_A_CONFIG=trusted TFA_DEVICETREE=stm32mp157c-<board>
 
   {{PC$}} make -f Makefile.sdk TF_A_CONFIG=trusted TFA_DEVICETREE=stm32mp157c-<board>
The latest version of the helper file is also available in this user guide: [[media:TF-A.README.HOW_TO.txt|README.HOW_TO.txt]].
+
The latest version of the helper file is also available in this user guide: [https://github.com/STMicroelectronics/meta-st-stm32mp/blob/dunfell/recipes-bsp/trusted-firmware-a/tf-a-stm32mp/README.HOW_TO.txt README.HOW_TO.txt]
 +
{{Warning|必须设置DTB_FILE_NAME标志才能选择正确的电路板配置。<br>
 +
目标的设备树文件必须位于fdts文件夹中 (stm32mp157c-<board>.dts)}}
  
{{Warning|The DTB_FILE_NAME flag must be set to select the correct board configuration.<br>
+
如果不存在Makefile.sdk,则必须添加自己的环境标志:
The device tree file for the target must be located in fdts folder (stm32mp157c-<board>.dts)}}
 
 
 
If no Makefile.sdk exists, you must add your own environment flags:
 
 
   {{PC$}} unset LDFLAGS;
 
   {{PC$}} unset LDFLAGS;
 
   {{PC$}} unset CFLAGS;
 
   {{PC$}} unset CFLAGS;
第94行: 第90行:
  
 
=== Final image ===
 
=== Final image ===
Final image is available for Flash or SD card update in the corresponding folder:
+
最终映像可用于相应文件夹中的Flash或SD卡更新:
 
<pre>
 
<pre>
 
build/<target>/<debug|release>/tf-a-<target>.stm32
 
build/<target>/<debug|release>/tf-a-<target>.stm32
第102行: 第98行:
  
 
== Distribution Package ==
 
== Distribution Package ==
For an OpenSTLinux distribution, the TF-A image is built in release mode by default. The yocto recipe can be found in:<br>
+
对于OpenSTLinux发行版,默认情况下TF-A映像以发布模式构建。yocto配方可以在以下位置找到:<br>
 
<pre>
 
<pre>
 
meta-st/meta-st-stm32mp/recipes-bsp/trusted-firmware-a/tf-a-stm32mp_<version>.bb
 
meta-st/meta-st-stm32mp/recipes-bsp/trusted-firmware-a/tf-a-stm32mp_<version>.bb
 
</pre>
 
</pre>
If you want to modify the TF-A code source, use the following steps starting from an already downloaded and built OpenSTLinux distribution.
+
如果您想修改TF-A代码源,请从已经下载并构建的OpenSTLinux发行版开始执行以下步骤。
  
 
=== Access sources ===
 
=== Access sources ===
You can use [[OpenEmbedded_-_devtool|devtool]] to access the source.
+
您可以使用[[OpenEmbedded_-_devtool|devtool]]来访问源代码。
 
   {{PC$}} cd <baseline root directory>
 
   {{PC$}} cd <baseline root directory>
 
   {{PC$}} devtool modify tf-a-stm32mp sources/boot/tf-a
 
   {{PC$}} devtool modify tf-a-stm32mp sources/boot/tf-a
  
By going to the sources/boot/tf-a folder, you can manage and modify the TF-A sources.
+
通过转到 Sources/boot/tf-a 文件夹,您可以管理和修改TF-A源文件。
To rebuild it, go back to the build-<distribution> folder and launch the TF-A recipe:
+
要重新构建它,请返回到build-<Distribution>文件夹并启动TF-A配方:
 
   {{PC$}} bitbake tf-a-stm32mp
 
   {{PC$}} bitbake tf-a-stm32mp
  
The final image is deployed in the image default output folder.
+
最终映像部署在映像默认输出文件夹中。
  
 
== Update software on board ==
 
== Update software on board ==
 
=== Partitioning of binaries ===
 
=== Partitioning of binaries ===
The TF-A build provides a binary named tf-a-stm32mp157c-<board>.stm32 that MUST be copied to a dedicated partition named "fsblX" (X depends of needed backup).
+
TF-A构建提供了一个名为TF-A-stm32mp157c-<board>.stm32的二进制文件,必须将其复制到名为“fsblX”的专用分区(X取决于所需的备份)。
  
{{Warning|TF-A must be located in the first partition of your boot device.<br>
+
{{Warning|TF-A必须位于引导设备的第一个分区中。<br>
You can just update the first partition for a simple test, but all backup partitions must contain the same image at the end.
+
您可以只更新第一个分区进行简单的测试,但所有备份分区的末尾都必须包含相同的映像。
 
}}
 
}}
  
 
=== Update via SDCARD ===
 
=== Update via SDCARD ===
If you use an SD card, you can simply update TF-A using the dd command on your host.<br>
+
如果使用SD卡,则只需在主机上使用dd命令更新TF-A。<br>
Plug your SD card into the computer and copy the binary to the dedicated partition; on an SDCard/USB disk the "fsbl1" partition is partition 1:
+
将SD卡插入计算机,然后将二进制文件复制到专用分区;在SD卡/USB磁盘上,“fsbl1”分区是分区1:
 
   - SDCARD: /dev/mmcblkXp1 (where X is the instance number)
 
   - SDCARD: /dev/mmcblkXp1 (where X is the instance number)
 
   - SDCARD via USB reader: /dev/sdX1 (where X is the instance number)
 
   - SDCARD via USB reader: /dev/sdX1 (where X is the instance number)
第135行: 第131行:
 
   {{PC$}} dd if=<tf-a file> of=/dev/<device partition> bs=1M conv=fdatasync
 
   {{PC$}} dd if=<tf-a file> of=/dev/<device partition> bs=1M conv=fdatasync
  
{{Info| To find the partition associated to a specific label, just plug the
+
{{Info| 要查找与特定标签相关联的分区,只需将SD卡/U盘插入您的PC,然后调用以下命令:
SDCARD/USB disk into your PC and call the following command:
 
  
 
   {{PC$}} ls -l /dev/disk/by-partlabel/
 
   {{PC$}} ls -l /dev/disk/by-partlabel/
第149行: 第144行:
  
 
* Windows
 
* Windows
There is an existing dd for Windows that makes binary copying possible.
+
现有的Windows dd可以实现二进制复制
  
 
=== Update via USB mass storage on U-boot ===
 
=== Update via USB mass storage on U-boot ===
 
See [[How to use USB mass storage in U-Boot]]
 
See [[How to use USB mass storage in U-Boot]]
  
Follow the previous section to put tf-a-<board>.stm32 onto SDCard/USB disk
+
按照上一节将tf-a-<board>.stm32放入SD卡/U盘
 
 
 
=== Update your boot device (including SD card on the target) ===
 
=== Update your boot device (including SD card on the target) ===
Refer to the [[STM32CubeProgrammer]] documentation to update your target.
+
请参阅[[STM32CubeProgrammer]]文档用以更新您的目标。
 
 
<noinclude>
 
{{PublicationRequestId | 12345 | 2018-10-10 | PhilipS}}
 
[[Category:Trusted Firmware-A (TF-A)| 02]]
 
</noinclude>
 

2020年11月2日 (一) 15:53的最新版本

Article Purpose

本节详细介绍了从源构建TF-A并将其部署到目标上的过程。
构建示例基于OpenSTLinux环境:

  • 开发人员包
  • 程序的发行包

Overview

TF-A是ST受信任引导链的FSBL。它必须根据您的平台进行配置或更新。

TF-A的交叉编译仅在需要修改时才需要。 默认情况下,在入门包中,TF-A映像的名称为: tf-<board>-trusted.stm32.
进行更改后,您必须重建TF-A并使用此新映像更新引导设备的所有FSBL分区。 第二个FSBL映像用作备用映像。

构建过程将创建完整的STM32映像,该映像可用于Flash集成特定的header.

此受信任的固件-A映像包含设备树,BL2和BL32级。
这些二进制文件是在构建过程中一步完成的。

Atf.stm32.png


Developer Package

Install sources

开发包包含OpenSTLinux和TF-A源: TF-A Installation

Official source tree

Warning.png STM32MP1平台尚未完全上行。 因此此存储库中的功能不可用

从官方GitHub下载源代码

 PC $> git clone https://github.com/ARM-software/arm-trusted-firmware.git

从内部git下载源代码

 PC $> git clone ssh://gerrit.st.com:29418/mpu/oe/st/tf-a.git

Build Process

Initialise the cross compile environment

Setup Cross compile environment

TF-A Build flags

强制性标志:

  • ARM_ARCH_MAJOR=7: 要针对的ARM体系结构的主要版本(STM32MP15基于ARMv7体系结构)
  • ARCH=aarch32: 指定要构建的aarch32体系结构
  • PLAT=stm32mp1: 构建一个stm32mp1平台
  • DTB_FILE_NAME=<fdt file name>.dtb: 必须定义此名称以构建适当的目标并将正确的DTB文件包括到最终文件中
  • AARCH32_SP=<monitor>
    • sp_min: 如果需要,可构建BL32安全监视器
    • optee: 不要包括BL32,并准备BL2以应对optee专用的负载,这也需要使用'STM32MP_BOOT_ONLY = 1'选项进行构建。

可选标志:

  • STM32MP_BOOT_ONLY=1: 构建所有存储驱动程序支持(串行除外)(不支持stm32_programmer)。OP-TEE模式必需。
  • STM32MP_FLASHLOADER_ONLY=1: 仅构建串行链接驱动程序支持(UART / USB)和stm32_programmer支持。
  • DEBUG=1: 在所有二进制文件中添加调试信息
  • V=1: 打印详细的编译痕迹
  • STM32MP_FPGA=1: 包括FPGA特定代码(与板不兼容)
  • STM32MP1_TEST=1: 启用特定SMC以进行测试(强制验证)


强制性标志:

  • ARM_ARCH_MAJOR=7: 面向的主要ARM体系结构版本(STM32MP15基于ARMv7体系结构)
  • ARCH=aarch32: 指定要构建的aarch32体系结构
  • PLAT=stm32mp1: 构建一个stm32mp1平台
  • DTB_FILE_NAME=<fdt file name>.dtb: 必须定义此名称以构建适当的目标并将正确的DTB文件包括到最终文件中
  • AARCH32_SP=<monitor>
    • sp_min: 如果需要,可构建BL32安全监视器
    • optee: 不包括BL32并准备BL2以应对Optee特定的负载

可选标志:

  • DEBUG=1: 在所有二进制文件中添加调试信息
  • V=1: 打印详细的编译痕迹
  • STM32MP_FPGA=1: 包括FPGA特定代码(与板不兼容)
  • STM32MP1_TEST=1: 启用特定SMC以进行测试(强制验证)

Build command

在开发人员包 tarball 中,存在一个Makefile.sdk,必须使用它来构建目标。 它会自动为TF-A版本设置正确的配置。

 PC $> make -f Makefile.sdk TF_A_CONFIG=trusted TFA_DEVICETREE=stm32mp157c-<board>

The latest version of the helper file is also available in this user guide: README.HOW_TO.txt

Warning.png 必须设置DTB_FILE_NAME标志才能选择正确的电路板配置。

目标的设备树文件必须位于fdts文件夹中 (stm32mp157c-<board>.dts)

如果不存在Makefile.sdk,则必须添加自己的环境标志:

 PC $> unset LDFLAGS;
 PC $> unset CFLAGS;
 PC $> make ARM_ARCH_MAJOR=7 ARCH=aarch32 PLAT=stm32mp1 AARCH32_SP=sp_min DTB_FILE_NAME=stm32mp157c-<board>.dtb

Final image

最终映像可用于相应文件夹中的Flash或SD卡更新:

build/<target>/<debug|release>/tf-a-<target>.stm32
Ex:
build/stm32mp1/debug/tf-a-stm32mp157c-ev1.stm32

Distribution Package

对于OpenSTLinux发行版,默认情况下TF-A映像以发布模式构建。yocto配方可以在以下位置找到:

meta-st/meta-st-stm32mp/recipes-bsp/trusted-firmware-a/tf-a-stm32mp_<version>.bb

如果您想修改TF-A代码源,请从已经下载并构建的OpenSTLinux发行版开始执行以下步骤。

Access sources

您可以使用devtool来访问源代码。

 PC $> cd <baseline root directory>
 PC $> devtool modify tf-a-stm32mp sources/boot/tf-a

通过转到 Sources/boot/tf-a 文件夹,您可以管理和修改TF-A源文件。 要重新构建它,请返回到build-<Distribution>文件夹并启动TF-A配方:

 PC $> bitbake tf-a-stm32mp

最终映像部署在映像默认输出文件夹中。

Update software on board

Partitioning of binaries

TF-A构建提供了一个名为TF-A-stm32mp157c-<board>.stm32的二进制文件,必须将其复制到名为“fsblX”的专用分区(X取决于所需的备份)。

Warning.png TF-A必须位于引导设备的第一个分区中。

您可以只更新第一个分区进行简单的测试,但所有备份分区的末尾都必须包含相同的映像。

Update via SDCARD

如果使用SD卡,则只需在主机上使用dd命令更新TF-A。
将SD卡插入计算机,然后将二进制文件复制到专用分区;在SD卡/USB磁盘上,“fsbl1”分区是分区1:

 - SDCARD: /dev/mmcblkXp1 (where X is the instance number)
 - SDCARD via USB reader: /dev/sdX1 (where X is the instance number)
  • Linux
 PC $> dd if=<tf-a file> of=/dev/<device partition> bs=1M conv=fdatasync
Info.png 要查找与特定标签相关联的分区,只需将SD卡/U盘插入您的PC,然后调用以下命令:
 PC $> ls -l /dev/disk/by-partlabel/
 total 0
 lrwxrwxrwx 1 root root 10 Jan 17 17:38 bootfs -> ../../mmcblk0p4
 lrwxrwxrwx 1 root root 10 Jan 17 17:38 fsbl1 -> ../../mmcblk0p1          ➔ FSBL1 (TF-A)
 lrwxrwxrwx 1 root root 10 Jan 17 17:38 fsbl2 -> ../../mmcblk0p2          ➔ FSBL2 (TF-A backup – same content as FSBL)
 lrwxrwxrwx 1 root root 10 Jan 17 17:38 rootfs -> ../../mmcblk0p5
 lrwxrwxrwx 1 root root 10 Jan 17 17:38 ssbl -> ../../mmcblk0p3           ➔ SSBL (U-Boot)
 lrwxrwxrwx 1 root root 10 Jan 17 17:38 userfs -> ../../mmcblk0p6
  • Windows

现有的Windows dd可以实现二进制复制

Update via USB mass storage on U-boot

See 如何在U-Boot中使用USB大容量存储

按照上一节将tf-a-<board>.stm32放入SD卡/U盘

Update your boot device (including SD card on the target)

请参阅STM32CubeProgrammer文档用以更新您的目标。