blob: e6f1d8b9549e39f09baa1badec973c0b393baf01 [file] [log] [blame]
Pankaj Guptae55f6c42020-12-09 14:02:39 +05301#
2# Copyright 2020 NXP
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#
7
8CREATE_PBL ?= ${CREATE_PBL_TOOL_PATH}/create_pbl${BIN_EXT}
9BYTE_SWAP ?= ${CREATE_PBL_TOOL_PATH}/byte_swap${BIN_EXT}
10
11HOST_GCC := gcc
12
13.PHONY: pbl
14pbl: ${BUILD_PLAT}/bl2.bin
15ifeq ($(SECURE_BOOT),yes)
16pbl: ${BUILD_PLAT}/bl2.bin
17ifeq ($(RCW),"")
18 ${Q}echo "Platform ${PLAT} requires rcw file. Please set RCW to point to the right RCW file for boot mode ${BOOT_MODE}"
19else
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
32ifeq (${BOOT_MODE}, qspi)
33ifeq ($(SWAP),1)
34 ${Q}echo "Byteswapping RCW for QSPI"
35 ${BYTE_SWAP} ${BUILD_PLAT}/bl2_${BOOT_MODE}_sec.pbl;
36endif # SWAP
37endif # BOOT_MODE
38 cd ${CREATE_PBL_TOOL_PATH}; ${MAKE} clean ; cd -;
39endif
40else # NON SECURE_BOOT
41ifeq ($(RCW),"")
42 ${Q}echo "Platform ${PLAT} requires rcw file. Please set RCW to point to the right RCW file for boot mode ${BOOT_MODE}"
43else
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
49ifeq (${BOOT_MODE}, qspi)
50ifeq ($(SWAP),1)
51 ${Q}echo "Byteswapping RCW for QSPI"
52 ${BYTE_SWAP} ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl;
53endif # SWAP
54endif # BOOT_MODE
55 cd ${CREATE_PBL_TOOL_PATH}; ${MAKE} clean ; cd -;
56endif
57endif # SECURE_BOOT
58
59
60