trusted-firmware-a.mk 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. PKG_NAME ?= trusted-firmware-a
  2. PKG_CPE_ID ?= cpe:/a:arm:trusted_firmware-a
  3. ifndef PKG_SOURCE_PROTO
  4. PKG_SOURCE = trusted-firmware-a-$(PKG_VERSION)-libre.tar.gz
  5. PKG_SOURCE_URL:=https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/snapshot
  6. endif
  7. PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  8. PKG_TARGETS := bin
  9. PKG_FLAGS:=nonshared
  10. PKG_LICENSE:=BSD-3-Clause
  11. PKG_LICENSE_FILES:=docs/license.rst
  12. PKG_BUILD_PARALLEL:=1
  13. export GCC_HONOUR_COPTS=s
  14. define Package/trusted-firmware-a/install/default
  15. $(CP) $(patsubst %,$(PKG_BUILD_DIR)/build/$(PLAT)/release/%,$(TFA_IMAGE)) $(1)/
  16. endef
  17. Package/trusted-firmware-a/install = $(Package/trusted-firmware-a/install/default)
  18. define Trusted-Firmware-A/Init
  19. BUILD_TARGET:=
  20. BUILD_SUBTARGET:=
  21. BUILD_DEVICES:=
  22. NAME:=
  23. DEPENDS:=
  24. HIDDEN:=
  25. DEFAULT:=
  26. PLAT:=
  27. VARIANT:=$(1)
  28. TFA_IMAGE:=
  29. endef
  30. TARGET_DEP = TARGET_$(BUILD_TARGET)$(if $(BUILD_SUBTARGET),_$(BUILD_SUBTARGET))
  31. define Build/Trusted-Firmware-A/Target
  32. $(eval $(call Trusted-Firmware-A/Init,$(1)))
  33. $(eval $(call Trusted-Firmware-A/Default,$(1)))
  34. $(eval $(call Trusted-Firmware-A/$(1),$(1)))
  35. define Package/trusted-firmware-a-$(1)
  36. SECTION:=boot
  37. CATEGORY:=Boot Loaders
  38. TITLE:=Trusted-Firmware-A for $(NAME)
  39. VARIANT:=$(VARIANT)
  40. DEPENDS:=@!IN_SDK $(DEPENDS)
  41. HIDDEN:=$(HIDDEN)
  42. ifneq ($(BUILD_TARGET),)
  43. DEPENDS += @$(TARGET_DEP)
  44. ifneq ($(BUILD_DEVICES),)
  45. DEFAULT := y if ($(TARGET_DEP)_Default \
  46. $(patsubst %,|| $(TARGET_DEP)_DEVICE_%,$(BUILD_DEVICES)) \
  47. $(patsubst %,|| $(patsubst TARGET_%,TARGET_DEVICE_%,$(TARGET_DEP))_DEVICE_%,$(BUILD_DEVICES)))
  48. endif
  49. endif
  50. $(if $(DEFAULT),DEFAULT:=$(DEFAULT))
  51. URL:=https://www.trustedfirmware.org/projects/tf-a/
  52. endef
  53. define Package/trusted-firmware-a-$(1)/install
  54. $$(Package/trusted-firmware-a/install)
  55. endef
  56. endef
  57. define Build/Configure/Trusted-Firmware-A
  58. $(INSTALL_DIR) $(STAGING_DIR)/usr/include
  59. endef
  60. DTC=$(wildcard $(LINUX_DIR)/scripts/dtc/dtc)
  61. define Build/Compile/Trusted-Firmware-A
  62. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  63. CROSS_COMPILE=$(TARGET_CROSS) \
  64. OPENSSL_DIR=$(STAGING_DIR_HOST) \
  65. $(if $(DTC),DTC="$(DTC)") \
  66. PLAT=$(PLAT) \
  67. BUILD_STRING="libreCMC v$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \
  68. $(if $(CONFIG_BINUTILS_VERSION_2_37)$(CONFIG_BINUTILS_VERSION_2_38),,LDFLAGS="-no-warn-rwx-segments") \
  69. $(TFA_MAKE_FLAGS)
  70. endef
  71. define BuildPackage/Trusted-Firmware-A/Defaults
  72. Build/Configure/Default = $$$$(Build/Configure/Trusted-Firmware-A)
  73. Build/Compile/Default = $$$$(Build/Compile/Trusted-Firmware-A)
  74. endef
  75. define BuildPackage/Trusted-Firmware-A
  76. $(eval $(call BuildPackage/Trusted-Firmware-A/Defaults))
  77. $(foreach type,$(if $(DUMP),$(TFA_TARGETS),$(BUILD_VARIANT)), \
  78. $(eval $(call Build/Trusted-Firmware-A/Target,$(type)))
  79. )
  80. $(eval $(call Build/DefaultTargets))
  81. $(foreach type,$(if $(DUMP),$(TFA_TARGETS),$(BUILD_VARIANT)), \
  82. $(call BuildPackage,trusted-firmware-a-$(type))
  83. )
  84. endef