config_secure.mk 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #
  2. # Copyright (C) 2016, Texas Instruments, Incorporated - http://www.ti.com/
  3. #
  4. # SPDX-License-Identifier: GPL-2.0+
  5. #
  6. quiet_cmd_mkomapsecimg = SECURE $@
  7. ifneq ($(TI_SECURE_DEV_PKG),)
  8. ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh),)
  9. ifneq ($(CONFIG_SPL_BUILD),)
  10. cmd_mkomapsecimg = $(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh \
  11. $(patsubst u-boot-spl_HS_%,%,$(@F)) $< $@ $(CONFIG_ISW_ENTRY_ADDR) \
  12. $(if $(KBUILD_VERBOSE:1=), >/dev/null)
  13. else
  14. cmd_mkomapsecimg = $(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh \
  15. $(patsubst u-boot_HS_%,%,$(@F)) $< $@ $(CONFIG_ISW_ENTRY_ADDR) \
  16. $(if $(KBUILD_VERBOSE:1=), >/dev/null)
  17. endif
  18. else
  19. cmd_mkomapsecimg = echo "WARNING:" \
  20. "$(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh not found." \
  21. "$@ was NOT secured!"; cp $< $@
  22. endif
  23. else
  24. cmd_mkomapsecimg = echo "WARNING: TI_SECURE_DEV_PKG environment" \
  25. "variable must be defined for TI secure devices. \
  26. $@ was NOT secured!"; cp $< $@
  27. endif
  28. ifdef CONFIG_SPL_LOAD_FIT
  29. quiet_cmd_omapsecureimg = SECURE $@
  30. ifneq ($(TI_SECURE_DEV_PKG),)
  31. ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh),)
  32. cmd_omapsecureimg = $(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh \
  33. $< $@ \
  34. $(if $(KBUILD_VERBOSE:1=), >/dev/null)
  35. else
  36. cmd_omapsecureimg = echo "WARNING:" \
  37. "$(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh not found." \
  38. "$@ was NOT secured!"; cp $< $@
  39. endif
  40. else
  41. cmd_omapsecureimg = echo "WARNING: TI_SECURE_DEV_PKG environment" \
  42. "variable must be defined for TI secure devices." \
  43. "$@ was NOT secured!"; cp $< $@
  44. endif
  45. endif
  46. # Standard X-LOADER target (QPSI, NOR flash)
  47. u-boot-spl_HS_X-LOADER: $(obj)/u-boot-spl.bin FORCE
  48. $(call if_changed,mkomapsecimg)
  49. # For MLO targets (SD card boot) the final file name that is copied to the SD
  50. # card FAT partition must be MLO, so we make a copy of the output file to a new
  51. # file with that name
  52. u-boot-spl_HS_MLO: $(obj)/u-boot-spl.bin FORCE
  53. $(call if_changed,mkomapsecimg)
  54. @if [ -f $@ ]; then \
  55. cp -f $@ MLO; \
  56. fi
  57. # Standard 2ND target (certain peripheral boot modes)
  58. u-boot-spl_HS_2ND: $(obj)/u-boot-spl.bin FORCE
  59. $(call if_changed,mkomapsecimg)
  60. # Standard ULO target (certain peripheral boot modes)
  61. u-boot-spl_HS_ULO: $(obj)/u-boot-spl.bin FORCE
  62. $(call if_changed,mkomapsecimg)
  63. # Standard ISSW target (certain devices, various boot modes), when copied to
  64. # an SD card FAT partition this file must be called "MLO", we make a copy with
  65. # this name to make this clear
  66. u-boot-spl_HS_ISSW: $(obj)/u-boot-spl.bin FORCE
  67. $(call if_changed,mkomapsecimg)
  68. @if [ -f $@ ]; then \
  69. cp -f $@ MLO; \
  70. fi
  71. # For SPI flash on AM335x and AM43xx, these require special byte swap handling
  72. # so we use the SPI_X-LOADER target instead of X-LOADER and let the
  73. # create-boot-image.sh script handle that
  74. u-boot-spl_HS_SPI_X-LOADER: $(obj)/u-boot-spl.bin FORCE
  75. $(call if_changed,mkomapsecimg)
  76. # For supporting single stage boot on keystone, the image is a full u-boot
  77. # file, not an SPL. This will work for all boot devices, other than SPI
  78. # flash. On Keystone devices when booting from an SD card FAT partition this
  79. # file must be called "MLO"
  80. u-boot_HS_MLO: $(obj)/u-boot.bin
  81. $(call if_changed,mkomapsecimg)
  82. @if [ -f $@ ]; then \
  83. cp -f $@ MLO; \
  84. fi
  85. # For supporting single stage XiP QSPI on AM43xx, the image is a full u-boot
  86. # file, not an SPL. In this case the mkomapsecimg command looks for a
  87. # u-boot-HS_* prefix
  88. u-boot_HS_XIP_X-LOADER: $(obj)/u-boot.bin FORCE
  89. $(call if_changed,mkomapsecimg)
  90. # For supporting the SPL loading and interpreting of FIT images whose
  91. # components are pre-processed before being integrated into the FIT image in
  92. # order to secure them in some way
  93. ifdef CONFIG_SPL_LOAD_FIT
  94. MKIMAGEFLAGS_u-boot_HS.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
  95. -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
  96. -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \
  97. $(patsubst %,-b arch/$(ARCH)/dts/%.dtb_HS,$(subst ",,$(CONFIG_OF_LIST)))
  98. OF_LIST_TARGETS = $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST)))
  99. $(OF_LIST_TARGETS): dtbs
  100. %.dtb_HS: %.dtb FORCE
  101. $(call if_changed,omapsecureimg)
  102. u-boot-nodtb_HS.bin: u-boot-nodtb.bin FORCE
  103. $(call if_changed,omapsecureimg)
  104. u-boot_HS.img: u-boot-nodtb_HS.bin u-boot.img $(patsubst %.dtb,%.dtb_HS,$(OF_LIST_TARGETS)) FORCE
  105. $(call if_changed,mkimage)
  106. $(Q)if [ -f $@ ]; then \
  107. cp -f $@ u-boot.img; \
  108. fi
  109. endif