Makefile 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. #
  2. # Copyright 2019 NXP
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=tfa-layerscape
  9. PKG_VERSION:=lsdk-1903
  10. PKG_RELEASE:=1
  11. PKG_SOURCE_PROTO:=git
  12. PKG_SOURCE_URL:=https://source.codeaurora.org/external/qoriq/qoriq-components/atf
  13. PKG_SOURCE_VERSION:=7e34aebe658c7c3439d2d68b0ce6b9776e8e6996
  14. PKG_MIRROR_HASH:=9cf0bc32fa589a0ee7c48c87898679e645341f29da1253d0ba5d2e82c6ea074d
  15. PKG_BUILD_DEPENDS:=uboot-layerscape tfa-layerscape/host
  16. include $(INCLUDE_DIR)/host-build.mk
  17. include $(INCLUDE_DIR)/package.mk
  18. define Package/tfa-layerscape/Config
  19. define Package/tfa-$(1)
  20. SECTION:=boot
  21. CATEGORY:=Boot Loaders
  22. TITLE:=$(2)
  23. DEPENDS:=@TARGET_layerscape_armv8_64b +layerscape-rcw
  24. HIDDEN:=1
  25. VARIANT:=$(1)
  26. BIN_BL2:=$(3)
  27. BIN_FIP:=$(4)
  28. endef
  29. endef
  30. define Package/tfa-layerscape/Install
  31. define Package/tfa-$(1)/install
  32. $(INSTALL_DIR) $(STAGING_DIR_IMAGE)
  33. $(CP) $(PKG_BUILD_DIR)/$(BIN_BL2) $(STAGING_DIR_IMAGE)/$(1)-bl2.pbl
  34. $(CP) $(PKG_BUILD_DIR)/$(BIN_FIP) $(STAGING_DIR_IMAGE)/$(1)-fip.bin
  35. endef
  36. endef
  37. define Build/Compile
  38. $(eval $(Package/tfa-layerscape/$(BUILD_VARIANT))) \
  39. $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE=$(TARGET_CROSS) \
  40. fip pbl PLAT=$(PLAT) BOOT_MODE=$(BOOT_MODE) \
  41. RCW=$(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-rcw.bin \
  42. BL33=$(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-uboot.bin \
  43. FIPTOOL=$(STAGING_DIR_HOST)/bin/tfa-fiptool \
  44. CREATE_PBL=$(STAGING_DIR_HOST)/bin/tfa-create-pbl \
  45. BYTE_SWAP=$(STAGING_DIR_HOST)/bin/tfa-byte-swap
  46. endef
  47. HOST_CFLAGS += -Wall -Werror -pedantic -std=c99
  48. define Host/Compile
  49. $(MAKE) -C \
  50. $(HOST_BUILD_DIR)/tools/fiptool \
  51. CFLAGS="$(HOST_CFLAGS)" \
  52. LDFLAGS="$(HOST_LDFLAGS)"
  53. $(MAKE) -C \
  54. $(HOST_BUILD_DIR)/plat/nxp/tools \
  55. CFLAGS="$(HOST_CFLAGS)"
  56. endef
  57. define Host/Install
  58. $(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/fiptool/fiptool $(STAGING_DIR_HOST)/bin/tfa-fiptool
  59. $(INSTALL_BIN) $(HOST_BUILD_DIR)/plat/nxp/tools/create_pbl $(STAGING_DIR_HOST)/bin/tfa-create-pbl
  60. $(INSTALL_BIN) $(HOST_BUILD_DIR)/plat/nxp/tools/byte_swap $(STAGING_DIR_HOST)/bin/tfa-byte-swap
  61. endef
  62. define Package/tfa-layerscape/ls1012afrdm
  63. TITLE:=NXP LS1012AFRDM Trusted Firmware
  64. PLAT:=ls1012afrdm
  65. BOOT_MODE:=qspi
  66. BIN_BL2:=build/ls1012afrdm/release/bl2_qspi.pbl
  67. BIN_FIP:=build/ls1012afrdm/release/fip.bin
  68. endef
  69. define Package/tfa-layerscape/ls1012ardb
  70. TITLE:=NXP LS1012ARDB Trusted Firmware
  71. PLAT:=ls1012ardb
  72. BOOT_MODE:=qspi
  73. BIN_BL2:=build/ls1012ardb/release/bl2_qspi.pbl
  74. BIN_FIP:=build/ls1012ardb/release/fip.bin
  75. endef
  76. define Package/tfa-layerscape/ls1012afrwy
  77. TITLE:=NXP LS1012AFRWY Trusted Firmware
  78. PLAT:=ls1012afrwy
  79. BOOT_MODE:=qspi
  80. BIN_BL2:=build/ls1012afrwy/release/bl2_qspi.pbl
  81. BIN_FIP:=build/ls1012afrwy/release/fip.bin
  82. endef
  83. define Package/tfa-layerscape/ls1043ardb
  84. TITLE:=NXP LS1043ARDB Trusted Firmware
  85. PLAT:=ls1043ardb
  86. BOOT_MODE:=nor
  87. BIN_BL2:=build/ls1043ardb/release/bl2_nor.pbl
  88. BIN_FIP:=build/ls1043ardb/release/fip.bin
  89. endef
  90. define Package/tfa-layerscape/ls1043ardb-sdboot
  91. TITLE:=NXP LS1043ARDB SD Boot Trusted Firmware
  92. PLAT:=ls1043ardb
  93. BOOT_MODE:=sd
  94. BIN_BL2:=build/ls1043ardb/release/bl2_sd.pbl
  95. BIN_FIP:=build/ls1043ardb/release/fip.bin
  96. endef
  97. define Package/tfa-layerscape/ls1046ardb
  98. TITLE:=NXP LS1046ARDB Trusted Firmware
  99. PLAT:=ls1046ardb
  100. BOOT_MODE:=qspi
  101. BIN_BL2:=build/ls1046ardb/release/bl2_qspi.pbl
  102. BIN_FIP:=build/ls1046ardb/release/fip.bin
  103. endef
  104. define Package/tfa-layerscape/ls1046ardb-sdboot
  105. TITLE:=NXP LS1046ARDB SD Boot Trusted Firmware
  106. PLAT:=ls1046ardb
  107. BOOT_MODE:=sd
  108. BIN_BL2:=build/ls1046ardb/release/bl2_sd.pbl
  109. BIN_FIP:=build/ls1046ardb/release/fip.bin
  110. endef
  111. define Package/tfa-layerscape/ls1088ardb
  112. TITLE:=NXP LS1088ARDB Trusted Firmware
  113. PLAT:=ls1088ardb
  114. BOOT_MODE:=qspi
  115. BIN_BL2:=build/ls1088ardb/release/bl2_qspi.pbl
  116. BIN_FIP:=build/ls1088ardb/release/fip.bin
  117. endef
  118. define Package/tfa-layerscape/ls1088ardb-sdboot
  119. TITLE:=NXP LS1088ARDB SD Boot Trusted Firmware
  120. PLAT:=ls1088ardb
  121. BOOT_MODE:=sd
  122. BIN_BL2:=build/ls1088ardb/release/bl2_sd.pbl
  123. BIN_FIP:=build/ls1088ardb/release/fip.bin
  124. endef
  125. define Package/tfa-layerscape/ls2088ardb
  126. TITLE:=NXP LS2088ARDB Trusted Firmware
  127. PLAT:=ls2088ardb
  128. BOOT_MODE:=nor
  129. BIN_BL2:=build/ls2088ardb/release/bl2_nor.pbl
  130. BIN_FIP:=build/ls2088ardb/release/fip.bin
  131. endef
  132. TFAS := \
  133. ls1012afrdm \
  134. ls1012ardb \
  135. ls1012afrwy \
  136. ls1043ardb \
  137. ls1043ardb-sdboot \
  138. ls1046ardb \
  139. ls1046ardb-sdboot \
  140. ls1088ardb \
  141. ls1088ardb-sdboot \
  142. ls2088ardb
  143. $(eval $(call HostBuild))
  144. $(foreach tfa,$(TFAS), \
  145. $(eval $(Package/tfa-layerscape/$(tfa))) \
  146. $(eval $(call Package/tfa-layerscape/Config,$(tfa),$(TITLE),$(BIN_BL2),$(BIN_FIP))) \
  147. $(eval $(call Package/tfa-layerscape/Install,$(tfa))) \
  148. $(eval $(call BuildPackage,tfa-$(tfa))) \
  149. )