mcuboot with custom key

Hi,

I have the exact problem in this issue: https://devzone.nordicsemi.com/f/nordic-q-a/60609/problem-with-mcuboot

NCS version: 1.9

Board: nrf52840dk_nrf52840

The output:

-- Configuring incomplete, errors occurred!
CMake Error at <ncs_root>/nrf/cmake/multi_image.cmake:409 (message):
  CMake generation for mcuboot failed, aborting.  Command: 1
Call Stack (most recent call first):
  <ncs_root>/nrf/cmake/multi_image.cmake:150 (add_child_image_from_source)
  <ncs_root>/nrf/modules/mcuboot/CMakeLists.txt:216 (add_child_image)


-- Configuring incomplete, errors occurred!
See also "<replaced_prj_source>/d2mul_bootloader/build/CMakeFiles/CMakeOutput.log".
See also "<replaced_prj_source>/d2mul_bootloader/build/CMakeFiles/CMakeError.log".
FATAL ERROR: command exited with status 1: /usr/bin/cmake -DWEST_PYTHON=/home/ozan/.pyenv/versions/3.6.8/bin/python3 -B<replaced_prj_source>/d2mul_bootloader/build -S<replaced_prj_source>/d2mul_bootloader -GNinja -DBOARD=nrf52840dk_nrf52840 -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING=NONE -DCONF_FILE:STRING=<replaced_prj_source>/d2mul_bootloader/prj.conf -Dmcuboot_OVERLAY_CONFIG=mcuboot.conf

There are different suggestions in the accepted solution:

"Try to delete the build folder in ncs\mcuboot\boot\zephyr"  -> didn't work

"git clean -fxd in ncs\mcuboot" -> didn't work

"try to clean your "/home/voja/.cache/zephyr" folder." -> didn't work

Any other suggestions are highly welcome.

Many thanks,

Ozan

