component.mk 2.8 KB

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