component.mk 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. ifndef CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME
  32. COMPONENT_OBJEXCLUDE += src/$(IDF_TARGET)/secure_boot_signatures.o \
  33. src/idf/secure_boot_signatures.o
  34. endif
  35. endif
  36. ifndef CONFIG_SECURE_BOOT
  37. COMPONENT_OBJEXCLUDE += src/$(IDF_TARGET)/secure_boot.o
  38. endif
  39. #
  40. # Secure boot signing key support
  41. #
  42. ifdef CONFIG_SECURE_SIGNED_APPS
  43. ifdef CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME
  44. # this path is created relative to the component build directory
  45. SECURE_BOOT_VERIFICATION_KEY := $(abspath signature_verification_key.bin)
  46. ifdef CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES
  47. # verification key derived from signing key.
  48. $(SECURE_BOOT_VERIFICATION_KEY): $(SECURE_BOOT_SIGNING_KEY) $(SDKCONFIG_MAKEFILE)
  49. $(ESPSECUREPY) extract_public_key --keyfile $< $@
  50. else
  51. # find the configured public key file
  52. ORIG_SECURE_BOOT_VERIFICATION_KEY := $(call resolvepath,$(call dequote,$(CONFIG_SECURE_BOOT_VERIFICATION_KEY)),$(PROJECT_PATH))
  53. $(ORIG_SECURE_BOOT_VERIFICATION_KEY):
  54. @echo "Secure boot verification public key '$@' missing."
  55. @echo "This can be extracted from the private signing key, see"
  56. @echo "docs/security/secure-boot-v1.rst for details."
  57. exit 1
  58. # copy it into the build dir, so the secure boot verification key has
  59. # a predictable file name
  60. $(SECURE_BOOT_VERIFICATION_KEY): $(ORIG_SECURE_BOOT_VERIFICATION_KEY) $(SDKCONFIG_MAKEFILE)
  61. $(summary) CP $< $@
  62. cp $< $@
  63. endif #CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES
  64. COMPONENT_EXTRA_CLEAN += $(SECURE_BOOT_VERIFICATION_KEY)
  65. COMPONENT_EMBED_FILES := $(SECURE_BOOT_VERIFICATION_KEY)
  66. endif #CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME
  67. endif #CONFIG_SECURE_SIGNED_APPS