LS1043ARDB开发板环境bootloader版本包括以下几部分构成,分别编译,再组合成几个文件,下面列出整个bootloader的编译步骤:
总结一下就是:
1、先下载RCW源码文件,编译出PBL二进制文件。
2、再下载u-boot源码文件,编译出u-boot.bin文件。
3、[可选项]编译OP-TEE二进制文件。
4、继续编译TF-A二进制文件。(先编译出BL2二进制文件,再编译出FIP二进制文件)
1 . How to compile PBL binary from RCW source file
You need to compile the rcw_<boot_mode>.bin binary to build the bl2_<boot_mode>.pbl binary.
Clone the rcw repository and compile the PBL binary.
- $ git clone https://source.codeaurora.org/external/qoriq/qoriq-components/rcw
- $ cd rcw
- $ git checkout -b <new branch name> <LSDK tag>. For example, $ git checkout -b LSDK-19.06 LSDK-19.06
- $ cd <platform>
If required, make changes to the rcw files. - $ make
对于ls1043ardb开发板,编译特定RCW源码的命令总结如下:
git clone https://source.codeaurora.org/external/qoriq/qoriq-components/rcw
cd rcw
git checkout -b LSDK-19.06 LSDK-19.06
root@ubuntu:/home/imhqq/share/bootloader/rcw# cd
a004580.rcw ls1046afrwy/ qspi_swap.sh
a006559.rcw ls1046aqds/ rcw.py
a007837.rcw ls1046ardb/ t1023rdb/
b4420qds/ ls1088aqds/ t1024qds/
b4860qds/ ls1088ardb/ t1024rdb/
.git/ ls2088aqds/ t1040d4rdb/
.gitignore ls2088ardb/ t1040qds/
LICENSE ls2088ardb_rev1.1/ t1040rdb/
ls1012a2g5rdb/ ls2088asi/ t1040si/
ls1012afrdm/ lx2160aqds/ t1042d4rdb/
ls1012afrwy/ lx2160ardb/ t1042rdb/
ls1012aqds/ lx2160asi/ t1042rdb_pi/
ls1012ardb/ Makefile t2080qds/
ls1021aqds/ Makefile.inc t2080rdb/
ls1021atwr/ p2041rdb/ t2081qds/
ls1028aqds/ p3041ds/ t4240qds/
ls1028ardb/ p4080ds/ t4240rdb/
ls1028asi/ p5020ds/ tools/
ls1043aqds/ p5040ds/
ls1043ardb/ qspi_swap_list.txt
root@ubuntu:/home/imhqq/share/bootloader/rcw# cd ls1043ardb
make
root@ubuntu:/home/imhqq/share/bootloader/rcw/ls1043ardb# ls
gic_4k.rcw Makefile README RR_FQPP_1455 uefi_address.rcw
root@ubuntu:/home/imhqq/share/bootloader/rcw/ls1043ardb# cd RR_FQPP_1455/
root@ubuntu:/home/imhqq/share/bootloader/rcw/ls1043ardb/RR_FQPP_1455# ls
rcw_1200.bin rcw_1500_sben.bin
rcw_1200_nandboot.bin rcw_1500_sben.rcw
rcw_1200_nandboot.rcw rcw_1500_sdboot.bin
rcw_1200_nandboot_sben.bin rcw_1500_sdboot.rcw
rcw_1200_nandboot_sben.rcw rcw_1500_sdboot_sben.bin
rcw_1200.rcw rcw_1500_sdboot_sben.rcw
rcw_1200_sdboot.bin rcw_1600.bin
rcw_1200_sdboot.rcw rcw_1600_gic4k.bin
rcw_1200_sdboot_sben.bin rcw_1600_gic4k.rcw
rcw_1200_sdboot_sben.rcw rcw_1600_nandboot.bin
rcw_1400.bin rcw_1600_nandboot.rcw
rcw_1400_nandboot.bin rcw_1600_nandboot_sben.bin
rcw_1400_nandboot.rcw rcw_1600_nandboot_sben.rcw
rcw_1400_nandboot_sben.bin rcw_1600_qetdm.bin
rcw_1400_nandboot_sben.rcw rcw_1600_qetdm.rcw
rcw_1400.rcw rcw_1600.rcw
rcw_1400_sdboot.bin rcw_1600_sben.bin
rcw_1400_sdboot.rcw rcw_1600_sben.rcw
rcw_1400_sdboot_sben.bin rcw_1600_sdboot.bin
rcw_1400_sdboot_sben.rcw rcw_1600_sdboot.rcw
rcw_1500.bin rcw_1600_sdboot_sben.bin
rcw_1500_nandboot.bin rcw_1600_sdboot_sben.rcw
rcw_1500_nandboot.rcw rcw_uefi_1400.bin
rcw_1500_nandboot_sben.bin rcw_uefi_1400.rcw
rcw_1500_nandboot_sben.rcw rcw_uefi_1500.bin
rcw_1500_qetdm.bin rcw_uefi_1500.rcw
rcw_1500_qetdm.rcw rcw_uefi_1600.bin
rcw_1500.rcw rcw_uefi_1600.rcw
2、u-boot版本下载与编译
How to compile U-Boot binary
先编译出u-boot.bin,再来编译fip.bin。
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.
- $ git clone https://source.codeaurora.org/external/qoriq/qoriq-components/u-boot.git
- $ cd u-boot
- $ git checkout -b <new branch name> LSDK-<LSDK version>.
$ git checkout -b LSDK-19.06 LSDK-19.06 - $ export ARCH=arm64
- $ export CROSS_COMPILE=aarch64-linux-gnu-
- $ make distclean
- $ make <platform>_tfa_defconfig
$ make ls1043ardb_tfa_defconfig
A single defconfig is created for all the boot sources, <platform>_tfa_defconfig. For example, for
LS1088ARDB, defconfig needs to be used is ls1088ardb_tfa_defconfig.
NOTE - $ make
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 LSDK 19.06 U-Boot binary.
对于ls1043ardb开发板,编译特定u-boot命令总结如下:
git clone https://source.codeaurora.org/external/qoriq/qoriq-components/u-boot.git
cd u-boot
git checkout -b LSDK-19.06 LSDK-19.06
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
make distclean
make ls1043ardb_tfa_defconfig
make
3、[Optional] How to compile OP-TEE binary
You need to compile the tee.bin binary to build fip.bin with OP-TEE. However, OP-TEE is optional, you can skip the procedure to compile OP-TEE if you want to build the FIP binary without OP-TEE.
Clone the optee_os repository and build the OP-TEE binary.
- $ git clone https://source.codeaurora.org/external/qoriq/qoriq-components/optee_os
- $ cd optee_os
- $ git checkout -b <new branch name> LSDK-<LSDK version>. For example, $ git checkout -b LSDK-19.06
LSDK-19.06 - $ export ARCH=arm
- $ export CROSS_COMPILE64=aarch64-linux-gnu-
- $ make CFG_ARM64_core=y PLATFORM=ls-<platform>. For example, $ make CFG_ARM64_core=y PLATFORM=lsls1088ardb
- $ aarch64-linux-gnu-objcopy -v -O binary out/arm-plat-ls/core/tee.elf out/arm-plat-ls/core/tee.bin
The compiled OP-TEE image, tee.bin, is available at optee_os/out/arm-plat-ls/core/.
对于ls1043ardb开发板,编译特定OP-TEE二进制的命令总结如下:
git clone https://source.codeaurora.org/external/qoriq/qoriq-components/optee_os
cd optee_os/
git checkout -b LSDK-19.06 LSDK-19.06
export ARCH=arm
export CROSS_COMPILE64=aarch64-linux-gnu-
make CFG_ARM64_core=y PLATFORM=ls-ls1043ardb
aarch64-linux-gnu-objcopy -v -O binary out/arm-plat-ls/core/tee.elf out/arm-plat-ls/core/tee.bin
具体如下:
root@ubuntu:/home/imhqq/share/bootloader# git clone https://source.codeaurora.org/external/qoriq/qoriq-components/optee_os
Cloning into 'optee_os'...
remote: Counting objects: 28710, done.
remote: Compressing objects: 100% (1254/1254), done.
remote: Total 28710 (delta 1579), reused 2981 (delta 1568)
Receiving objects: 100% (28710/28710), 8.56 MiB | 2.38 MiB/s, done.
Resolving deltas: 100% (21291/21291), done.
warning: remote HEAD refers to nonexistent ref, unable to checkout.
root@ubuntu:/home/imhqq/share/bootloader# cd optee_os/
root@ubuntu:/home/imhqq/share/bootloader/optee_os# git checkout -b LSDK-19.06 LSDK-19.06
Checking out files: 100% (1605/1605), done.
Already on 'LSDK-19.06'
root@ubuntu:/home/imhqq/share/bootloader/optee_os# export ARCH=arm
root@ubuntu:/home/imhqq/share/bootloader/optee_os# export CROSS_COMPILE64=aarch64-linux-gnu-
root@ubuntu:/home/imhqq/share/bootloader/optee_os# make CFG_ARM64_core=y PLATFORM=ls-ls1043ardb
GEN out/arm-plat-ls/core/include/generated/arm32_sysreg.h
GEN out/arm-plat-ls/core/include/generated/arm32_sysreg.S
GEN out/arm-plat-ls/core/ta_pub_key.c
CHK out/arm-plat-ls/conf.mk
UPD out/arm-plat-ls/conf.mk
CHK out/arm-plat-ls/include/generated/conf.h
UPD out/arm-plat-ls/include/generated/conf.h
root@ubuntu:/home/imhqq/share/bootloader/optee_os# aarch64-linux-gnu-objcopy -v -O binary out/arm-plat-ls/core/tee.elf out/arm-plat-ls/core/tee.bin
root@ubuntu:/home/imhqq/share/bootloader/optee_os# ls -l out/arm-plat-ls/core
total 18388
-rwxr-xr-x 1 root root 4335976 Sep 27 18:32 all_objs.o
drwxr-xr-x 3 root root 4096 Sep 27 18:30 arch
drwxr-xr-x 2 root root 4096 Sep 27 18:31 crypto
drwxr-xr-x 2 root root 4096 Sep 27 18:31 drivers
drwxr-xr-x 3 root root 4096 Sep 27 18:30 include
-rw-r--r-- 1 root root 633 Sep 27 18:32 init_entries.txt
-rwxr-xr-x 1 root root 1075232 Sep 27 18:32 init.o
drwxr-xr-x 2 root root 4096 Sep 27 18:31 kernel
-rw-r--r-- 1 root root 4087 Sep 27 18:32 kern.ld
drwxr-xr-x 3 root root 4096 Sep 27 18:31 lib
-rw-r--r-- 1 root root 5268 Sep 27 18:32 rodata_init.ld.S
-rw-r--r-- 1 root root 5521 Sep 27 18:32 rodata_unpaged.ld.S
-rw-r--r-- 1 root root 1731 Sep 27 18:30 ta_pub_key.c
-rw-r--r-- 1 root root 41120 Sep 27 18:31 ta_pub_key.o
drwxr-xr-x 2 root root 4096 Sep 27 18:31 tee
-rwxr-xr-x 1 root root 354216 Sep 27 18:40 tee.bin
-rw-r--r-- 1 root root 19 Sep 27 18:32 tee-data_end.txt
-rw-r--r-- 1 root root 5164001 Sep 27 18:32 tee.dmp
-rwxr-xr-x 1 root root 3883552 Sep 27 18:32 tee.elf
-rw-r--r-- 1 root root 28 Sep 27 18:32 tee-header_v2.bin
-rw-r--r-- 1 root root 19 Sep 27 18:32 tee-init_load_addr.txt
-rw-r--r-- 1 root root 19 Sep 27 18:32 tee-init_mem_usage.txt
-rw-r--r-- 1 root root 19 Sep 27 18:32 tee-init_size.txt
-rw-r--r-- 1 root root 2229769 Sep 27 18:32 tee.map
-rwxr-xr-x 1 root root 0 Sep 27 18:32 tee-pageable.bin
-rw-r--r-- 1 root root 0 Sep 27 18:32 tee-pageable_v2.bin
-rwxr-xr-x 1 root root 354224 Sep 27 18:32 tee-pager.bin
-rw-r--r-- 1 root root 354224 Sep 27 18:32 tee-pager_v2.bin
-rw-r--r-- 1 root root 89399 Sep 27 18:32 tee.symb_sizes
-rw-r--r-- 1 root root 6603 Sep 27 18:32 text_init.ld.S
-rw-r--r-- 1 root root 6826 Sep 27 18:32 text_unpaged.ld.S
-rw-r--r-- 1 root root 982 Sep 27 18:32 unpaged_entries.txt
-rwxr-xr-x 1 root root 1066024 Sep 27 18:32 unpaged.o
-rw-r--r-- 1 root root 1128 Sep 27 18:32 version.o
4、How to compile TF-A binaries
Clone the atf repository and compile the TF-A binaries, bl2_<boot_mode>.pbl and fip.bin.
- $ git clone https://source.codeaurora.org/external/qoriq/qoriq-components/atf
- $ cd atf
- $ git checkout -b <new branch name> LSDK-<LSDK version>. For example, $ git checkout -b LSDK-19.06 LSDK-19.06
- $ export ARCH=arm64
- $ export CROSS_COMPILE=aarch64-linux-gnu-
Follow the steps mentioned in How to compile BL2 binary on page 127 (bl2_<boot_mode>.pbl) and How to compile FIP binary
on page 128 (fip.bin) to compile both TF-A binaries.
对于ls1043ardb开发板,编译特定TF-A二进制的命令总结如下:
git clone https://source.codeaurora.org/external/qoriq/qoriq-components/atf
cd atf
git checkout -b LSDK-19.06 LSDK-19.06
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
4.1 How to compile BL2 binary
To build BL2 binary with 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>
The compiled BL2 binaries, bl2.bin and bl2_<boot_mode>.pbl are available at atf/build/<platform>/release/. For any
update in the BL2 source code or RCW binary, the bl2_<boot_mode>.pbl binary needs to be recompiled.
To compile the BL2 binary without OPTEE:
make PLAT=<platform> bl2 BOOT_MODE=<boot_mode> pbl RCW=<path_to_rcw_binary>/
<rcw_binary_for_specific_boot_mode>
对于ls1043ardb开发板,编译特定BL2二进制的命令总结如下:
make PLAT=ls1043ardb bl2 SPD=opteed BOOT_MODE=nor BL32=/home/imhqq/share/bootloader/optee_os/out/arm-plat-ls/core/tee.bin pbl RCW=/home/imhqq/share/bootloader/rcw/ls1043ardb/RR_FQPP_1455/rcw_1600.bin
4.2 How to compile FIP binary
To build FIP binary with OPTEE and without trusted board boot, run this command:
$ make PLAT=<platform> fip BL33=<path_to_u-boot_binary>/u-boot.bin SPD=opteed
BL32=<path_to_optee_binary>/tee.bin
The compiled BL31 and FIP binaries, bl31.bin, fip.bin, are available at atf/build/<platform>/release/. For any update
in the BL31, BL32, or BL33 binaries, the fip.bin binary needs to be recompiled.
To compile the FIP binary without OPTEE and without trusted board boot:
make PLAT=<platform> fip BL33=<path_to_u-boot_binary>/u-boot.bin
NOTE
To compile the FIP binary with trusted board boot, refer the read me at <tfa_repo>/plat/nxp/
README.TRUSTED_BOOT.
对于ls1043ardb开发板,编译特定FIP二进制的命令总结如下:
make PLAT=ls1043ardb fip BL33=/home/imhqq/share/bootloader/u-boot/u-boot.bin SPD=opteed BL32=/home/imhqq/share/bootloader/optee_os/out/arm-plat-ls/core/tee.bin
编译不带OPTEE及不带可信单板BOOT的FIP二进制文件:
To compile the FIP binary without OPTEE and without trusted board boot:
make PLAT=<platform> fip BL33=<path_to_u-boot_binary>/u-boot.bin
对于ls1043ardb开发板,编译不带OPTEE及不带可信单板BOOT的FIP二进制文件总结如下:
make PLAT=ls1043ardb fip BL33=/home/imhqq/share/bootloader/u-boot
NOTE
To compile the FIP binary with trusted board boot, refer the read me at <tfa_repo>/plat/nxp/
README.TRUSTED_BOOT.
最终编译出的ls1043ardb单板的bootloader文件在下面的路径:
/home/imhqq/share/bootloader/atf/build/ls1043ardb/release
root@ubuntu:/home/imhqq/share/bootloader/atf/build/ls1043ardb/release# ls
bl2 bl2.bin bl2_nor.pbl bl31 bl31.bin fip.bin
(本篇完)