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_<boot_mode>.bin binary to build the bl2_<boot_mode>.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 <new branch name> <LSDK tag>. For example, $ git checkout -b LSDK-19.06 LSDK-19.06
  4. $ cd <platform>
    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 <new branch name> LSDK-<LSDK version>.
    $ 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 <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
  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 <new branch name> LSDK-<LSDK version>. 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-<platform>. 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_<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-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_<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

(本篇完)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 202,980评论 5 476
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,178评论 2 380
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 149,868评论 0 336
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,498评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,492评论 5 364
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,521评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,910评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,569评论 0 256
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,793评论 1 296
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,559评论 2 319
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,639评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,342评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,931评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,904评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,144评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,833评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,350评论 2 342