imx-boot_0.2.bb 作业流程

yocto的编译流程大概有如下步骤

do_setscene
do_fetch
do_unpack
do_patch
do_configure
do_qa_configure
do_compile
do_stage
do_install
do_package
do_populate_staging
do_package_write_deb
do_package_write
do_distribute_sources
do_qa_staging
do_build
do_rebuild

我们在编译完成整体的yocto配方之后针对imx-boot_0.2.bb 查看一下这个配方每一步都做了什么

先将该bb清除

bitbake -c cleanall imx-boot

得到work目录下已经将imx-boot相关全部清除了,接下来按照yocto的do_顺序查看每一步都发生了什么

bitbake imx-boot -c fetch
# 得到如下三个文件夹,里面处理tmep为log之外,其他都是没有内容的文件
# recipe-sysroot  recipe-sysroot-native  temp
bitbake imx-boot -c unpack
# 多了一个文件夹git,这个git文件夹就是imx-boot_0.2.bb指定的源代码
# git  recipe-sysroot  recipe-sysroot-native  temp
# git文件夹下的文件
# ├── COPYING
# ├── iMX8dv
# │   └── ...
# ├── iMX8M
# │   └── ...
# ├── iMX8QM
# │   ├── expand_c_define.sh
# │   ├── imx8qm_dcd_1.2GHz.cfg
# │   ├── imx8qm_dcd_1.6GHz.cfg
# │   ├── imx8qm_dcd_800MHz.cfg
# │   ├── imx8qm_dcd.cfg
# │   ├── lib
# │   │   ├── ddrc_mem_map.h
# │   │   └── ddr_phy_mem_map.h
# │   └── soc.mak
# ├── iMX8QX
# │   └── ...
# ├── Makefile
# ├── README
# ├── src
# │   ├── imx8qm.c
# │   ├── imx8qxb0.c
# │   ├── imx8qx.c
# │   ├── mkimage_common.h
# │   └── mkimage_imx8.c
# └── tree.log
do_patch
do_configure
# 没做具体影响结果的事
bitbake imx-boot -c compile
# imx-boot_0.2.bb节选do_compile部分
# do_compile () {
#     if [ "${SOC_TARGET}" = "iMX8M" ]; then
#         echo 8MQ boot binary build
#         ...
#     elif [ "${SOC_TARGET}" = "iMX8QM" ]; then
#         echo 8QM boot binary build
#         cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${SC_FIRMWARE_NAME} ${S}/${SOC_TARGET}/scfw_tcm.bin
#         cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${ATF_MACHINE_NAME} ${S}/${SOC_TARGET}/bl31.bin
#         cp ${DEPLOY_DIR_IMAGE}/${UBOOT_NAME}                     ${S}/${SOC_TARGET}/u-boot.bin
#         cp ${DEPLOY_DIR_IMAGE}/imx8qm_m4_0_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin ${S}/${SOC_TARGET}/m40_tcm.bin
#         cp ${DEPLOY_DIR_IMAGE}/imx8qm_m4_1_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin ${S}/${SOC_TARGET}/m41_tcm.bin
#     else
#         echo 8QX boot binary build
#         ...
#     fi
#     ...
#     mkimage for i.MX8
#     for target in ${IMXBOOT_TARGETS}; do
#         echo "building ${SOC_TARGET} - ${target}"
#         make SOC=${SOC_TARGET} ${target}
#         if [ -e "${S}/${SOC_TARGET}/flash.bin" ]; then
#             cp ${S}/${SOC_TARGET}/flash.bin ${S}/${BOOT_CONFIG_MACHINE}-${target}
#         fi
#     done
# }

