Build error when added custom-code copy of nRF NSIB bootloader example as a child project instead of original NSIB bootloader example

Hello, I have project with main firmware and a little bootloader which I took from nRF examples (I need to change its source code). I added bootloader as a child image in the CMakeLists of main firmware (put add_child_image(...) between "project(...)" and target_sources(...)). The string added is:

add_child_image(NAME b0 SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/bootloader)

When I tried to build the main application (that should automatically build bootloader as it is child), I saw that the bootloader successfully has been accepted as child image and started to build, but after I got a strange error saying about pm_config.h header inclusion in linker definition file (.ld): pm_config.h not found. How to solve that problem? Here s the output log:

...

[15/189] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/thread_abort.c.obj
[16/189] Generating linker_zephyr_pre0.cmd
FAILED: zephyr/linker_zephyr_pre0.cmd
cmd.exe /C "cd /D C:\Users\nordic_user\projects\ble_test_project\build\b0\zephyr && C:\ncs\toolchains\v2.2.0\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -x assembler-with-cpp -undef -MD -MF linker_zephyr_pre0.cmd.dep -MT linker_zephyr_pre0.cmd -D_LINKER -D_ASMLANGUAGE -imacros C:/Users/nordic_user/projects/ble_test_project/build/b0/zephyr/include/generated/autoconf.h -IC:/ncs/v2.2.0/zephyr/include -IC:/Users/nordic_user/projects/ble_test_project/build/b0/zephyr/include/generated -IC:/ncs/v2.2.0/zephyr/soc/arm/nordic_nrf/nrf53 -IC:/ncs/v2.2.0/zephyr/lib/libc/minimal/include -IC:/ncs/v2.2.0/zephyr/soc/arm/nordic_nrf/common/. -IC:/ncs/v2.2.0/nrf/include -IC:/ncs/v2.2.0/nrf/subsys/bootloader/include -IC:/ncs/v2.2.0/nrf/tests/include -IC:/ncs/v2.2.0/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v2.2.0/modules/hal/nordic/nrfx -IC:/ncs/v2.2.0/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v2.2.0/modules/hal/nordic/nrfx/mdk -IC:/ncs/v2.2.0/zephyr/modules/hal_nordic/nrfx/. -IC:/ncs/v2.2.0/modules/lib/zcbor/include -D__GCC_LINKER_CMD__ -DUSE_PARTITION_MANAGER=1 -DLINKER_DEVICE_HANDLES_PASS1 -E C:/ncs/v2.2.0/zephyr/soc/arm/nordic_nrf/nrf53/linker.ld -P -o linker_zephyr_pre0.cmd && C:\ncs\toolchains\v2.2.0\opt\bin\cmake.exe -E cmake_transform_depfile Ninja gccdepfile C:/Users/nordic_user/projects/ble_test_project/bootloader C:/ncs/v2.2.0/zephyr C:/Users/nordic_user/projects/ble_test_project/build/b0 C:/Users/nordic_user/projects/ble_test_project/build/b0/zephyr C:/Users/nordic_user/projects/ble_test_project/build/b0/zephyr/linker_zephyr_pre0.cmd.dep C:/Users/nordic_user/projects/ble_test_project/build/b0/CMakeFiles/d/530161fb57b983645235f4cae66d7efd4d4904d41d7f77a4d1b0655285537e3e.d"
In file included from C:\ncs\v2.2.0\zephyr\soc\arm\nordic_nrf\nrf53\linker.ld:9:
C:\ncs\v2.2.0\zephyr\include\zephyr\arch\arm\aarch32\cortex_m\scripts\linker.ld:31:10: fatal error: pm_config.h: No such file or directory
31 | #include <pm_config.h>
| ^~~~~~~~~~~~~
compilation terminated.

...

Related