Skip to content

Commit 91b3c6a

Browse files
nvlsianpumbolivar-nordic
authored andcommitted
[nrf fromtree] zephyr: direct inclusion of the hooks file
This patch removes CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE option which was used to point to hooks implementation file. It is better that the project customization is up to add required files instead. This gives more flexibility in provisioning these sources (there may be multiple files). This also simplifies Kconfig options. In order to keep possibility for build-test the Hooks feature hooks_sample.c will be included into the build if commandline will specify -DTEST_BOOT_IMAGE_ACCESS_HOOKS=Y option. Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no> (cherry picked from commit 74b34fe)
1 parent 3895554 commit 91b3c6a

File tree

4 files changed

+9
-34
lines changed

4 files changed

+9
-34
lines changed

boot/bootutil/zephyr/CMakeLists.txt

+6-21
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,12 @@ zephyr_library_sources(
1717
../src/bootutil_public.c
1818
)
1919

20-
if(CONFIG_BOOT_IMAGE_ACCESS_HOOKS)
21-
if(NOT CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE STREQUAL "")
22-
if(IS_ABSOLUTE ${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
23-
if(EXISTS ${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
24-
set(HOOKS_FILE ${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
25-
endif()
26-
elseif((DEFINED CONF_DIR) AND
27-
(EXISTS ${CONF_DIR}/${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE}))
28-
set(HOOKS_FILE ${CONF_DIR}/${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
29-
else(EXISTS ${APPLICATION_SOURCE_DIR}/${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
30-
set(HOOKS_FILE ${APPLICATION_SOURCE_DIR}/${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
31-
endif()
32-
endif()
33-
34-
if(DEFINED HOOKS_FILE)
35-
zephyr_library_sources(
36-
${HOOKS_FILE}
37-
)
38-
else()
39-
message(STATUS "No hooks implementation file.")
40-
endif()
20+
# Sensitivity to the TEST_BOOT_IMAGE_ACCESS_HOOKS define is implemented for
21+
# allowing the test-build with the hooks feature enabled.
22+
if(TEST_BOOT_IMAGE_ACCESS_HOOKS)
23+
zephyr_library_sources(
24+
${APPLICATION_SOURCE_DIR}/hooks_sample.c
25+
)
4126
endif()
4227

4328
zephyr_library_link_libraries(MCUBOOT_BOOTUTIL)

boot/zephyr/Kconfig

+2-12
Original file line numberDiff line numberDiff line change
@@ -571,18 +571,8 @@ config BOOT_IMAGE_ACCESS_HOOKS
571571
help
572572
Allow to provide procedures for override or extend native
573573
MCUboot's routines required for access the image data and the image
574-
update.
575-
576-
config BOOT_IMAGE_ACCESS_HOOKS_FILE
577-
string "Hooks implementation file path"
578-
depends on BOOT_IMAGE_ACCESS_HOOKS
579-
help
580-
Path to the file which implements hooks.
581-
You can use either absolute or relative path.
582-
In case relative path is used, the build system assumes that it starts
583-
from the directory where the MCUBoot KConfig configuration file is
584-
located. If the key file is not there, the build system uses relative
585-
path that starts from the zephyr port cmake directory (boot/zephyr/).
574+
update. It is up to the project customization to add required source
575+
files to the build.
586576

587577
config MCUBOOT_ACTION_HOOKS
588578
bool "Enable hooks for responding to MCUboot status changes"

boot/zephyr/boards/nrf52840dk_hooks_sample_overlay.conf

-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ CONFIG_FLASH_SIMULATOR=y
44
CONFIG_FLASH_SIMULATOR_UNALIGNED_READ=y
55

66
CONFIG_BOOT_IMAGE_ACCESS_HOOKS=y
7-
CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE="hooks_sample.c"

boot/zephyr/sample.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ tests:
4444
sample.bootloader.mcuboot.hooks_multi:
4545
extra_args: DTC_OVERLAY_FILE=./boards/nrf52840dk_ram_multi.overlay
4646
OVERLAY_CONFIG=./boards/nrf52840dk_hooks_sample_overlay.conf
47+
TEST_BOOT_IMAGE_ACCESS_HOOKS=Y
4748
platform_allow: nrf52840dk_nrf52840
4849
integration_platforms:
4950
- nrf52840dk_nrf52840

0 commit comments

Comments
 (0)