Skip to content

Commit 3b8f39f

Browse files
nvlsianpumbolivar-nordic
authored andcommitted
[nrf fromtree] boot/zephyr: Kconfig for hooks enabling
Added global property which allows to enable hooks implementations. Signed-off-by: Andrzej Puzdrowski <[email protected]> (cherry picked from commit ec67580)
1 parent 0aad9cf commit 3b8f39f

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

boot/zephyr/CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,27 @@ zephyr_library_sources(
316316
${BOOT_DIR}/zephyr/nrf_cleanup.c
317317
)
318318
endif()
319+
320+
if(CONFIG_BOOT_IMAGE_ACCESS_HOOKS)
321+
322+
if(IS_ABSOLUTE ${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
323+
if(EXISTS ${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
324+
set(HOOKS_FILE ${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
325+
endif()
326+
elseif((DEFINED CONF_DIR) AND
327+
(EXISTS ${CONF_DIR}/${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE}))
328+
set(HOOKS_FILE ${CONF_DIR}/${CONFIG_BOOT_SIGNATURE_KEY_FILE})
329+
else(EXISTS ${BOOT_DIR}/zephyr/${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
330+
set(HOOKS_FILE ${BOOT_DIR}/zephyr/${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
331+
endif()
332+
333+
334+
if(DEFINED HOOKS_FILE)
335+
zephyr_library_sources(
336+
${HOOKS_FILE}
337+
)
338+
else()
339+
message(WARNING "Can't access hooks implementation file.")
340+
endif()
341+
342+
endif()

boot/zephyr/Kconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,24 @@ config BOOT_WATCHDOG_FEED
631631
Enables implementation of MCUBOOT_WATCHDOG_FEED() macro which is
632632
used to feed watchdog while doing time consuming operations.
633633

634+
config BOOT_IMAGE_ACCESS_HOOKS
635+
bool "Enable hooks for overriding MCUboot's native routines"
636+
help
637+
Allow to provide procedures for override or extend native
638+
MCUboot's routines required for access the image data and the image
639+
update.
640+
641+
config BOOT_IMAGE_ACCESS_HOOKS_FILE
642+
string "Hooks implementation file path"
643+
depends on BOOT_IMAGE_ACCESS_HOOKS
644+
help
645+
Path to the file which implements hooks.
646+
You can use either absolute or relative path.
647+
In case relative path is used, the build system assumes that it starts
648+
from the directory where the MCUBoot KConfig configuration file is
649+
located. If the key file is not there, the build system uses relative
650+
path that starts from the zephyr port cmake directory (boot/zephyr/).
651+
634652
endmenu
635653

636654
config MCUBOOT_DEVICE_SETTINGS

boot/zephyr/include/mcuboot_config/mcuboot_config.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@
162162
#define MCUBOOT_MGMT_CUSTOM_IMG_LIST
163163
#endif
164164

165+
#ifdef CONFIG_BOOT_IMAGE_ACCESS_HOOKS
166+
#define MCUBOOT_IMAGE_ACCESS_HOOKS
167+
#endif
168+
165169
/*
166170
* The configuration option enables direct image upload with the
167171
* serial recovery.

0 commit comments

Comments
 (0)