component.mk 2.2 KB

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