blob: 47ff8922c92b390aa6f60ee6e6a0a881245e7a73 [file] [log] [blame]
Pankaj Guptae55f6c42020-12-09 14:02:39 +05301#
2# Copyright 2020 NXP
Chris Kayfaab7482025-01-13 15:57:32 +00003# Copyright (c) 2025, Arm Limited and Contributors. All rights reserved.
Pankaj Guptae55f6c42020-12-09 14:02:39 +05304#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7#
8
Chris Kayfaab7482025-01-13 15:57:32 +00009CREATE_PBL ?= ${CREATE_PBL_TOOL_PATH}/create_pbl$(.exe)
10BYTE_SWAP ?= ${CREATE_PBL_TOOL_PATH}/byte_swap$(.exe)
Pankaj Guptae55f6c42020-12-09 14:02:39 +053011
12HOST_GCC := gcc
13
14.PHONY: pbl
15pbl: ${BUILD_PLAT}/bl2.bin
16ifeq ($(SECURE_BOOT),yes)
17pbl: ${BUILD_PLAT}/bl2.bin
18ifeq ($(RCW),"")
Chris Kay1870c722024-05-02 17:52:37 +000019 $(s)echo "Platform ${PLAT} requires rcw file. Please set RCW to point to the right RCW file for boot mode ${BOOT_MODE}"
Pankaj Guptae55f6c42020-12-09 14:02:39 +053020else
21 # Generate header for bl2.bin
Chris Kay1870c722024-05-02 17:52:37 +000022 $(q)$(CST_DIR)/create_hdr_isbc --in ${BUILD_PLAT}/bl2.bin --out ${BUILD_PLAT}/hdr_bl2 ${BL2_INPUT_FILE}
Pankaj Guptae55f6c42020-12-09 14:02:39 +053023 # Compile create_pbl tool
Chris Kay1870c722024-05-02 17:52:37 +000024 $(q)${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${CREATE_PBL_TOOL_PATH};\
Pankaj Guptae55f6c42020-12-09 14:02:39 +053025 # Add bl2.bin to RCW
26 ${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE}\
27 -o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl ;\
28 # Add header to RCW
29 ${CREATE_PBL} -r ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl -i ${BUILD_PLAT}/hdr_bl2 -b ${BOOT_MODE} -c ${SOC_NUM} \
30 -d ${BL2_HDR_LOC} -e ${BL2_HDR_LOC} -o ${BUILD_PLAT}/bl2_${BOOT_MODE}_sec.pbl -s;\
31 rm ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl
32# Swapping of RCW is required for QSPi Chassis 2 devices
33ifeq (${BOOT_MODE}, qspi)
34ifeq ($(SWAP),1)
Chris Kay1870c722024-05-02 17:52:37 +000035 $(s)echo "Byteswapping RCW for QSPI"
Pankaj Guptae55f6c42020-12-09 14:02:39 +053036 ${BYTE_SWAP} ${BUILD_PLAT}/bl2_${BOOT_MODE}_sec.pbl;
37endif # SWAP
38endif # BOOT_MODE
39 cd ${CREATE_PBL_TOOL_PATH}; ${MAKE} clean ; cd -;
40endif
41else # NON SECURE_BOOT
42ifeq ($(RCW),"")
Chris Kay1870c722024-05-02 17:52:37 +000043 $(s)echo "Platform ${PLAT} requires rcw file. Please set RCW to point to the right RCW file for boot mode ${BOOT_MODE}"
Pankaj Guptae55f6c42020-12-09 14:02:39 +053044else
45 # -a option appends the image for Chassis 3 devices in case of non secure boot
Chris Kay1870c722024-05-02 17:52:37 +000046 $(q)${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${CREATE_PBL_TOOL_PATH};
Pankaj Guptae55f6c42020-12-09 14:02:39 +053047 ${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE} \
48 -o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl ;
49# Swapping of RCW is required for QSPi Chassis 2 devices
50ifeq (${BOOT_MODE}, qspi)
51ifeq ($(SWAP),1)
Chris Kay1870c722024-05-02 17:52:37 +000052 $(s)echo "Byteswapping RCW for QSPI"
Pankaj Guptae55f6c42020-12-09 14:02:39 +053053 ${BYTE_SWAP} ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl;
54endif # SWAP
55endif # BOOT_MODE
56 cd ${CREATE_PBL_TOOL_PATH}; ${MAKE} clean ; cd -;
57endif
58endif # SECURE_BOOT