Debian Codegraph @

tools/nxp/create_pbl/pbl_ch2.mk

raw
1 #
2 # Copyright 2020 NXP
3 #
4 # SPDX-License-Identifier: BSD-3-Clause
5 #
6 #
7
8 CREATE_PBL ?= ${CREATE_PBL_TOOL_PATH}/create_pbl${BIN_EXT}
9 BYTE_SWAP ?= ${CREATE_PBL_TOOL_PATH}/byte_swap${BIN_EXT}
10
11 HOST_GCC := gcc
12
13 .PHONY: pbl
14 pbl: ${BUILD_PLAT}/bl2.bin
15 ifeq ($(SECURE_BOOT),yes)
16 pbl: ${BUILD_PLAT}/bl2.bin
17 ifeq ($(RCW),"")
18 $(s)echo "Platform ${PLAT} requires rcw file. Please set RCW to point to the right RCW file for boot mode ${BOOT_MODE}"
19 else
20 # Generate header for bl2.bin
21 $(q)$(CST_DIR)/create_hdr_isbc --in ${BUILD_PLAT}/bl2.bin --out ${BUILD_PLAT}/hdr_bl2 ${BL2_INPUT_FILE}
22 # Compile create_pbl tool
23 $(q)${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${CREATE_PBL_TOOL_PATH};\
24 # Add bl2.bin to RCW
25 ${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE}\
26 -o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl ;\
27 # Add header to RCW
28 ${CREATE_PBL} -r ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl -i ${BUILD_PLAT}/hdr_bl2 -b ${BOOT_MODE} -c ${SOC_NUM} \
29 -d ${BL2_HDR_LOC} -e ${BL2_HDR_LOC} -o ${BUILD_PLAT}/bl2_${BOOT_MODE}_sec.pbl -s;\
30 rm ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl
31 # Swapping of RCW is required for QSPi Chassis 2 devices
32 ifeq (${BOOT_MODE}, qspi)
33 ifeq ($(SWAP),1)
34 $(s)echo "Byteswapping RCW for QSPI"
35 ${BYTE_SWAP} ${BUILD_PLAT}/bl2_${BOOT_MODE}_sec.pbl;
36 endif # SWAP
37 endif # BOOT_MODE
38 cd ${CREATE_PBL_TOOL_PATH}; ${MAKE} clean ; cd -;
39 endif
40 else # NON SECURE_BOOT
41 ifeq ($(RCW),"")
42 $(s)echo "Platform ${PLAT} requires rcw file. Please set RCW to point to the right RCW file for boot mode ${BOOT_MODE}"
43 else
44 # -a option appends the image for Chassis 3 devices in case of non secure boot
45 $(q)${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${CREATE_PBL_TOOL_PATH};
46 ${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE} \
47 -o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl ;
48 # Swapping of RCW is required for QSPi Chassis 2 devices
49 ifeq (${BOOT_MODE}, qspi)
50 ifeq ($(SWAP),1)
51 $(s)echo "Byteswapping RCW for QSPI"
52 ${BYTE_SWAP} ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl;
53 endif # SWAP
54 endif # BOOT_MODE
55 cd ${CREATE_PBL_TOOL_PATH}; ${MAKE} clean ; cd -;
56 endif
57 endif # SECURE_BOOT