component.mk 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. COMPONENT_ADD_INCLUDEDIRS := include
  2. ifdef IS_BOOTLOADER_BUILD
  3. # share "include_bootloader" headers with bootloader main component
  4. COMPONENT_ADD_INCLUDEDIRS += include_bootloader
  5. else
  6. COMPONENT_PRIV_INCLUDEDIRS := include_bootloader
  7. endif
  8. COMPONENT_SRCDIRS := src \
  9. src/secure_boot_v2 \
  10. src/secure_boot_v1
  11. ifndef IS_BOOTLOADER_BUILD
  12. COMPONENT_SRCDIRS += src/idf # idf sub-directory contains platform agnostic IDF versions
  13. else
  14. COMPONENT_SRCDIRS += src/$(IDF_TARGET) # one sub-dir per chip
  15. endif
  16. ifndef IS_BOOTLOADER_BUILD
  17. COMPONENT_OBJEXCLUDE := src/bootloader_init.o \
  18. src/bootloader_panic.o \
  19. src/bootloader_clock_loader.o \
  20. src/bootloader_console.o \
  21. src/bootloader_console_loader.o
  22. endif
  23. COMPONENT_OBJEXCLUDE += src/bootloader_flash_config_esp32s2.o \
  24. src/bootloader_flash_config_esp32s3.o \
  25. src/bootloader_flash_config_esp32c3.o \
  26. src/bootloader_efuse_esp32s2.o \
  27. src/bootloader_efuse_esp32s3.o \
  28. src/bootloader_efuse_esp32c3.o \
  29. src/bootloader_random_esp32s2.o \
  30. src/bootloader_random_esp32s3.o \
  31. src/bootloader_random_esp32c3.o
  32. ifdef IS_BOOTLOADER_BUILD
  33. ifndef CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME
  34. COMPONENT_OBJEXCLUDE += src/secure_boot_v1/secure_boot_signatures_bootloader.o
  35. endif
  36. ifndef CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME
  37. COMPONENT_OBJEXCLUDE += src/secure_boot_v2/secure_boot_signatures_bootloader.o
  38. endif
  39. COMPONENT_OBJEXCLUDE += src/secure_boot_v1/secure_boot_signatures_app.o \
  40. src/secure_boot_v2/secure_boot_signatures_app.o
  41. else
  42. ifndef CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME
  43. COMPONENT_OBJEXCLUDE += src/secure_boot_v1/secure_boot_signatures_app.o
  44. endif
  45. ifndef CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME
  46. COMPONENT_OBJEXCLUDE += src/secure_boot_v2/secure_boot_signatures_app.o
  47. endif
  48. COMPONENT_OBJEXCLUDE += src/secure_boot_v1/secure_boot_signatures_bootloader.o \
  49. src/secure_boot_v2/secure_boot_signatures_bootloader.o
  50. endif # IS_BOOTLOADER_BUILD
  51. ifndef CONFIG_SECURE_BOOT
  52. COMPONENT_OBJEXCLUDE += src/$(IDF_TARGET)/secure_boot.o
  53. endif
  54. #
  55. # Secure boot signing key support
  56. #
  57. ifdef CONFIG_SECURE_SIGNED_APPS
  58. ifdef CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME
  59. # this path is created relative to the component build directory
  60. SECURE_BOOT_VERIFICATION_KEY := $(abspath signature_verification_key.bin)
  61. ifdef CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES
  62. # verification key derived from signing key.
  63. $(SECURE_BOOT_VERIFICATION_KEY): $(SECURE_BOOT_SIGNING_KEY) $(SDKCONFIG_MAKEFILE)
  64. $(ESPSECUREPY) extract_public_key --keyfile $< $@
  65. else
  66. # find the configured public key file
  67. ORIG_SECURE_BOOT_VERIFICATION_KEY := $(call resolvepath,$(call dequote,$(CONFIG_SECURE_BOOT_VERIFICATION_KEY)),$(PROJECT_PATH))
  68. $(ORIG_SECURE_BOOT_VERIFICATION_KEY):
  69. @echo "Secure boot verification public key '$@' missing."
  70. @echo "This can be extracted from the private signing key, see"
  71. @echo "docs/security/secure-boot-v1.rst for details."
  72. exit 1
  73. # copy it into the build dir, so the secure boot verification key has
  74. # a predictable file name
  75. $(SECURE_BOOT_VERIFICATION_KEY): $(ORIG_SECURE_BOOT_VERIFICATION_KEY) $(SDKCONFIG_MAKEFILE)
  76. $(summary) CP $< $@
  77. cp $< $@
  78. endif #CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES
  79. COMPONENT_EXTRA_CLEAN += $(SECURE_BOOT_VERIFICATION_KEY)
  80. COMPONENT_EMBED_FILES := $(SECURE_BOOT_VERIFICATION_KEY)
  81. endif #CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME
  82. endif #CONFIG_SECURE_SIGNED_APPS