Parents
  • Hello Ozan,

    Did you mean to point me to a different case maybe? The one you linked to did not seem to be related to key management. Either way, do you get the build error if you just use the default key (i.e. when you do not configure the CONFIG_BOOT_SIGNATURE_KEY_FILE setting)?

    I was not able to replicate your build error here. I took the smp_svr sample and added the child_image directory attached below to override the MCUBoot's default build configuration and use my 'mcuboot_private.pem' RSA keyfile.

    6011.child_image.zip

    Best regards,

    Vidar

  • Hi Vidar, sorry if I didn't provide enough information in the original post.

    Here is the steps what I did:

    1- Create a new project from smp_svr sample

    2- Compile it with the following command:

    $ west build --pristine -b nrf52840dk_nrf52840 . -- -DCONF_FILE=prj.conf

    Here is the full log for this compilation:

    $ west build --pristine -b nrf52840dk_nrf52840 . -- -DCONF_FILE=prj.conf
    
    -- west build: making build dir /home/ozan/projects/tmp/child_image/smp_svr/build pristine
    -- west build: generating a build system
    Including boilerplate (Zephyr base): /home/ozan/projects/ncs/zephyr/cmake/app/boilerplate.cmake
    -- Application: /home/ozan/projects/tmp/child_image/smp_svr
    -- Zephyr version: 2.7.99 (/home/ozan/projects/ncs/zephyr), build: v2.7.99-ncs1
    -- Found Python3: /home/ozan/.pyenv/versions/3.6.8/bin/python3.6 (found suitable exact version "3.6.8") found components: Interpreter 
    -- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
    -- Board: nrf52840dk_nrf52840
    -- Cache files will be written to: /home/ozan/.cache/zephyr
    -- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (/home/ozan/Downloads/gcc-arm-none-eabi-9-2019-q4-major)
    -- Found BOARD.dts: /home/ozan/projects/ncs/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Generated zephyr.dts: /home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: /home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/dts.cmake
    Parsing /home/ozan/projects/ncs/zephyr/Kconfig
    Loaded configuration '/home/ozan/projects/ncs/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
    Merged configuration '/home/ozan/projects/tmp/child_image/smp_svr/prj.conf'
    Configuration saved to '/home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/.config'
    Kconfig header saved to '/home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 9.2.1
    -- The CXX compiler identification is GNU 9.2.1
    -- The ASM compiler identification is GNU
    -- Found assembler: /home/ozan/Downloads/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc
    
    === child image mcuboot -  begin ===
    loading initial cache file /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/child_image_preload.cmake
    Including boilerplate (Zephyr base): /home/ozan/projects/ncs/zephyr/cmake/app/boilerplate.cmake
    -- Application: /home/ozan/projects/ncs/bootloader/mcuboot/boot/zephyr
    -- Zephyr version: 2.7.99 (/home/ozan/projects/ncs/zephyr), build: v2.7.99-ncs1
    -- Found Python3: /home/ozan/.pyenv/shims/python3.6 (found suitable exact version "3.6.8") found components: Interpreter 
    -- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
    -- Board: nrf52840dk_nrf52840
    -- Cache files will be written to: /home/ozan/.cache/zephyr
    -- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (/home/ozan/Downloads/gcc-arm-none-eabi-9-2019-q4-major)
    -- Found BOARD.dts: /home/ozan/projects/ncs/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Found devicetree overlay: /home/ozan/projects/ncs/nrf/modules/mcuboot/usb.overlay
    -- Found devicetree overlay: /home/ozan/projects/ncs/bootloader/mcuboot/boot/zephyr/dts.overlay
    -- Generated zephyr.dts: /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/dts.cmake
    Parsing /home/ozan/projects/ncs/bootloader/mcuboot/boot/zephyr/Kconfig
    Loaded configuration '/home/ozan/projects/ncs/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
    Merged configuration '/home/ozan/projects/ncs/bootloader/mcuboot/boot/zephyr/prj.conf'
    Merged configuration '/home/ozan/projects/ncs/nrf/subsys/partition_manager/partition_manager_enabled.conf'
    Merged configuration '/home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/misc/generated/extra_kconfig_options.conf'
    Configuration saved to '/home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/.config'
    Kconfig header saved to '/home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 9.2.1
    -- The CXX compiler identification is GNU 9.2.1
    -- The ASM compiler identification is GNU
    -- Found assembler: /home/ozan/Downloads/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc
    CMake Warning at /home/ozan/projects/ncs/nrf/lib/flash_patch/CMakeLists.txt:9 (message):
      
    
            ----------------------------------------------------------
            --- WARNING: To maintain the integrity of secure boot, ---
            --- enable CONFIG_DISABLE_FLASH_PATCH in production.   ---
            ----------------------------------------------------------
    
    
    MCUBoot bootloader key file: /home/ozan/projects/ncs/bootloader/mcuboot/root-ec-p256.pem
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot
    === child image mcuboot -  end ===
    
    CMake Warning at /home/ozan/projects/ncs/nrf/modules/mcuboot/CMakeLists.txt:262 (message):
      
    
            ---------------------------------------------------------
            --- WARNING: Using default MCUBoot key, it should not ---
            --- be used for production.                           ---
            ---------------------------------------------------------
            
    
    
    
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/ozan/projects/tmp/child_image/smp_svr/build
    -- west build: building application
    [1/226] Preparing syscall dependency handling
    
    [6/226] Performing build step for 'mcuboot_subimage'
    [1/182] Preparing syscall dependency handling
    
    [172/182] Linking C executable zephyr/zephyr_pre0.elf
    
    [176/182] Linking C executable zephyr/zephyr_pre1.elf
    
    [182/182] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       33252 B        48 KB     67.65%
                SRAM:       17696 B       256 KB      6.75%
            IDT_LIST:          0 GB         2 KB      0.00%
    [205/226] Linking C executable zephyr/zephyr_pre0.elf
    
    [209/226] Linking C executable zephyr/zephyr_pre1.elf
    
    [218/226] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       44468 B     499200 B      8.91%
                SRAM:       15904 B       256 KB      6.07%
            IDT_LIST:          0 GB         2 KB      0.00%
    [226/226] Generating zephyr/merged.hex

    As expected, it gives a warning about using the default key file as provided in the original mcuboot library, but the compilation is successful.

    ====== Now adding a custom key file (as you did in your reply) =======

    3- I'm adding the key file (mcuboot_private.pem) and the mcuboot config file (prj.conf -> rename to mcuboot_prj.conf) that you've shared in your reply into the project folder

    4- Compile it with the following command:

    $ west build --pristine -b nrf52840dk_nrf52840 . -- -Dmcuboot_CONF_FILE=mcuboot_prj.conf -DCONF_FILE=prj.conf

    5- This time, it gives the error that I showed in the first post as the following (full log):

    $ west build --pristine -b nrf52840dk_nrf52840 . -- -Dmcuboot_CONF_FILE=mcuboot_prj.conf -DCONF_FILE=prj.conf
    
    -- west build: making build dir /home/ozan/projects/tmp/child_image/smp_svr/build pristine
    -- west build: generating a build system
    Including boilerplate (Zephyr base): /home/ozan/projects/ncs/zephyr/cmake/app/boilerplate.cmake
    -- Application: /home/ozan/projects/tmp/child_image/smp_svr
    -- Zephyr version: 2.7.99 (/home/ozan/projects/ncs/zephyr), build: v2.7.99-ncs1
    -- Found Python3: /home/ozan/.pyenv/versions/3.6.8/bin/python3.6 (found suitable exact version "3.6.8") found components: Interpreter 
    -- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
    -- Board: nrf52840dk_nrf52840
    -- Cache files will be written to: /home/ozan/.cache/zephyr
    -- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (/home/ozan/Downloads/gcc-arm-none-eabi-9-2019-q4-major)
    -- Found BOARD.dts: /home/ozan/projects/ncs/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Generated zephyr.dts: /home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: /home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/dts.cmake
    Parsing /home/ozan/projects/ncs/zephyr/Kconfig
    Loaded configuration '/home/ozan/projects/ncs/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
    Merged configuration '/home/ozan/projects/tmp/child_image/smp_svr/prj.conf'
    Configuration saved to '/home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/.config'
    Kconfig header saved to '/home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 9.2.1
    -- The CXX compiler identification is GNU 9.2.1
    -- The ASM compiler identification is GNU
    -- Found assembler: /home/ozan/Downloads/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc
    
    === child image mcuboot -  begin ===
    loading initial cache file /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/child_image_preload.cmake
    Including boilerplate (Zephyr base): /home/ozan/projects/ncs/zephyr/cmake/app/boilerplate.cmake
    -- Application: /home/ozan/projects/ncs/bootloader/mcuboot/boot/zephyr
    -- Zephyr version: 2.7.99 (/home/ozan/projects/ncs/zephyr), build: v2.7.99-ncs1
    -- Found Python3: /home/ozan/.pyenv/shims/python3.6 (found suitable exact version "3.6.8") found components: Interpreter 
    -- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
    -- Board: nrf52840dk_nrf52840
    -- Cache files will be written to: /home/ozan/.cache/zephyr
    -- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (/home/ozan/Downloads/gcc-arm-none-eabi-9-2019-q4-major)
    -- Found BOARD.dts: /home/ozan/projects/ncs/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Found devicetree overlay: /home/ozan/projects/ncs/nrf/modules/mcuboot/usb.overlay
    -- Found devicetree overlay: /home/ozan/projects/ncs/bootloader/mcuboot/boot/zephyr/dts.overlay
    -- Generated zephyr.dts: /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/dts.cmake
    CMake Error at /home/ozan/projects/ncs/zephyr/cmake/kconfig.cmake:213 (message):
      File not found:
      /home/ozan/projects/ncs/bootloader/mcuboot/boot/zephyr/mcuboot_prj.conf
    Call Stack (most recent call first):
      /home/ozan/projects/ncs/zephyr/cmake/app/boilerplate.cmake:544 (include)
      /home/ozan/projects/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
      /home/ozan/projects/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
      CMakeLists.txt:44 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    CMake Error at /home/ozan/projects/ncs/nrf/cmake/multi_image.cmake:409 (message):
      CMake generation for mcuboot failed, aborting.  Command: 1
    Call Stack (most recent call first):
      /home/ozan/projects/ncs/nrf/cmake/multi_image.cmake:150 (add_child_image_from_source)
      /home/ozan/projects/ncs/nrf/modules/mcuboot/CMakeLists.txt:216 (add_child_image)
    
    
    -- Configuring incomplete, errors occurred!
    See also "/home/ozan/projects/tmp/child_image/smp_svr/build/CMakeFiles/CMakeOutput.log".
    See also "/home/ozan/projects/tmp/child_image/smp_svr/build/CMakeFiles/CMakeError.log".
    FATAL ERROR: command exited with status 1: /usr/bin/cmake -DWEST_PYTHON=/home/ozan/.pyenv/versions/3.6.8/bin/python3 -B/home/ozan/projects/tmp/child_image/smp_svr/build -S/home/ozan/projects/tmp/child_image/smp_svr -GNinja -DBOARD=nrf52840dk_nrf52840 -Dmcuboot_CONF_FILE=mcuboot_prj.conf -DCONF_FILE=prj.conf

    Unfortunately, I couldn't find what I'm doing wrong here.

    Many thanks,

    Ozan

