config.mk 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # SPDX-License-Identifier: GPL-2.0+
  2. #
  3. # Copyright (C) 2017-2018 Texas Instruments Incorporated - http://www.ti.com/
  4. # Lokesh Vutla <lokeshvutla@ti.com>
  5. ifdef CONFIG_SPL_BUILD
  6. # Openssl is required to generate x509 certificate.
  7. # Error out if openssl is not available.
  8. ifeq ($(shell which openssl),)
  9. $(error "No openssl in $(PATH), consider installing openssl")
  10. endif
  11. IMAGE_SIZE= $(shell cat $(obj)/u-boot-spl.bin | wc -c)
  12. MAX_SIZE= $(shell printf "%d" $(CONFIG_SYS_K3_MAX_DOWNLODABLE_IMAGE_SIZE))
  13. ifeq ($(CONFIG_SYS_K3_KEY), "")
  14. KEY=""
  15. # On HS use real key or warn if not available
  16. ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
  17. ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/keys/custMpk.pem),)
  18. KEY=$(TI_SECURE_DEV_PKG)/keys/custMpk.pem
  19. else
  20. $(warning "WARNING: signing key not found. Random key will NOT work on HS hardware!")
  21. endif
  22. endif
  23. else
  24. KEY=$(patsubst "%",$(srctree)/%,$(CONFIG_SYS_K3_KEY))
  25. endif
  26. # tiboot3.bin is mandated by ROM and ROM only supports R5 boot.
  27. # So restrict tiboot3.bin creation for CPU_V7R.
  28. ifdef CONFIG_CPU_V7R
  29. image_check: $(obj)/u-boot-spl.bin FORCE
  30. @if [ $(IMAGE_SIZE) -gt $(MAX_SIZE) ]; then \
  31. echo "===============================================" >&2; \
  32. echo "ERROR: Final Image too big. " >&2; \
  33. echo "$< size = $(IMAGE_SIZE), max size = $(MAX_SIZE)" >&2; \
  34. echo "===============================================" >&2; \
  35. exit 1; \
  36. fi
  37. tiboot3.bin: image_check FORCE
  38. $(srctree)/tools/k3_gen_x509_cert.sh -c 16 -b $(obj)/u-boot-spl.bin \
  39. -o $@ -l $(CONFIG_SPL_TEXT_BASE) -k $(KEY)
  40. ALL-y += tiboot3.bin
  41. endif
  42. ifdef CONFIG_ARM64
  43. ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
  44. SPL_ITS := u-boot-spl-k3_HS.its
  45. $(SPL_ITS): export IS_HS=1
  46. ALL-y += tispl.bin_HS
  47. else
  48. SPL_ITS := u-boot-spl-k3.its
  49. ALL-y += tispl.bin
  50. endif
  51. quiet_cmd_k3_mkits = MKITS $@
  52. cmd_k3_mkits = \
  53. $(srctree)/tools/k3_fit_atf.sh \
  54. $(patsubst %,$(obj)/dts/%.dtb,$(subst ",,$(CONFIG_SPL_OF_LIST))) > $@
  55. $(SPL_ITS): FORCE
  56. $(call cmd,k3_mkits)
  57. endif
  58. else
  59. ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
  60. ALL-y += u-boot.img_HS
  61. else
  62. ALL-y += u-boot.img
  63. endif
  64. endif
  65. include $(srctree)/arch/arm/mach-k3/config_secure.mk