platform.mk 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #
  2. # Copyright (c) 2017-2024, Arm Limited and Contributors. All rights reserved.
  3. #
  4. # SPDX-License-Identifier: BSD-3-Clause
  5. #
  6. override RESET_TO_BL2 := 1
  7. override COLD_BOOT_SINGLE_CPU := 1
  8. override PROGRAMMABLE_RESET_ADDRESS := 1
  9. override USE_COHERENT_MEM := 1
  10. override ENABLE_SVE_FOR_NS := 0
  11. # Disabling ENABLE_PIE saves memory footprint a lot, but you need to adjust
  12. # UNIPHIER_MEM_BASE so that all TF images are loaded at their link addresses.
  13. override ENABLE_PIE := 1
  14. ALLOW_RO_XLAT_TABLES := 1
  15. ifeq ($(ALLOW_RO_XLAT_TABLES),1)
  16. BL31_CPPFLAGS += -DPLAT_RO_XLAT_TABLES
  17. BL32_CPPFLAGS += -DPLAT_RO_XLAT_TABLES
  18. endif
  19. # The dynamic xlat table is only used in BL2
  20. BL2_CPPFLAGS += -DPLAT_XLAT_TABLES_DYNAMIC
  21. # Cortex-A53 revision r0p4-51rel0
  22. # needed for LD20, unneeded for LD11, PXs3 (no ACE)
  23. ERRATA_A53_855873 := 1
  24. FIP_ALIGN := 512
  25. ifeq ($(NEED_BL32),yes)
  26. $(eval $(call add_define,UNIPHIER_LOAD_BL32))
  27. endif
  28. # Libraries
  29. include lib/xlat_tables_v2/xlat_tables.mk
  30. PLAT_PATH := plat/socionext/uniphier
  31. PLAT_INCLUDES := -I$(PLAT_PATH)/include
  32. # common sources for BL2, BL31 (and BL32 if SPD=tspd)
  33. PLAT_BL_COMMON_SOURCES += plat/common/aarch64/crash_console_helpers.S \
  34. $(PLAT_PATH)/uniphier_console.S \
  35. $(PLAT_PATH)/uniphier_console_setup.c \
  36. $(PLAT_PATH)/uniphier_helpers.S \
  37. $(PLAT_PATH)/uniphier_soc_info.c \
  38. $(PLAT_PATH)/uniphier_xlat_setup.c \
  39. ${XLAT_TABLES_LIB_SRCS}
  40. BL2_SOURCES += common/desc_image_load.c \
  41. drivers/io/io_block.c \
  42. drivers/io/io_fip.c \
  43. drivers/io/io_memmap.c \
  44. drivers/io/io_storage.c \
  45. lib/cpus/aarch64/cortex_a53.S \
  46. lib/cpus/aarch64/cortex_a72.S \
  47. $(PLAT_PATH)/uniphier_bl2_setup.c \
  48. $(PLAT_PATH)/uniphier_boot_device.c \
  49. $(PLAT_PATH)/uniphier_emmc.c \
  50. $(PLAT_PATH)/uniphier_image_desc.c \
  51. $(PLAT_PATH)/uniphier_io_storage.c \
  52. $(PLAT_PATH)/uniphier_nand.c \
  53. $(PLAT_PATH)/uniphier_scp.c \
  54. $(PLAT_PATH)/uniphier_usb.c
  55. # Include GICv3 driver files
  56. include drivers/arm/gic/v3/gicv3.mk
  57. BL31_SOURCES += drivers/arm/cci/cci.c \
  58. ${GICV3_SOURCES} \
  59. lib/cpus/aarch64/cortex_a53.S \
  60. lib/cpus/aarch64/cortex_a72.S \
  61. plat/common/plat_gicv3.c \
  62. plat/common/plat_psci_common.c \
  63. $(PLAT_PATH)/uniphier_bl31_setup.c \
  64. $(PLAT_PATH)/uniphier_boot_device.c \
  65. $(PLAT_PATH)/uniphier_cci.c \
  66. $(PLAT_PATH)/uniphier_gicv3.c \
  67. $(PLAT_PATH)/uniphier_psci.c \
  68. $(PLAT_PATH)/uniphier_scp.c \
  69. $(PLAT_PATH)/uniphier_smp.S \
  70. $(PLAT_PATH)/uniphier_syscnt.c \
  71. $(PLAT_PATH)/uniphier_topology.c
  72. ifeq (${TRUSTED_BOARD_BOOT},1)
  73. include drivers/auth/mbedtls/mbedtls_crypto.mk
  74. include drivers/auth/mbedtls/mbedtls_x509.mk
  75. BL2_SOURCES += drivers/auth/auth_mod.c \
  76. drivers/auth/crypto_mod.c \
  77. drivers/auth/img_parser_mod.c \
  78. drivers/auth/tbbr/tbbr_cot_common.c \
  79. drivers/auth/tbbr/tbbr_cot_bl2.c \
  80. plat/common/tbbr/plat_tbbr.c \
  81. $(PLAT_PATH)/uniphier_rotpk.S \
  82. $(PLAT_PATH)/uniphier_tbbr.c
  83. ROT_KEY = $(BUILD_PLAT)/rot_key.pem
  84. ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin
  85. $(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
  86. $(BUILD_PLAT)/bl2/uniphier_rotpk.o: $(ROTPK_HASH)
  87. certificates: $(ROT_KEY)
  88. $(ROT_KEY): | $$(@D)/
  89. $(s)echo " OPENSSL $@"
  90. $(q)${OPENSSL_BIN_PATH}/openssl genrsa 2048 > $@ 2>/dev/null
  91. $(ROTPK_HASH): $(ROT_KEY) | $$(@D)/
  92. $(s)echo " OPENSSL $@"
  93. $(q)${OPENSSL_BIN_PATH}/openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
  94. ${OPENSSL_BIN_PATH}/openssl dgst -sha256 -binary > $@ 2>/dev/null
  95. endif
  96. ifeq (${FIP_GZIP},1)
  97. include lib/zlib/zlib.mk
  98. BL2_SOURCES += common/image_decompress.c \
  99. $(ZLIB_SOURCES)
  100. $(eval $(call add_define,UNIPHIER_DECOMPRESS_GZIP))
  101. # compress all images loaded by BL2
  102. SCP_BL2_PRE_TOOL_FILTER := GZIP
  103. BL31_PRE_TOOL_FILTER := GZIP
  104. BL32_PRE_TOOL_FILTER := GZIP
  105. BL33_PRE_TOOL_FILTER := GZIP
  106. endif
  107. .PHONY: bl2_gzip
  108. bl2_gzip: $(BUILD_PLAT)/bl2.bin.gz
  109. %.gz: %
  110. $(s)echo " GZIP $@"
  111. $(q)gzip -n -f -9 $< --stdout > $@