From 3951f12c814c979c8f1af3273940b5231e224103 Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Wed, 3 Jul 2024 17:26:23 +0530 Subject: [PATCH] fix(esp_encrypted_img): correct the dependency for generating encrypted binary Also changed the target name to dynamic one - based on output file name Closes https://github.com/espressif/idf-extra-components/issues/349 --- esp_encrypted_img/CHANGELOG.md | 4 ++++ esp_encrypted_img/idf_component.yml | 2 +- esp_encrypted_img/project_include.cmake | 15 +++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/esp_encrypted_img/CHANGELOG.md b/esp_encrypted_img/CHANGELOG.md index 8eb5415e71..d4a4cd34fd 100644 --- a/esp_encrypted_img/CHANGELOG.md +++ b/esp_encrypted_img/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.2.1 + +- Build system: fix the dependency for generating pre encrypted image + ## 2.2.0 ### Enhancements: diff --git a/esp_encrypted_img/idf_component.yml b/esp_encrypted_img/idf_component.yml index c5318951fb..d2118c37d9 100644 --- a/esp_encrypted_img/idf_component.yml +++ b/esp_encrypted_img/idf_component.yml @@ -1,4 +1,4 @@ -version: "2.2.0" +version: "2.2.1" description: ESP Encrypted Image Abstraction Layer url: https://github.com/espressif/idf-extra-components/tree/master/esp_encrypted_img dependencies: diff --git a/esp_encrypted_img/project_include.cmake b/esp_encrypted_img/project_include.cmake index 1002cbe61b..61c90ef3a4 100644 --- a/esp_encrypted_img/project_include.cmake +++ b/esp_encrypted_img/project_include.cmake @@ -1,18 +1,25 @@ set(ESP_IMG_GEN_TOOL_PATH ${CMAKE_CURRENT_LIST_DIR}/tools/esp_enc_img_gen.py) +idf_build_get_property(build_dir BUILD_DIR) +if(CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES) + set(app_dependency "${build_dir}/.signed_bin_timestamp") +else() + set(app_dependency "${build_dir}/.bin_timestamp") +endif() + function(create_esp_enc_img input_file rsa_key_file output_file app) cmake_parse_arguments(arg "${options}" "" "${multi}" "${ARGN}") idf_build_get_property(python PYTHON) add_custom_command(OUTPUT ${output_file} - POST_BUILD COMMAND ${python} ${ESP_IMG_GEN_TOOL_PATH} encrypt ${input_file} ${rsa_key_file} ${output_file} - DEPENDS gen_project_binary + DEPENDS "${app_dependency}" COMMENT "Generating pre-encrypted binary" VERBATIM ) - add_custom_target(encrypt_bin_target DEPENDS ${output_file}) - add_dependencies(${app} encrypt_bin_target) + get_filename_component(name ${output_file} NAME_WE) + add_custom_target(enc_bin_target_${name} ALL DEPENDS ${output_file}) + add_dependencies(enc_bin_target_${name} gen_project_binary) endfunction()