Skip to content

Commit 8b7beff

Browse files
nordicjmkartben
authored andcommitted
cmake: mcuboot: Use zephyr-discovered imgtool
Uses imgtool which has already been located by zephyr Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
1 parent 6db2c86 commit 8b7beff

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

cmake/mcuboot.cmake

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020-2023 Nordic Semiconductor ASA
1+
# Copyright (c) 2020-2025 Nordic Semiconductor ASA
22
# SPDX-License-Identifier: Apache-2.0
33

44
# This file includes extra build system logic that is enabled when
@@ -52,23 +52,8 @@ function(zephyr_mcuboot_tasks)
5252
endif()
5353
endforeach()
5454

55-
# Find imgtool. Even though west is installed, imgtool might not be.
56-
# The user may also have a custom manifest which doesn't include
57-
# MCUboot.
58-
#
59-
# Therefore, go with an explicitly installed imgtool first, falling
60-
# back on mcuboot/scripts/imgtool.py.
61-
if(IMGTOOL)
62-
set(imgtool_path "${IMGTOOL}")
63-
elseif(DEFINED ZEPHYR_MCUBOOT_MODULE_DIR)
64-
set(IMGTOOL_PY "${ZEPHYR_MCUBOOT_MODULE_DIR}/scripts/imgtool.py")
65-
if(EXISTS "${IMGTOOL_PY}")
66-
set(imgtool_path "${IMGTOOL_PY}")
67-
endif()
68-
endif()
69-
7055
# No imgtool, no signed binaries.
71-
if(NOT DEFINED imgtool_path)
56+
if(NOT DEFINED IMGTOOL)
7257
message(FATAL_ERROR "Can't sign images for MCUboot: can't find imgtool. To fix, install imgtool with pip3, or add the mcuboot repository to the west manifest and ensure it has a scripts/imgtool.py file.")
7358
return()
7459
endif()
@@ -94,7 +79,7 @@ function(zephyr_mcuboot_tasks)
9479
endif()
9580

9681
# Basic 'imgtool sign' command with known image information.
97-
set(imgtool_sign ${PYTHON_EXECUTABLE} ${imgtool_path} sign
82+
set(imgtool_sign ${PYTHON_EXECUTABLE} ${IMGTOOL} sign
9883
--version ${CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION} --header-size ${CONFIG_ROM_START_OFFSET}
9984
--slot-size ${slot_size})
10085

0 commit comments

Comments
 (0)