# 针对如上拷贝部分,在run.do_compile解析为如下脚本
# 相当于执行了3次make
# make SOC=iMX8QM flash_multi_cores
# make SOC=iMX8QM flash
# make SOC=iMX8QM flash_dcd
# 对应于后面的三个sd.bin文件
# mkimage for i.MX8
# for target in flash_multi_cores flash flash_dcd; do
#     echo "building iMX8QM - ${target}"
#     make SOC=iMX8QM ${target}
#     if [ -e "/home/timotheus/fould/imx-4.9.88-2.2.0-8qxp_beta2/build-wld-imx8qmlpddr4arm2/tmp/work/imx8qmlpddr4arm2-poky-linux/imx-boot/0.2-r0/git/iMX8QM/flash.bin" ]; then
#         cp /home/timotheus/fould/imx-4.9.88-2.2.0-8qxp_beta2/build-wld-imx8qmlpddr4arm2/tmp/work/imx8qmlpddr4arm2-poky-linux/imx-boot/0.2-r0/git/iMX8QM/flash.bin /home/timotheus/fould/imx-4.9.88-2.2.0-8qxp_beta2/build-wld-imx8qmlpddr4arm2/tmp/work/imx8qmlpddr4arm2-poky-linux/imx-boot/0.2-r0/git/imx-boot-imx8qmlpddr4arm2-sd.bin-${target}
#     fi
# done

# 编译后多出了如下文件
# .
# ├── iMX8QM
# │   ├── bl31.bin
# │   ├── flash.bin
# │   ├── head.hash
# │   ├── imx8qm_dcd.cfg.tmp
# │   ├── m40_tcm.bin
# │   ├── m41_tcm.bin
# │   ├── scfw_tcm.bin
# │   ├── u-boot-atf-b.bin
# │   ├── u-boot-atf.bin
# │   ├── u-boot-atf-hdmi.bin
# │   ├── u-boot.bin
# │   └── u-boot-hash.bin
# ├── imx-boot-imx8qmlpddr4arm2-sd.bin-flash
# ├── imx-boot-imx8qmlpddr4arm2-sd.bin-flash_dcd
# ├── imx-boot-imx8qmlpddr4arm2-sd.bin-flash_multi_cores
# ├── mkimage_imx8
# └── src
#     └── build_info.h

# imx-boot_0.2.bb 配方在复制部分内容将五个依赖文件复制到本配方目录,五个文件如下
# scfw_tcm.bin (imx-sc-firmware配方)
# bl31.bin (imx-atf配方)
# u-boot.bin (u-boot配方)
# m40_tcm.bin (imx-m4-demos配方)
# m41_tcm.bin (imx-m4-demos配方)

# imx-boot_0.2.bb 配方在make部分执行的三次make会调用soc.mak
# soc.mak会强制编译u-boot-atf.bin 的条件,得到如下几个文件几个文件有一定的规则
# head.hash u-boot-hash.bin u-boot-atf.bin u-boot-atf-b.bin u-boot-atf-hdmi.bin(hdmi部分为空)
# ------bl31-------u-boot.bin+head.hash---
# --------------'────────────────────────'(u-boot-hash.bin)
# '─────────────'────────────────────────'(u-boot-atf.bin)
# '─────────────'────────────────────────'(u-boot-atf-b.bin)
#  ----------- 128k ----------------------

# 然后在根据参数编译flash_multi_cores flash flash_dcd这三项得到3个文件
# imx-boot-imx8qmlpddr4arm2-sd.bin-flash
# imx-boot-imx8qmlpddr4arm2-sd.bin-flash_dcd
# imx-boot-imx8qmlpddr4arm2-sd.bin-flash_multi_cores
bitbake imx-boot -c install
# 将生成的三个文件imx-boot-imx8qmlpddr4arm2-sd.bin-flash imx-boot-imx8qmlpddr4arm2-sd.bin-flash_dcd imx-boot-imx8qmlpddr4arm2-sd.bin-flash_multi_cores拷贝到{D}/boot目录
bitbake imx-boot -c deploy
# 将相关文件拷贝到${DEPLOYDIR}目录下

 

你可能感兴趣的:(boot,linux,imx8)