Difference between revisions of "ATF"

From Rockchip open source Document
Jump to: navigation, search
 
(17 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
  
 
= Download ARM Trusted Firmware =
 
= Download ARM Trusted Firmware =
 +
 +
== Rockchip ATF ==
 +
 +
Rockchip do not provide the ATF source code, you can find the ATF binaries in [https://github.com/rockchip-linux/rkbin rkbin repository].
 +
 +
== Upstream ATF ==
  
 
Get the source code from github:
 
Get the source code from github:
 
<pre>git clone https://github.com/ARM-software/arm-trusted-firmware.git</pre>
 
<pre>git clone https://github.com/ARM-software/arm-trusted-firmware.git</pre>
  
= Supported Devices[[http://10.10.10.12:8444/index.php?title=U-Boot&action=edit&section=4 edit]] =
+
 
 +
 
 +
= Supported Devices =
  
 
Upstream ARM Trusted Firmware support Rockchip SoCs:
 
Upstream ARM Trusted Firmware support Rockchip SoCs:
  
[http://10.10.10.12:8444/index.php?title=RK3399 RK3399]
+
[[RK3399|RK3399]]
 +
 
 +
RK3328
 +
 
 +
RK3368
  
 
= Build ATF =
 
= Build ATF =
Line 22: Line 35:
 
CFLAGS='-gdwarf-2' \
 
CFLAGS='-gdwarf-2' \
 
CROSS_COMPILE=aarch64-linux-gnu- \
 
CROSS_COMPILE=aarch64-linux-gnu- \
make PLAT=rk3399 DEBUG=1 ERROR_DEPRECATED=1 bl31</pre>
+
make PLAT=rk3399 DEBUG=0 ERROR_DEPRECATED=1 bl31</pre>
  
Because there is a blob of code for cortex-M0, so you need a compiler for it. Install it by:
+
Because there is a blob of code for cortex-M0 in rk3399 ATF, so you need a compiler for it. Install it by:
 
<pre>sudo apt-get install gcc-arm-none-eabi</pre>
 
<pre>sudo apt-get install gcc-arm-none-eabi</pre>
  
We can get bl31.bin when&nbsp;build complete.
+
We can get bl31.elf&nbsp;<s>bl31.bin</s> when&nbsp;build completed.
 +
 
 +
Note: The latest version ATF(including rockchip version and upstream version) bl31.elf instead of&nbsp;bl31.bin, the bl31.bin is not available now.
  
 
= Install ATF =
 
= Install ATF =
  
== Using U-Boot&nbsp;SPL FIT image[[http://10.10.10.12:8444/index.php?title=U-Boot&action=edit&section=11 edit]] ==
 
  
== Using Rockchip miniloader[[http://10.10.10.12:8444/index.php?title=U-Boot&action=edit&section=12 edit]] ==
+
== Using U-Boot&nbsp;SPL FIT image ==
 +
 
 +
Copy the trust binary(optee.bin or bl31.elf) to u-boot root directory and rename it to tee.bin(armv7) or bl31.elf(armv8). Use below command to get u-boot.itb.
 +
<pre>make u-boot.itb
 +
</pre>
 +
 
 +
The output u-boot.itb is a its based package including u-boot-nodtb.bin, board.dtb, and trust binaries which can be load by SPL.
 +
 
 +
 
 +
 
 +
== Using Rockchip miniloader ==
  
 
Alternatively, you can use Rockchip miniloader and U-Boot instead which do not need SPL.
 
Alternatively, you can use Rockchip miniloader and U-Boot instead which do not need SPL.
  
The miniloader is package as IDBlock, and the u-boot.bin need to package with rockchip tool:
+
The ATF is loaded by miniloader, so it should be package to known format for miniloader
<pre>loaderimage --pack --uboot u-boot.bin rk3288_uboot.img</pre>
+
<pre>trust_merger rk_tools/RKTRUST/RK3399TRUST.ini trust.img</pre>
  
According to the&nbsp;[http://10.10.10.12:8444/index.php?title=Partitions partitions]&nbsp;definition, this output should write to offset 0x4000.
+
According to the&nbsp;[[Partitions|partitions]]&nbsp;definition, write&nbsp;trust.img to offset 0x6000.

Latest revision as of 08:50, 17 July 2018


Download ARM Trusted Firmware

Rockchip ATF

Rockchip do not provide the ATF source code, you can find the ATF binaries in rkbin repository.

Upstream ATF

Get the source code from github:

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


Supported Devices

Upstream ARM Trusted Firmware support Rockchip SoCs:

RK3399

RK3328

RK3368

Build ATF

Here is a mk-atf.sh script to build ATF.

$ cat mk-atf.sh 

#!/bin/bash

make realclean

CFLAGS='-gdwarf-2' \
CROSS_COMPILE=aarch64-linux-gnu- \
make PLAT=rk3399 DEBUG=0 ERROR_DEPRECATED=1 bl31

Because there is a blob of code for cortex-M0 in rk3399 ATF, so you need a compiler for it. Install it by:

sudo apt-get install gcc-arm-none-eabi

We can get bl31.elf bl31.bin when build completed.

Note: The latest version ATF(including rockchip version and upstream version) bl31.elf instead of bl31.bin, the bl31.bin is not available now.

Install ATF

Using U-Boot SPL FIT image

Copy the trust binary(optee.bin or bl31.elf) to u-boot root directory and rename it to tee.bin(armv7) or bl31.elf(armv8). Use below command to get u-boot.itb.

make u-boot.itb

The output u-boot.itb is a its based package including u-boot-nodtb.bin, board.dtb, and trust binaries which can be load by SPL.


Using Rockchip miniloader

Alternatively, you can use Rockchip miniloader and U-Boot instead which do not need SPL.

The ATF is loaded by miniloader, so it should be package to known format for miniloader

trust_merger rk_tools/RKTRUST/RK3399TRUST.ini trust.img

According to the partitions definition, write trust.img to offset 0x6000.