pbl_ch2.mk 2.2 KB

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