Reply
  • Hi Vidar, sorry if I didn't provide enough information in the original post.

    Here is the steps what I did:

    1- Create a new project from smp_svr sample

    2- Compile it with the following command:

    $ west build --pristine -b nrf52840dk_nrf52840 . -- -DCONF_FILE=prj.conf

    Here is the full log for this compilation:

    $ west build --pristine -b nrf52840dk_nrf52840 . -- -DCONF_FILE=prj.conf
    
    -- west build: making build dir /home/ozan/projects/tmp/child_image/smp_svr/build pristine
    -- west build: generating a build system
    Including boilerplate (Zephyr base): /home/ozan/projects/ncs/zephyr/cmake/app/boilerplate.cmake
    -- Application: /home/ozan/projects/tmp/child_image/smp_svr
    -- Zephyr version: 2.7.99 (/home/ozan/projects/ncs/zephyr), build: v2.7.99-ncs1
    -- Found Python3: /home/ozan/.pyenv/versions/3.6.8/bin/python3.6 (found suitable exact version "3.6.8") found components: Interpreter 
    -- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
    -- Board: nrf52840dk_nrf52840
    -- Cache files will be written to: /home/ozan/.cache/zephyr
    -- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (/home/ozan/Downloads/gcc-arm-none-eabi-9-2019-q4-major)
    -- Found BOARD.dts: /home/ozan/projects/ncs/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Generated zephyr.dts: /home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: /home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/dts.cmake
    Parsing /home/ozan/projects/ncs/zephyr/Kconfig
    Loaded configuration '/home/ozan/projects/ncs/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
    Merged configuration '/home/ozan/projects/tmp/child_image/smp_svr/prj.conf'
    Configuration saved to '/home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/.config'
    Kconfig header saved to '/home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 9.2.1
    -- The CXX compiler identification is GNU 9.2.1
    -- The ASM compiler identification is GNU
    -- Found assembler: /home/ozan/Downloads/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc
    
    === child image mcuboot -  begin ===
    loading initial cache file /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/child_image_preload.cmake
    Including boilerplate (Zephyr base): /home/ozan/projects/ncs/zephyr/cmake/app/boilerplate.cmake
    -- Application: /home/ozan/projects/ncs/bootloader/mcuboot/boot/zephyr
    -- Zephyr version: 2.7.99 (/home/ozan/projects/ncs/zephyr), build: v2.7.99-ncs1
    -- Found Python3: /home/ozan/.pyenv/shims/python3.6 (found suitable exact version "3.6.8") found components: Interpreter 
    -- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
    -- Board: nrf52840dk_nrf52840
    -- Cache files will be written to: /home/ozan/.cache/zephyr
    -- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (/home/ozan/Downloads/gcc-arm-none-eabi-9-2019-q4-major)
    -- Found BOARD.dts: /home/ozan/projects/ncs/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Found devicetree overlay: /home/ozan/projects/ncs/nrf/modules/mcuboot/usb.overlay
    -- Found devicetree overlay: /home/ozan/projects/ncs/bootloader/mcuboot/boot/zephyr/dts.overlay
    -- Generated zephyr.dts: /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/dts.cmake
    Parsing /home/ozan/projects/ncs/bootloader/mcuboot/boot/zephyr/Kconfig
    Loaded configuration '/home/ozan/projects/ncs/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
    Merged configuration '/home/ozan/projects/ncs/bootloader/mcuboot/boot/zephyr/prj.conf'
    Merged configuration '/home/ozan/projects/ncs/nrf/subsys/partition_manager/partition_manager_enabled.conf'
    Merged configuration '/home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/misc/generated/extra_kconfig_options.conf'
    Configuration saved to '/home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/.config'
    Kconfig header saved to '/home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 9.2.1
    -- The CXX compiler identification is GNU 9.2.1
    -- The ASM compiler identification is GNU
    -- Found assembler: /home/ozan/Downloads/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc
    CMake Warning at /home/ozan/projects/ncs/nrf/lib/flash_patch/CMakeLists.txt:9 (message):
      
    
            ----------------------------------------------------------
            --- WARNING: To maintain the integrity of secure boot, ---
            --- enable CONFIG_DISABLE_FLASH_PATCH in production.   ---
            ----------------------------------------------------------
    
    
    MCUBoot bootloader key file: /home/ozan/projects/ncs/bootloader/mcuboot/root-ec-p256.pem
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot
    === child image mcuboot -  end ===
    
    CMake Warning at /home/ozan/projects/ncs/nrf/modules/mcuboot/CMakeLists.txt:262 (message):
      
    
            ---------------------------------------------------------
            --- WARNING: Using default MCUBoot key, it should not ---
            --- be used for production.                           ---
            ---------------------------------------------------------
            
    
    
    
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/ozan/projects/tmp/child_image/smp_svr/build
    -- west build: building application
    [1/226] Preparing syscall dependency handling
    
    [6/226] Performing build step for 'mcuboot_subimage'
    [1/182] Preparing syscall dependency handling
    
    [172/182] Linking C executable zephyr/zephyr_pre0.elf
    
    [176/182] Linking C executable zephyr/zephyr_pre1.elf
    
    [182/182] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       33252 B        48 KB     67.65%
                SRAM:       17696 B       256 KB      6.75%
            IDT_LIST:          0 GB         2 KB      0.00%
    [205/226] Linking C executable zephyr/zephyr_pre0.elf
    
    [209/226] Linking C executable zephyr/zephyr_pre1.elf
    
    [218/226] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       44468 B     499200 B      8.91%
                SRAM:       15904 B       256 KB      6.07%
            IDT_LIST:          0 GB         2 KB      0.00%
    [226/226] Generating zephyr/merged.hex

    As expected, it gives a warning about using the default key file as provided in the original mcuboot library, but the compilation is successful.

    ====== Now adding a custom key file (as you did in your reply) =======

    3- I'm adding the key file (mcuboot_private.pem) and the mcuboot config file (prj.conf -> rename to mcuboot_prj.conf) that you've shared in your reply into the project folder

    4- Compile it with the following command:

    $ west build --pristine -b nrf52840dk_nrf52840 . -- -Dmcuboot_CONF_FILE=mcuboot_prj.conf -DCONF_FILE=prj.conf

    5- This time, it gives the error that I showed in the first post as the following (full log):

    $ west build --pristine -b nrf52840dk_nrf52840 . -- -Dmcuboot_CONF_FILE=mcuboot_prj.conf -DCONF_FILE=prj.conf
    
    -- west build: making build dir /home/ozan/projects/tmp/child_image/smp_svr/build pristine
    -- west build: generating a build system
    Including boilerplate (Zephyr base): /home/ozan/projects/ncs/zephyr/cmake/app/boilerplate.cmake
    -- Application: /home/ozan/projects/tmp/child_image/smp_svr
    -- Zephyr version: 2.7.99 (/home/ozan/projects/ncs/zephyr), build: v2.7.99-ncs1
    -- Found Python3: /home/ozan/.pyenv/versions/3.6.8/bin/python3.6 (found suitable exact version "3.6.8") found components: Interpreter 
    -- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
    -- Board: nrf52840dk_nrf52840
    -- Cache files will be written to: /home/ozan/.cache/zephyr
    -- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (/home/ozan/Downloads/gcc-arm-none-eabi-9-2019-q4-major)
    -- Found BOARD.dts: /home/ozan/projects/ncs/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Generated zephyr.dts: /home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: /home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/dts.cmake
    Parsing /home/ozan/projects/ncs/zephyr/Kconfig
    Loaded configuration '/home/ozan/projects/ncs/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
    Merged configuration '/home/ozan/projects/tmp/child_image/smp_svr/prj.conf'
    Configuration saved to '/home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/.config'
    Kconfig header saved to '/home/ozan/projects/tmp/child_image/smp_svr/build/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 9.2.1
    -- The CXX compiler identification is GNU 9.2.1
    -- The ASM compiler identification is GNU
    -- Found assembler: /home/ozan/Downloads/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc
    
    === child image mcuboot -  begin ===
    loading initial cache file /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/child_image_preload.cmake
    Including boilerplate (Zephyr base): /home/ozan/projects/ncs/zephyr/cmake/app/boilerplate.cmake
    -- Application: /home/ozan/projects/ncs/bootloader/mcuboot/boot/zephyr
    -- Zephyr version: 2.7.99 (/home/ozan/projects/ncs/zephyr), build: v2.7.99-ncs1
    -- Found Python3: /home/ozan/.pyenv/shims/python3.6 (found suitable exact version "3.6.8") found components: Interpreter 
    -- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
    -- Board: nrf52840dk_nrf52840
    -- Cache files will be written to: /home/ozan/.cache/zephyr
    -- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (/home/ozan/Downloads/gcc-arm-none-eabi-9-2019-q4-major)
    -- Found BOARD.dts: /home/ozan/projects/ncs/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Found devicetree overlay: /home/ozan/projects/ncs/nrf/modules/mcuboot/usb.overlay
    -- Found devicetree overlay: /home/ozan/projects/ncs/bootloader/mcuboot/boot/zephyr/dts.overlay
    -- Generated zephyr.dts: /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: /home/ozan/projects/tmp/child_image/smp_svr/build/mcuboot/zephyr/dts.cmake
    CMake Error at /home/ozan/projects/ncs/zephyr/cmake/kconfig.cmake:213 (message):
      File not found:
      /home/ozan/projects/ncs/bootloader/mcuboot/boot/zephyr/mcuboot_prj.conf
    Call Stack (most recent call first):
      /home/ozan/projects/ncs/zephyr/cmake/app/boilerplate.cmake:544 (include)
      /home/ozan/projects/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
      /home/ozan/projects/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
      CMakeLists.txt:44 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    CMake Error at /home/ozan/projects/ncs/nrf/cmake/multi_image.cmake:409 (message):
      CMake generation for mcuboot failed, aborting.  Command: 1
    Call Stack (most recent call first):
      /home/ozan/projects/ncs/nrf/cmake/multi_image.cmake:150 (add_child_image_from_source)
      /home/ozan/projects/ncs/nrf/modules/mcuboot/CMakeLists.txt:216 (add_child_image)
    
    
    -- Configuring incomplete, errors occurred!
    See also "/home/ozan/projects/tmp/child_image/smp_svr/build/CMakeFiles/CMakeOutput.log".
    See also "/home/ozan/projects/tmp/child_image/smp_svr/build/CMakeFiles/CMakeError.log".
    FATAL ERROR: command exited with status 1: /usr/bin/cmake -DWEST_PYTHON=/home/ozan/.pyenv/versions/3.6.8/bin/python3 -B/home/ozan/projects/tmp/child_image/smp_svr/build -S/home/ozan/projects/tmp/child_image/smp_svr -GNinja -DBOARD=nrf52840dk_nrf52840 -Dmcuboot_CONF_FILE=mcuboot_prj.conf -DCONF_FILE=prj.conf

    Unfortunately, I couldn't find what I'm doing wrong here.

    Many thanks,

    Ozan

Children
No Data
Related