Commit 72627c50 authored by Gustavo Henrique Nihei's avatar Gustavo Henrique Nihei Committed by Fabio Utzig
Browse files

espressif: Allow use of imgtool other than the one from repository

parent 2fe449d1
Loading
Loading
Loading
Loading
+13 −2
Changes for boot/espressif/CMakeLists.txt: 13 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -79,6 +79,18 @@ set(MCUBOOT_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
set(BOOTUTIL_DIR ${MCUBOOT_ROOT_DIR}/boot/bootutil)
set(ESPRESSIF_PORT_DIR ${CMAKE_CURRENT_LIST_DIR})

# Find imgtool.
# Go with an explicitly installed imgtool first, falling
# back to mcuboot/scripts/imgtool.py.
find_program(IMGTOOL_COMMAND
    NAMES imgtool imgtool.py
    )
if ("${IMGTOOL_COMMAND}" MATCHES "IMGTOOL_COMMAND-NOTFOUND")
    set(imgtool_path "${MCUBOOT_ROOT_DIR}/scripts/imgtool.py")
else()
    set(imgtool_path "${IMGTOOL_COMMAND}")
endif()

if (DEFINED CONFIG_ESP_SIGN_RSA)
    if ("${MCUBOOT_TARGET}" STREQUAL "esp32s2" OR
        "${MCUBOOT_TARGET}" STREQUAL "esp32c3")
@@ -116,8 +128,7 @@ if(DEFINED CONFIG_ESP_SIGN_KEY_FILE)
        add_custom_command(
            OUTPUT ${GENERATED_PUBKEY}
            COMMAND
            ${PYTHON_EXECUTABLE}
            ${MCUBOOT_ROOT_DIR}/scripts/imgtool.py
            ${imgtool_path}
            getpub
            -k
            ${KEY_FILE}