LS1043ARDB开发板bootloader单独编译过程

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_.bin binary to build the bl2_.pbl binary.


Clone the rcw repository and compile the PBL binary.

  1. $ git clone https://source.codeaurora.org/external/qoriq/qoriq-components/rcw
  2. $ cd rcw
  3. $ git checkout -b . For example, $ git checkout -b LSDK-19.06 LSDK-19.06
  4. $ cd
    If required, make changes to the rcw files.
  5. $ 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.


  1. $ git clone https://source.codeaurora.org/external/qoriq/qoriq-components/u-boot.git
  2. $ cd u-boot
  3. $ git checkout -b LSDK-.
    $ git checkout -b LSDK-19.06 LSDK-19.06
  4. $ export ARCH=arm64
  5. $ export CROSS_COMPILE=aarch64-linux-gnu-
  6. $ make distclean
  7. $ make _tfa_defconfig
    $ make ls1043ardb_tfa_defconfig
    A single defconfig is created for all the boot sources, _tfa_defconfig. For example, for
    LS1088ARDB, defconfig needs to be used is ls1088ardb_tfa_defconfig.
    NOTE
  8. $ 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.

  1. $ git clone https://source.codeaurora.org/external/qoriq/qoriq-components/optee_os
  2. $ cd optee_os
  3. $ git checkout -b LSDK-. For example, $ git checkout -b LSDK-19.06
    LSDK-19.06
  4. $ export ARCH=arm
  5. $ export CROSS_COMPILE64=aarch64-linux-gnu-
  6. $ make CFG_ARM64_core=y PLATFORM=ls-. For example, $ make CFG_ARM64_core=y PLATFORM=lsls1088ardb
  7. $ 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_.pbl and fip.bin.

  1. $ git clone https://source.codeaurora.org/external/qoriq/qoriq-components/atf
  2. $ cd atf
  3. $ git checkout -b LSDK-. For example, $ git checkout -b LSDK-19.06 LSDK-19.06
  4. $ export ARCH=arm64
  5. $ export CROSS_COMPILE=aarch64-linux-gnu-
    Follow the steps mentioned in How to compile BL2 binary on page 127 (bl2_.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= bl2 SPD=opteed BOOT_MODE= BL32= pbl
RCW=/
The compiled BL2 binaries, bl2.bin and bl2_.pbl are available at atf/build//release/. For any
update in the BL2 source code or RCW binary, the bl2_.pbl binary needs to be recompiled.

To compile the BL2 binary without OPTEE:
make PLAT= bl2 BOOT_MODE= pbl RCW=/

对于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= fip BL33=/u-boot.bin SPD=opteed
BL32=/tee.bin
The compiled BL31 and FIP binaries, bl31.bin, fip.bin, are available at atf/build//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= fip BL33=/u-boot.bin
NOTE
To compile the FIP binary with trusted board boot, refer the read me at /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= fip BL33=/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 /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

(本篇完)

你可能感兴趣的:(LS1043ARDB开发板bootloader单独编译过程)