本文主要介绍 sophpi 编译生成 fip.bin 流程。
1、编译前准备
sophpi 的基本编译流程如下:
shell
$ source build/cvisetup.sh
$ defconfig sg2002_wevb_riscv64_sd
$ clean_all
$ build_all
$ pack_burn_image
注:
- 需要在 bash 下运行
- clean_all 非必要可以不执行。
生成的固件位置: install/soc_sg2002_wevb_riscv64_sd/milkv-duo.img
。build_milkv.sh 也是一步一步调用这些函数。
build/cvisetup.sh
通过软链接,链接到 build/envsetup_soc.sh
,相关的编译命令都在这个文件中。
在 build/envsetup_soc.sh
文件中,定义了一些后续编译会用到的变量,如:
- TOP_DIR=$(gettop)
- BUILD_PATH="$TOP_DIR/build"
2、编译入口
总的编译命令,可以不调用 clean_all
函数,不然每次都要全编译。
shell
function clean_all()
{
clean_uboot
clean_opensbi
clean_rtos
[[ "$ATF_SRC" == y ]] && clean_atf
clean_kernel
clean_ramdisk
clean_3rd_party
if [ "$TPU_REL" = 1 ]; then
clean_ive_sdk
clean_ivs_sdk
clean_tpu_sdk
clean_tdl_sdk
clean_cnv_sdk
fi
clean_middleware
clean_osdrv
}
重点看一下 build_all
函数,位于 build/envsetup_soc.sh
文件中
shell
function build_all()
{(
build_uboot || return $?
build_kernel || return $?
build_ramboot || return $?
build_osdrv || return $?
build_3rd_party || return $?
build_middleware || return $?
if [ "$TPU_REL" = 1 ]; then
build_tpu_sdk || return $?
build_ive_sdk || return $?
build_ivs_sdk || return $?
build_tdl_sdk || return $?
fi
pack_cfg || return $?
pack_rootfs || return $?
pack_data || return $?
pack_system || return $?
copy_tools || return $?
pack_upgrade || return $?
)}
根据上面函数,先调用 build_uboot
函数。
3、uboot编译
build_uboot
函数在 build/milkvsetup.sh 文件中定义
shell
function build_uboot()
{(
print_notice "Run ${FUNCNAME[0]}() function"
_build_uboot_env
_build_opensbi_env
_link_uboot_logo
cd "$BUILD_PATH" || return
make u-boot || return "$?"
)}
- 查看 build/Makefile 文件中 203 行 u-boot 依赖 u-boot-dep
Makefile
u-boot: u-boot-dep
继续找 u-boot-dep 。。。(文件真多啊。。。)
根据 build/.config 中定义了 CONFIG_FIP_V2=y
找到 build/Makefile
文件
Makefile
ifeq (${CONFIG_FIP_V1},y)
include scripts/fip_v1.mk
else ifeq (${CONFIG_FIP_V2},y)
include scripts/fip_v2.mk
else
$(error no fip version)
endif
flp_v2.mk
Makefile
u-boot-dep: fsbl-build ${OUTPUT_DIR}/elf
$(call print_target)
ifeq ($(call qstrip,${CONFIG_ARCH}),riscv)
${Q}cp ${OPENSBI_PATH}/build/platform/generic/firmware/fw_payload.bin ${OUTPUT_DIR}/fw_payload_uboot.bin
${Q}cp ${OPENSBI_PATH}/build/platform/generic/firmware/fw_payload.elf ${OUTPUT_DIR}/elf/fw_payload_uboot.elf
endif
- u-boot-dep 又依赖 fsbl-build
fsbl-build 定义在 scripts/fip_v2.mk 文件
Makefile
ifeq ($(call qstrip,${CONFIG_ARCH}),riscv)
fsbl-build: opensbi
endif
ifeq (${CONFIG_ENABLE_FREERTOS},y)
fsbl-build: rtos
fsbl%: export BLCP_2ND_PATH=${FREERTOS_PATH}/cvitek/install/bin/cvirtos.bin
fsbl%: export RTOS_DUMP_PRINT_ENABLE=$(CONFIG_ENABLE_RTOS_DUMP_PRINT)
fsbl%: export RTOS_DUMP_PRINT_SZ_IDX=$(CONFIG_DUMP_PRINT_SZ_IDX)
fsbl%: export RTOS_FAST_IMAGE_TYPE=${CONFIG_FAST_IMAGE_TYPE}
fsbl%: export RTOS_ENABLE_FREERTOS=${CONFIG_ENABLE_FREERTOS}
endif
fsbl%: export FSBL_SECURE_BOOT_SUPPORT=${CONFIG_FSBL_SECURE_BOOT_SUPPORT}
fsbl%: export ARCH=$(call qstrip,${CONFIG_ARCH})
fsbl%: export OD_CLK_SEL=${CONFIG_OD_CLK_SEL}
fsbl%: export VC_CLK_OVERDRIVE=${CONFIG_VC_CLK_OVERDRIVE}
fsbl%: export SUSPEND=${CONFIG_SUSPEND}
fsbl%: export TPU_PERF_MODE=$(shell if [ "${CONFIG_CHIP_cv1812cp}" = "y" ] || [ "${CONFIG_CHIP_sg2002}" = "y" ] || [ "${CONFIG_CHIP_cv1812cpa}" = "y" ]; then echo "y";else echo "n";fi)
fsbl%: export BUILD_BOOT0=${CONFIG_ENABLE_BOOT0}
fsbl%: export BUILD_FASTBOOT0=${CONFIG_ENABLE_FASTBOOT0}
fsbl%: export STORAGE=${STORAGE_TYPE}
ifeq (${CONFIG_ENABLE_BOOT0},y)
fsbl-build: u-boot-build memory-map
$(call print_target)
${Q}mkdir -p ${FSBL_PATH}/build
${Q}ln -snrf -t ${FSBL_PATH}/build ${CVI_BOARD_MEMMAP_H_PATH}
${Q}$(MAKE) -j${NPROC} -C ${FSBL_PATH} O=${FSBL_OUTPUT_PATH}
${Q}cp ${FSBL_OUTPUT_PATH}/boot0 ${OUTPUT_DIR}/
else
fsbl-build: u-boot-build memory-map
$(call print_target)
${Q}mkdir -p ${FSBL_PATH}/build
${Q}ln -snrf -t ${FSBL_PATH}/build ${CVI_BOARD_MEMMAP_H_PATH}
${Q}$(MAKE) -j${NPROC} -C ${FSBL_PATH} O=${FSBL_OUTPUT_PATH} BLCP_2ND_PATH=${BLCP_2ND_PATH} \
LOADER_2ND_PATH=${UBOOT_PATH}/${UBOOT_OUTPUT_FOLDER}/u-boot-raw.bin
${Q}cp ${FSBL_OUTPUT_PATH}/fip.bin ${OUTPUT_DIR}/
ifeq (${CONFIG_UBOOT_SPL_CUSTOM},y)
${Q}$(MAKE) -C ${FSBL_PATH} clean O=${FSBL_OUTPUT_PATH}
${Q}$(MAKE) -j${NPROC} -C ${FSBL_PATH} O=${FSBL_OUTPUT_PATH} BLCP_2ND_PATH=${BLCP_2ND_PATH} \
CONFIG_SKIP_UBOOT=$(CONFIG_SKIP_UBOOT) LOADER_2ND_PATH=${UBOOT_PATH}/${UBOOT_OUTPUT_FOLDER}/spl/u-boot-spl-raw.bin
${Q}cp ${FSBL_OUTPUT_PATH}/fip.bin ${OUTPUT_DIR}/fip_spl.bin
else
${Q}cp ${FSBL_OUTPUT_PATH}/fip.bin ${OUTPUT_DIR}/fip_spl.bin
endif
endif
又依赖 opensbi
Makefile
opensbi: export CROSS_COMPILE=$(CONFIG_CROSS_COMPILE_SDK)
opensbi: u-boot-build
$(call print_target)
${Q}$(MAKE) -j${NPROC} -C ${OPENSBI_PATH} PLATFORM=generic \
FW_PAYLOAD_PATH=${UBOOT_PATH}/${UBOOT_OUTPUT_FOLDER}/u-boot-raw.bin \
FW_FDT_PATH=${UBOOT_PATH}/${UBOOT_OUTPUT_FOLDER}/arch/riscv/dts/${CHIP}_${BOARD}.dtb
又依赖 u-boot-build, build/Makefile中定义了 u-boot-build,所以会先执行 u-boot-build
Makefile
u-boot-build: memory-map
u-boot-build: u-boot-dts
u-boot-build: ${UBOOT_PATH}/${UBOOT_OUTPUT_FOLDER} ${UBOOT_CVIPART_DEP} ${UBOOT_OUTPUT_CONFIG_PATH}
$(call print_target)
${Q}ln -snrf ${CVI_BOARD_MEMMAP_H_PATH} ${UBOOT_PATH}/include/
${Q}rm -f ${UBOOT_CVI_BOARD_INIT_PATH}
${Q}ln -s ${BUILD_PATH}/boards/${CHIP_ARCH_L}/${PROJECT_FULLNAME}/u-boot/cvi_board_init.c ${UBOOT_CVI_BOARD_INIT_PATH}
${Q}rm -f ${UBOOT_CVITEK_PATH}
${Q}ln -s ${BUILD_PATH}/boards/${CHIP_ARCH_L}/${PROJECT_FULLNAME}/u-boot/cvitek.h ${UBOOT_CVITEK_PATH}
${Q}$(MAKE) -j${NPROC} -C ${UBOOT_PATH} olddefconfig
${Q}$(MAKE) -j${NPROC} -C ${UBOOT_PATH} all
${Q}cat ${UBOOT_PATH}/${UBOOT_OUTPUT_FOLDER}/u-boot.bin > ${UBOOT_PATH}/${UBOOT_OUTPUT_FOLDER}/u-boot-raw.bin
ifeq (${CONFIG_UBOOT_SPL_CUSTOM},y)
${Q}cat ${UBOOT_PATH}/${UBOOT_OUTPUT_FOLDER}/spl/u-boot-spl.bin > ${UBOOT_PATH}/${UBOOT_OUTPUT_FOLDER}/spl/u-boot-spl-raw.bin
endif
依赖 memory-map, build/scripts/mmap.mk 中定义了 memory-map
Makefile
.PHONY: memory-map
CVI_BOARD_MEMMAP_H_PATH := ${BUILD_PATH}/output/${PROJECT_FULLNAME}/cvi_board_memmap.h
CVI_BOARD_MEMMAP_CONF_PATH := ${BUILD_PATH}/output/${PROJECT_FULLNAME}/cvi_board_memmap.conf
CVI_BOARD_MEMMAP_LD_PATH:= ${BUILD_PATH}/output/${PROJECT_FULLNAME}/cvi_board_memmap.ld
BOARD_MMAP_PATH := ${BORAD_FOLDER_PATH}/memmap.py
MMAP_CONV_PY := ${BUILD_PATH}/scripts/mmap_conv.py
${CVI_BOARD_MEMMAP_H_PATH}: ${BOARD_MMAP_PATH} ${MMAP_CONV_PY}
$(call print_target)
mkdir -p $(dir $@)
@${MMAP_CONV_PY} --type h $< $@
${CVI_BOARD_MEMMAP_CONF_PATH}: ${BOARD_MMAP_PATH} ${MMAP_CONV_PY}
$(call print_target)
@mkdir -p $(dir $@)
@${MMAP_CONV_PY} --type conf $< $@
${CVI_BOARD_MEMMAP_LD_PATH}: ${BOARD_MMAP_PATH} ${MMAP_CONV_PY}
$(call print_target)
@mkdir -p $(dir $@)
@${MMAP_CONV_PY} --type ld $< $@
ifeq ($(wildcard ${BOARD_MMAP_PATH}),)
memory-map:
else
memory-map: ${CVI_BOARD_MEMMAP_H_PATH} ${CVI_BOARD_MEMMAP_CONF_PATH} ${CVI_BOARD_MEMMAP_LD_PATH}
endif
该脚本会自动生成 cvi_board_memmap.h
, cvi_board_memmap.conf
, cvi_board_memmap.ld
三个文件。
然后依赖 u-boot-dts
Makefile
u-boot-dts:
$(call print_target)
ifeq ($(UBOOT_SRC), u-boot-2021.10)
# U-boot doesn't has arch/arm64
ifeq ($(ARCH), arm64)
${Q}find ${BUILD_PATH}/boards/${CHIP_ARCH_L} \
\( -path "*linux/*.dts*" -o -path "*dts_${ARCH}/*.dts*" \) \
-exec cp {} ${UBOOT_PATH}/arch/arm/dts/ \;
${Q}find ${DTS_DEFATUL_PATHS} -name *.dts* -exec cp {} ${UBOOT_PATH}/arch/arm/dts/ \;
else
${Q}find ${BUILD_PATH}/boards/${CHIP_ARCH_L} \
\( -path "*linux/*.dts*" -o -path "*dts_${ARCH}/*.dts*" \) \
-exec cp {} ${UBOOT_PATH}/arch/${ARCH}/dts/ \;
${Q}find ${DTS_DEFATUL_PATHS} -name *.dts* -exec cp {} ${UBOOT_PATH}/arch/${ARCH}/dts/ \;
endif
endif
最终执行的命令为:
shell
find sophpi/build/boards/cv181x \
\( -path "*linux/*.dts*" -o -path "*dts_riscv/*.dts*" \) \
-exec cp {} sophpi/u-boot-2021.10/arch/riscv/dts/ \;
find sophpi/build/boards/default/dts/cv181x sophpi/build/boards/default/dts/cv181x_riscv -name *.dts* -exec cp {} sophpi/u-boot-2021.10/arch/riscv/dts/ \;
在 sophpi/u-boot-2021.10/arch/riscv/dts
目录下执行 tree
命令,查看相关设备树文件。我们理论上用的是 sg2002 相关的 sg2002_wevb_riscv64_sd.dts
这个文件。
shell
$ tree
.
├── ae350_32.dts
├── ae350_64.dts
├── ae350-u-boot.dtsi
├── binman.dtsi
├── cv1810c_wdmb_0006a_spinor.dts
├── cv1810c_wevb_0006a_spinand.dts
├── cv1810c_wevb_0006a_spinor.dts
├── cv1810h_wevb_0007a_spinor.dts
├── cv1811c_wdmb_0006a_spinor.dts
├── cv1811c_wevb_0006a_emmc.dts
├── cv1811c_wevb_0006a_spinand.dts
├── cv1811c_wevb_0006a_spinor.dts
├── cv1811h_wevb_0007a_emmc.dts
├── cv1811h_wevb_0007a_spinand.dts
├── cv1811h_wevb_0007a_spinor.dts
├── cv1812cp_sophpi_duo_sd.dts
├── cv1812cp_wevb_0006a_emmc.dts
├── cv1812cp_wevb_0006a_spinand.dts
├── cv1812cp_wevb_0006a_spinor.dts
├── cv1812h_wevb_0007a_emmc.dts
├── cv1812h_wevb_0007a_emmc_huashan.dts
├── cv1812h_wevb_0007a_spinand.dts
├── cv1812h_wevb_0007a_spinand_huashan.dts
├── cv1812h_wevb_0007a_spinor.dts
├── cv1812h_wevb_0007a_spinor_huashan.dts
├── cv1813h_wevb_0007a_emmc.dts
├── cv1813h_wevb_0007a_spinand.dts
├── cv1813h_wevb_0007a_spinor.dts
├── cv181x_asic_bga.dtsi
├── cv181x_asic_emmc.dtsi
├── cv181x_asic_qfn.dtsi
├── cv181x_asic_sd.dtsi
├── cv181x_asic_spinand.dtsi
├── cv181x_asic_spinor.dtsi
├── cv181x_base.dtsi
├── cv181x_base_riscv.dtsi
├── cv181x_default_memmap.dtsi
├── fu540-c000.dtsi
├── fu540-c000-u-boot.dtsi
├── fu540-hifive-unleashed-a00-ddr.dtsi
├── fu740-c000.dtsi
├── fu740-c000-u-boot.dtsi
├── fu740-hifive-unmatched-a00-ddr.dtsi
├── hifive-unleashed-a00.dts
├── hifive-unleashed-a00-u-boot.dtsi
├── hifive-unmatched-a00.dts
├── hifive-unmatched-a00-u-boot.dtsi
├── k210.dtsi
├── k210-maix-bit.dts
├── Makefile
├── microchip-mpfs-icicle-kit.dts
├── microchip-mpfs-icicle-kit-u-boot.dtsi
├── openpiton-riscv64.dts
├── qemu-virt.dts
├── sg2000_wevb_riscv64_sd.dts
└── sg2002_wevb_riscv64_sd.dts
- 执行到这里,才真正开始编译 u-boot,主要是以下几行命令
shell
${Q}$(MAKE) -j${NPROC} -C ${UBOOT_PATH} olddefconfig
${Q}$(MAKE) -j${NPROC} -C ${UBOOT_PATH} all
${Q}cat ${UBOOT_PATH}/${UBOOT_OUTPUT_FOLDER}/u-boot.bin > ${UBOOT_PATH}/${UBOOT_OUTPUT_FOLDER}/u-boot-raw.bin
最终产物在 sophpi/u-boot-2021.10/build/sg2002_wevb_riscv64_sd/u-boot-raw.bin
4、opensbi 编译
有了 u-boot 之后,开始编译 opensbi
为了兼容不同的运行需求,OpenSBI 支持三种类型的 Firmware,分别为:
- dynamic:从上一级 Boot Stage 获取下一级 Boot Stage 的入口信息,以 struct fw_dynamic_info 结构体通过 a2 寄存器传递。
- jump:假设下一级 Boot Stage Entry 为固定地址,直接跳转过去运行。
- payload:在 jump 的基础上,直接打包进来下一级 Boot Stage 的 Binary。下一级通常是 Bootloader 或 OS,比如 U-Boot,Linux。
相关编译脚本位置: build/scripts/fip_v2.mk
Makefile
opensbi: export CROSS_COMPILE=$(CONFIG_CROSS_COMPILE_SDK)
opensbi: u-boot-build
$(call print_target)
${Q}$(MAKE) -j${NPROC} -C ${OPENSBI_PATH} PLATFORM=generic \
FW_PAYLOAD_PATH=${UBOOT_PATH}/${UBOOT_OUTPUT_FOLDER}/u-boot-raw.bin \
FW_FDT_PATH=${UBOOT_PATH}/${UBOOT_OUTPUT_FOLDER}/arch/riscv/dts/${CHIP}_${BOARD}.dtb
根据以上脚本获知,sophpi 上采用的是 payload 模式,payload 文件为 u-boot-raw.bin,就是上面我们编译出来的文件。
FW_FDT_PATH 为设备树路径,为 sophpi/u-boot-2021.10/build/sg2002_wevb_riscv64_sd/arch/riscv/dts/sg2002_wevb_riscv64_sd.dtb
编译完成后, 产物在 sophpi/opensbi/build/platform/generic/firmware
目录下。
5、fsbl编译
编译完了u-boot 和 opensbi,继续往回推,来到了 fsbl-build。(中间还有一个 rtos 编译,暂时略过先)。
FSBL 是 First Stage Boot Loader 的缩写。
Makefile
fsbl-build: u-boot-build memory-map
$(call print_target)
${Q}mkdir -p ${FSBL_PATH}/build
${Q}ln -snrf -t ${FSBL_PATH}/build ${CVI_BOARD_MEMMAP_H_PATH}
${Q}$(MAKE) -j${NPROC} -C ${FSBL_PATH} O=${FSBL_OUTPUT_PATH}
${Q}cp ${FSBL_OUTPUT_PATH}/boot0 ${OUTPUT_DIR}/
最终执行的编译命令为 :
shell
make -j8 -C sophpi/fsbl O=sophpi/fsbl/build/sg2002_wevb_riscv64_sd BLCP_2ND_PATH=sophpi/freertos/cvitek/install/bin/cvirtos.bin \
LOADER_2ND_PATH=sophpi/u-boot-2021.10/build/sg2002_wevb_riscv64_sd/u-boot-raw.bin
主要来看看 fsbl 编译流程,从 fsbl/Makefile 文件开始
Makefile
all: fip bl2 blmacros
include ${MAKE_HELPERS_DIRECTORY}fip.mk
依次找到 fip 在 fsbl/make_helpers/fip.mk 文件
Makefile
gen-chip-conf:
$(print_target)
${Q}mkdir -p '${BUILD_PLAT}'
${Q}./plat/${CHIP_ARCH}/chip_conf.py ${CHIP_CONF_PATH}
macro_to_env = ${NM} '${BLMACROS_ELF}' | awk '/DEF_${1}/ { rc = 1; print "${1}=0x" $$1 } END { exit !rc }' >> ${BUILD_PLAT}/blmacros.env
blmacros-env: blmacros
$(print_target)
${Q}> ${BUILD_PLAT}/blmacros.env # clear .env first
${Q}$(call macro_to_env,MONITOR_RUNADDR)
${Q}$(call macro_to_env,BLCP_2ND_RUNADDR)
ifeq (${BUILD_BOOT0},y)
$(eval $(call add_define,ENABLE_BOOT0))
fip: fip_boot0
else
fip: fip-all
endif
fip-dep: bl2 blmacros-env gen-chip-conf
fip_boot0: fip-dep
$(print_target)
${Q}echo " [GEN] boot0"
${Q}. ${BUILD_PLAT}/blmacros.env && \
${FIPTOOL} -v genfip \
'${BUILD_PLAT}/boot0' \
--MONITOR_RUNADDR="$${MONITOR_RUNADDR}" \
--BLCP_2ND_RUNADDR="$${BLCP_2ND_RUNADDR}" \
--CHIP_CONF='${CHIP_CONF_PATH}' \
--NOR_INFO='${NOR_INFO}' \
--NAND_INFO='${NAND_INFO}'\
--BL2='${BUILD_PLAT}/bl2.bin' \
--BLCP_IMG_RUNADDR=${BLCP_IMG_RUNADDR} \
--BLCP_PARAM_LOADADDR=${BLCP_PARAM_LOADADDR} \
--BLCP=${BLCP_PATH} \
--DDR_PARAM='${DDR_PARAM_TEST_PATH}'
${Q}echo " [LS] " $$(ls -l '${BUILD_PLAT}/boot0')
${Q}cp ${BUILD_PLAT}/boot0 ${OUTPUT_DIR}
fip-simple: fip-dep
$(print_target)
${Q}echo " [GEN] fip.bin"
${Q}${FIPTOOL} -v genfip \
'${BUILD_PLAT}/fip.bin' \
--CHIP_CONF='${CHIP_CONF_PATH}' \
--NOR_INFO='${NOR_INFO}' \
--NAND_INFO='${NAND_INFO}'\
--BL2='${BUILD_PLAT}/bl2.bin'
${Q}echo " [LS] " $$(ls -l '${BUILD_PLAT}/fip.bin')
通过一堆复杂的操作。。。生成了一个 bl2.bin 文件。(正常情况下我们开发者也不会去修改这个玩意。。。)
主要关心 fip-all 这个操作,用于生成 fip.bin 文件。
6、fip.bin文件合成
查阅官方有限的资料,获知 fip.bin 为内含 bootloader+uboot 的文件
为啥要这么干?官方的文档里面是这么说的:
由于原生 u-boot 编译出 u-boot.bin 无法直接刻录到 FLASH 中。我们采取 ARM Trusted Firmware Design 中的 Firmware Image Package (FIP) 方式,将 uboot.bin 封装在 FIP.bin 里面。
通过 chatgpt 查询 fip 后得知:
FIP(Flexible Image Processor)文件是指存储在ARM架构的处理器设备上的固件映像文件。它主要用于引导和配置设备。FIP文件通常包含以下内容:
- Trusted Firmware-A(TF-A):TF-A 是 ARM 架构设备上的一个开源的可信固件。它负责设备的引导、安全检查和启动加载程序的执行。
- U-Boot:U-Boot 是一个开源的引导加载程序(bootloader),用于启动设备。它提供了引导设备的功能,并提供了配置和管理设备硬件的选项。
- ARM Trusted Firmware(ATF):ATF 是一组用于安全引导的固件,用于验证和启动设备上的其他软件组件(如操作系统)。
- 其他组件:FIP 文件还可以包含其他固件组件,如设备树(Device Tree)文件、TEE 固件(如 OP-TEE)、加密密钥和配置参数等。
FIP 文件在 ARM 架构设备上很常见,它们提供了引导和初始化处理器的必要组件。这些文件由设备制造商提供,并根据特定设备、硬件配置和需求进行定制。
按照前面的分析,fip.bin 在 fsbl 最后阶段合成
Makefile
fip-all: fip-dep
$(print_target)
${Q}echo " [GEN] fip.bin"
${Q}. ${BUILD_PLAT}/blmacros.env && \
${FIPTOOL} -v genfip \
'${BUILD_PLAT}/fip.bin' \
--MONITOR_RUNADDR="$${MONITOR_RUNADDR}" \
--BLCP_2ND_RUNADDR="$${BLCP_2ND_RUNADDR}" \
--CHIP_CONF='${CHIP_CONF_PATH}' \
--NOR_INFO='${NOR_INFO}' \
--NAND_INFO='${NAND_INFO}'\
--BL2='${BUILD_PLAT}/bl2.bin' \
--BLCP_IMG_RUNADDR=${BLCP_IMG_RUNADDR} \
--BLCP_PARAM_LOADADDR=${BLCP_PARAM_LOADADDR} \
--BLCP=${BLCP_PATH} \
--DDR_PARAM='${DDR_PARAM_TEST_PATH}' \
--BLCP_2ND='${BLCP_2ND_PATH}' \
--MONITOR='${MONITOR_PATH}' \
--LOADER_2ND='${LOADER_2ND_PATH}' \
--compress='${FIP_COMPRESS}'
${Q}echo " [LS] " $$(ls -l '${BUILD_PLAT}/fip.bin')
转换成实际执行命令为:
shell
. sophpi/fsbl/build/sg2002_wevb_riscv64_sd/blmacros.env && \
./plat/cv180x/fiptool.py -v genfip \
'sophpi/fsbl/build/sg2002_wevb_riscv64_sd/fip.bin' \
--MONITOR_RUNADDR="${MONITOR_RUNADDR}" \
--BLCP_2ND_RUNADDR="${BLCP_2ND_RUNADDR}" \
--CHIP_CONF='sophpi/fsbl/build/sg2002_wevb_riscv64_sd/chip_conf.bin' \
--NOR_INFO='FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' \
--NAND_INFO='00000000'\
--BL2='sophpi/fsbl/build/sg2002_wevb_riscv64_sd/bl2.bin' \
--BLCP_IMG_RUNADDR=0x05200200 \
--BLCP_PARAM_LOADADDR=0 \
--BLCP=test/empty.bin \
--DDR_PARAM='test/cv181x/ddr_param.bin' \
--BLCP_2ND='sophpi/freertos/cvitek/install/bin/cvirtos.bin' \
--MONITOR='../opensbi/build/platform/generic/firmware/fw_dynamic.bin' \
--LOADER_2ND='sophpi/u-boot-2021.10/build/sg2002_wevb_riscv64_sd/u-boot-raw.bin' \
--compress='lzma'