config_secure.mk 4.3 KB

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