component.mk 2.3 KB

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