Skip to content

Commit

Permalink
fix(esp_encrypted_img): correct the dependency for generating encrypt…
Browse files Browse the repository at this point in the history
…ed binary

Also changed the target name to dynamic one - based on output file name

Closes #349
  • Loading branch information
mahavirj committed Jul 10, 2024
1 parent 27742db commit 3951f12
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 4 additions & 0 deletions esp_encrypted_img/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.2.1

- Build system: fix the dependency for generating pre encrypted image

## 2.2.0

### Enhancements:
Expand Down
2 changes: 1 addition & 1 deletion esp_encrypted_img/idf_component.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
15 changes: 11 additions & 4 deletions esp_encrypted_img/project_include.cmake
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 3951f12

Please sign in to comment.