arm-trusted-firmware.mk 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. ################################################################################
  2. #
  3. # arm-trusted-firmware
  4. #
  5. ################################################################################
  6. ARM_TRUSTED_FIRMWARE_VERSION = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_VERSION))
  7. ARM_TRUSTED_FIRMWARE_LICENSE = BSD-3-Clause
  8. ARM_TRUSTED_FIRMWARE_LICENSE_FILES = license.rst
  9. ifeq ($(ARM_TRUSTED_FIRMWARE_VERSION),custom)
  10. # Handle custom ATF tarballs as specified by the configuration
  11. ARM_TRUSTED_FIRMWARE_TARBALL = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL_LOCATION))
  12. ARM_TRUSTED_FIRMWARE_SITE = $(patsubst %/,%,$(dir $(ARM_TRUSTED_FIRMWARE_TARBALL)))
  13. ARM_TRUSTED_FIRMWARE_SOURCE = $(notdir $(ARM_TRUSTED_FIRMWARE_TARBALL))
  14. BR_NO_CHECK_HASH_FOR += $(ARM_TRUSTED_FIRMWARE_SOURCE)
  15. else ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT),y)
  16. ARM_TRUSTED_FIRMWARE_SITE = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_URL))
  17. ARM_TRUSTED_FIRMWARE_SITE_METHOD = git
  18. BR_NO_CHECK_HASH_FOR += $(ARM_TRUSTED_FIRMWARE_SOURCE)
  19. else
  20. ARM_TRUSTED_FIRMWARE_SITE = $(call github,ARM-software,arm-trusted-firmware,$(ARM_TRUSTED_FIRMWARE_VERSION))
  21. endif
  22. ARM_TRUSTED_FIRMWARE_INSTALL_IMAGES = YES
  23. ARM_TRUSTED_FIRMWARE_PLATFORM = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM))
  24. ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
  25. CROSS_COMPILE="$(TARGET_CROSS)" \
  26. $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES)) \
  27. PLAT=$(ARM_TRUSTED_FIRMWARE_PLATFORM)
  28. ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33),y)
  29. ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33=$(BINARIES_DIR)/u-boot.bin
  30. ARM_TRUSTED_FIRMWARE_DEPENDENCIES += uboot
  31. endif
  32. ifeq ($(BR2_TARGET_VEXPRESS_FIRMWARE),y)
  33. ARM_TRUSTED_FIRMWARE_MAKE_OPTS += SCP_BL2=$(BINARIES_DIR)/scp-fw.bin
  34. ARM_TRUSTED_FIRMWARE_DEPENDENCIES += vexpress-firmware
  35. endif
  36. ifeq ($(BR2_TARGET_BINARIES_MARVELL),y)
  37. ARM_TRUSTED_FIRMWARE_MAKE_OPTS += SCP_BL2=$(BINARIES_DIR)/scp-fw.bin
  38. ARM_TRUSTED_FIRMWARE_DEPENDENCIES += binaries-marvell
  39. endif
  40. ifeq ($(BR2_TARGET_MV_DDR_MARVELL),y)
  41. ARM_TRUSTED_FIRMWARE_MAKE_OPTS += MV_DDR_PATH=$(MV_DDR_MARVELL_DIR)
  42. ARM_TRUSTED_FIRMWARE_DEPENDENCIES += mv-ddr-marvell
  43. endif
  44. ARM_TRUSTED_FIRMWARE_MAKE_TARGETS = all
  45. ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP),y)
  46. ARM_TRUSTED_FIRMWARE_MAKE_TARGETS += fip
  47. ARM_TRUSTED_FIRMWARE_DEPENDENCIES += host-openssl
  48. # fiptool only exists in newer (>= 1.3) versions of ATF, so we build
  49. # it conditionally. We need to explicitly build it as it requires
  50. # OpenSSL, and therefore needs to be passed proper variables to find
  51. # the host OpenSSL.
  52. define ARM_TRUSTED_FIRMWARE_BUILD_FIPTOOL
  53. if test -d $(@D)/tools/fiptool; then \
  54. $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/tools/fiptool \
  55. $(ARM_TRUSTED_FIRMWARE_MAKE_OPTS) \
  56. CPPFLAGS="$(HOST_CPPFLAGS)" \
  57. LDLIBS="$(HOST_LDFLAGS) -lcrypto" ; \
  58. fi
  59. endef
  60. endif
  61. ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31),y)
  62. ARM_TRUSTED_FIRMWARE_MAKE_TARGETS += bl31
  63. endif
  64. define ARM_TRUSTED_FIRMWARE_BUILD_CMDS
  65. $(ARM_TRUSTED_FIRMWARE_BUILD_FIPTOOL)
  66. $(TARGET_CONFIGURE_OPTS) \
  67. $(MAKE) -C $(@D) $(ARM_TRUSTED_FIRMWARE_MAKE_OPTS) \
  68. $(ARM_TRUSTED_FIRMWARE_MAKE_TARGETS)
  69. endef
  70. define ARM_TRUSTED_FIRMWARE_INSTALL_IMAGES_CMDS
  71. cp -dpf $(@D)/build/$(ARM_TRUSTED_FIRMWARE_PLATFORM)/release/*.bin $(BINARIES_DIR)/
  72. endef
  73. # Configuration check
  74. ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE)$(BR_BUILDING),yy)
  75. ifeq ($(ARM_TRUSTED_FIRMWARE_VERSION),custom)
  76. ifeq ($(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL_LOCATION))),)
  77. $(error No tarball location specified. Please check BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL_LOCATION))
  78. endif
  79. endif
  80. ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT),y)
  81. ifeq ($(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_URL)),)
  82. $(error No repository specified. Please check BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_URL)
  83. endif
  84. endif
  85. endif
  86. $(eval $(generic-package))