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