-DSB_CONFIG_BOOT_SIGNATURE_KEY_FILE in comand line causes error due to malformated string

Hello

I would like to sign an image temporarily with west CMake options as described in Enabling a bootloader chain using sysbuild using the comand line: 

-DSB_CONFIG_BOOT_SIGNATURE_KEY_FILE=\"priv.pem\"

In it's final state I would like to specify an absolute path, where the keyfile is stored. It seems as if I am not able to provide the proper format for the path value "D:\priv.pem".

I applied this also to the example "sysbuild\with_MCUboot" and use the nrf sdk v2.7.0. The result is still a malformat for the string. 

 

PS C:\Users\User1> west build --pristine  --sysbuild  -b nrf52840dk/nrf52840 with_mcuboot  -d with_mcuboot/build -- -DSB_CONFIG_BOOT_SIGNATURE_KEY_FILE=\"D:\priv.pem\" 
-- west build: making build dir C:\Users\User1\with_mcuboot\build pristine
-- west build: generating a build system
Loading Zephyr module(s) (Zephyr base): sysbuild_default
-- Found Python3: C:/ncs/toolchains/ce3b5ff664/opt/bin/python.exe (found suitable version "3.9.13", minimum required is "3.8") found components: Interpreter 
-- Cache files will be written to: C:/ncs/v2.7.0/zephyr/.cache
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
-- Board: nrf52840dk, qualifiers: nrf52840

C:/Users/User1/with_mcuboot/build/zephyr/misc/generated/extra_kconfig_options.conf:2: warning: malformed string literal in assignment to BOOT_SIGNATURE_KEY_FILE (defined at C:/ncs/v2.7.0/zephyr/share/sysbuild\images\bootloader/Kconfig:58). Assignment ignored.Parsing C:/ncs/v2.7.0/zephyr/share/sysbuild/Kconfig
Loaded configuration 'C:/Users/User1/with_mcuboot/build/_sysbuild/empty.conf'
Merged configuration 'C:/Users/User1/with_mcuboot/sysbuild.conf'
Merged configuration 'C:/Users/User1/with_mcuboot/build/zephyr/misc/generated/extra_kconfig_options.conf'


error: Aborting due to Kconfig warnings

CMake Error at C:/ncs/v2.7.0/zephyr/cmake/modules/kconfig.cmake:392 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  cmake/modules/sysbuild_kconfig.cmake:101 (include)
  cmake/modules/sysbuild_default.cmake:17 (include)
  C:/ncs/v2.7.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:75 (include)
  C:/ncs/v2.7.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  C:/ncs/v2.7.0/zephyr/share/sysbuild-package/cmake/SysbuildConfig.cmake:8 (include)
  template/CMakeLists.txt:10 (find_package)


-- Configuring incomplete, errors occurred!
See also "C:/Users/User1/with_mcuboot/build/CMakeFiles/CMakeOutput.log".
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\ce3b5ff664\opt\bin\cmake.EXE' -DWEST_PYTHON=C:/ncs/toolchains/ce3b5ff664/opt/bin/python.exe '-BC:\Users\User1\with_mcuboot\build' -GNinja -DBOARD=nrf52840dk/nrf52840 '-DSB_CONFIG_BOOT_SIGNATURE_KEY_FILE=\E:\priv.pem\' '-SC:\ncs\v2.7.0\zephyr\share\sysbuild' '-DAPP_DIR:PATH=C:\Users\User1\with_mcuboot'

setting the absolut path in the sysbuild.conf (SB_CONFIG_BOOT_SIGNATURE_KEY_FILE) compiles without error. I tried a lot of combinations but don't seem to get this to work.Also placing the priv.pm in the west topdir and using the example =\"priv.pem\" os not working.

Any idea what I am doing wrong?

  • Hi, yes your understanding is correct. However, I have the same behaviour no mattter if specifying absolute or  relative path. But yes, there seems to something else wrong.

    The forward and backlashes I saw as well. Do you know what that could be?

  • Hello,

    Based on the error message "malformed string," I believe this could be due to a quoting issue, as different platforms and shells handle quotes differently.

    Could you try using -DSB_CONFIG_BOOT_SIGNATURE_KEY_FILE='\"priv.pem\"' and let me know if this resolves the issue?

    Kind regards,
    Abhijith

  • This also gives an error (but different), following result i get with "priv.pem" in the west topdir folder (sorry I somehow can't copy this into a code block):

    west build --pristine  --sysbuild  -b nrf52840dk/nrf52840 with_mcuboot  -d with_mcuboot/build -- -DSB_CONFIG_BOOT_SIGNATURE_KEY_FILE='\"priv.pem\"'

    -- west build: generating a build system

    Loading Zephyr module(s) (Zephyr base): sysbuild_default

    -- Found Python3: C:/ncs/toolchains/ce3b5ff664/opt/bin/python.exe (found suitable version "3.9.13", minimum required is "3.8") found components: Interpreter

    -- Cache files will be written to: C:/ncs/v2.7.0/zephyr/.cache

    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")

    -- Board: nrf52840dk, qualifiers: nrf52840

    Parsing C:/ncs/v2.7.0/zephyr/share/sysbuild/Kconfig

    Loaded configuration 'D:/with_mcuboot/build/_sysbuild/empty.conf'

    Merged configuration 'D:/with_mcuboot/sysbuild.conf'

    Merged configuration 'D:/with_mcuboot/build/zephyr/misc/generated/extra_kconfig_options.conf'

    Configuration saved to 'D:/with_mcuboot/build/zephyr/.config'

    Kconfig header saved to 'D:/with_mcuboot/build/_sysbuild/autoconf.h'

    --

       *****************************

       * Running CMake for mcuboot *

       *****************************

     

    Loading Zephyr default modules (Zephyr base).

    -- Application: C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr

    -- CMake version: 3.21.0

    -- Using NCS Toolchain 2.6.20240605.885759407716 for building. (C:/ncs/toolchains/ce3b5ff664/cmake)

    -- Found Python3: C:/ncs/toolchains/ce3b5ff664/opt/bin/python.exe (found suitable version "3.9.13", minimum required is "3.8") found components: Interpreter

    -- Cache files will be written to: C:/ncs/v2.7.0/zephyr/.cache

    -- Zephyr version: 3.6.99 (C:/ncs/v2.7.0/zephyr)

    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")

    -- Board: nrf52840dk, qualifiers: nrf52840

    -- Found host-tools: zephyr 0.16.5 (C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk)

    -- Found toolchain: zephyr 0.16.5 (C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk)

    -- Found Dtc: C:/ncs/toolchains/ce3b5ff664/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")

    -- Found BOARD.dts: C:/ncs/v2.7.0/zephyr/boards/nordic/nrf52840dk/nrf52840dk_nrf52840.dts

    -- Found devicetree overlay: C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/app.overlay

    -- Generated zephyr.dts: D:/with_mcuboot/build/mcuboot/zephyr/zephyr.dts

    -- Generated devicetree_generated.h: D:/with_mcuboot/build/mcuboot/zephyr/include/generated/devicetree_generated.h

    -- Including generated dts.cmake file: D:/with_mcuboot/build/mcuboot/zephyr/dts.cmake

    Parsing C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/Kconfig

    Loaded configuration 'C:/ncs/v2.7.0/zephyr/boards/nordic/nrf52840dk/nrf52840dk_nrf52840_defconfig'

    Merged configuration 'C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/prj.conf'

    Merged configuration 'C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/boards/nrf52840dk_nrf52840.conf'

    Merged configuration 'D:/with_mcuboot/sysbuild/mcuboot.conf'

    Merged configuration 'D:/with_mcuboot/build/mcuboot/zephyr/.config.sysbuild'

    Configuration saved to 'D:/with_mcuboot/build/mcuboot/zephyr/.config'

    Kconfig header saved to 'D:/with_mcuboot/build/mcuboot/zephyr/include/generated/autoconf.h'

    -- Found GnuLd: c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")

    -- The C compiler identification is GNU 12.2.0

    -- The CXX compiler identification is GNU 12.2.0

    -- The ASM compiler identification is GNU

    -- Found assembler: C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe

    CMake Warning at C:/ncs/v2.7.0/nrf/lib/flash_patch/CMakeLists.txt:8 (message):

     

     

            ----------------------------------------------------------

            --- WARNING: To maintain the integrity of secure boot, ---

            --- enable CONFIG_DISABLE_FLASH_PATCH in production.   ---

            ----------------------------------------------------------

     

     

    MCUBoot bootloader key file: C:/ncs/v2.7.0/bootloader/mcuboot/priv.pem

    -- Configuring done

    -- Generating done

    -- Build files have been written to: D:/with_mcuboot/build/mcuboot

    --

       **********************************

       * Running CMake for with_mcuboot *

       **********************************

     

    Loading Zephyr default modules (Zephyr base).

    -- Application: D:/with_mcuboot

    -- CMake version: 3.21.0

    -- Using NCS Toolchain 2.6.20240605.885759407716 for building. (C:/ncs/toolchains/ce3b5ff664/cmake)

    -- Found Python3: C:/ncs/toolchains/ce3b5ff664/opt/bin/python.exe (found suitable version "3.9.13", minimum required is "3.8") found components: Interpreter

    -- Cache files will be written to: C:/ncs/v2.7.0/zephyr/.cache

    -- Zephyr version: 3.6.99 (C:/ncs/v2.7.0/zephyr)

    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")

    -- Board: nrf52840dk, qualifiers: nrf52840

    -- Found host-tools: zephyr 0.16.5 (C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk)

    -- Found toolchain: zephyr 0.16.5 (C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk)

    -- Found Dtc: C:/ncs/toolchains/ce3b5ff664/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")

    -- Found BOARD.dts: C:/ncs/v2.7.0/zephyr/boards/nordic/nrf52840dk/nrf52840dk_nrf52840.dts

    -- Generated zephyr.dts: D:/with_mcuboot/build/with_mcuboot/zephyr/zephyr.dts

    -- Generated devicetree_generated.h: D:/with_mcuboot/build/with_mcuboot/zephyr/include/generated/devicetree_generated.h

    -- Including generated dts.cmake file: D:/with_mcuboot/build/with_mcuboot/zephyr/dts.cmake

     

    warning: UPDATEABLE_IMAGE_NUMBER (defined at

    C:/ncs/v2.7.0/nrf\samples\common\mcumgr_bt_ota_dfu/Kconfig:89, subsys/dfu/Kconfig:95) was assigned

    the value '1' but got the value ''. Check these unsatisfied dependencies:

    (((BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS) && SOC_SERIES_NRF53X &&

    NCS_SAMPLE_MCUMGR_BT_OTA_DFU) || (!MCUBOOT && IMG_MANAGER)) (=n). See

    docs.zephyrproject.org/.../kconfig.html and/or look up

    UPDATEABLE_IMAGE_NUMBER in the menuconfig/guiconfig interface. The Application Development Primer,

    Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be

    helpful too.

     

     

    warning: MCUBOOT_UPDATE_FOOTER_SIZE (defined at subsys/dfu/Kconfig:54) was assigned the value

    '0x2000' but got the value ''. Check these unsatisfied dependencies: MCUBOOT_IMG_MANAGER (=n),

    IMG_MANAGER (=n). See

    docs.zephyrproject.org/.../kconfig.html and/or look up

    MCUBOOT_UPDATE_FOOTER_SIZE in the menuconfig/guiconfig interface. The Application Development

    Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual

    might be helpful too.

     

    Parsing C:/ncs/v2.7.0/zephyr/Kconfig

    Loaded configuration 'C:/ncs/v2.7.0/zephyr/boards/nordic/nrf52840dk/nrf52840dk_nrf52840_defconfig'

    Merged configuration 'D:/with_mcuboot/prj.conf'

    Merged configuration 'D:/with_mcuboot/build/with_mcuboot/zephyr/.config.sysbuild'

    Configuration saved to 'D:/with_mcuboot/build/with_mcuboot/zephyr/.config'

    Kconfig header saved to 'D:/with_mcuboot/build/with_mcuboot/zephyr/include/generated/autoconf.h'

    -- Found GnuLd: c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")

    -- The C compiler identification is GNU 12.2.0

    -- The CXX compiler identification is GNU 12.2.0

    -- The ASM compiler identification is GNU

    -- Found assembler: C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe

    -- Including signing script: C:/ncs/v2.7.0/nrf/cmake/sysbuild/image_signing.cmake

    -- Configuring done

    -- Generating done

    -- Build files have been written to: D:/with_mcuboot/build/with_mcuboot

    CMake Warning at C:/ncs/v2.7.0/nrf/cmake/sysbuild/partition_manager.cmake:84 (message):

     

     

            ---------------------------------------------------------------------

            --- WARNING: Using a bootloader without pm_static.yml.            ---

            --- There are cases where a deployed product can consist of       ---

            --- multiple images, and only a subset of these images can be     ---

            --- upgraded through a firmware update mechanism. In such cases,  ---

            --- the upgradable images must have partitions that are static    ---

            --- and are matching the partition map used by the bootloader     ---

            --- programmed onto the device.                                   ---

            ---------------------------------------------------------------------

     

     

    Call Stack (most recent call first):

      C:/ncs/v2.7.0/nrf/cmake/sysbuild/partition_manager.cmake:608 (partition_manager)

      C:/ncs/v2.7.0/nrf/sysbuild/CMakeLists.txt:470 (include)

      cmake/modules/sysbuild_extensions.cmake:553 (nrf_POST_CMAKE)

      cmake/modules/sysbuild_extensions.cmake:553 (cmake_language)

      cmake/modules/sysbuild_images.cmake:23 (sysbuild_module_call)

      cmake/modules/sysbuild_default.cmake:19 (include)

      C:/ncs/v2.7.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:75 (include)

      C:/ncs/v2.7.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)

      C:/ncs/v2.7.0/zephyr/share/sysbuild-package/cmake/SysbuildConfig.cmake:8 (include)

      template/CMakeLists.txt:10 (find_package)

     

     

    -- Configuring done

    -- Generating done

    -- Build files have been written to: D:/with_mcuboot/build

    ←[92m-- west build: building application

    [9/20] Performing build step for 'mcuboot'

    ninja: error: 'C:/ncs/v2.7.0/bootloader/mcuboot/priv.pem', needed by 'zephyr/autogen-pubkey.c', missing and no known rule to make it

    [10/20] No configure step for 'with_mcuboot'

    FAILED: _sysbuild/sysbuild/images/bootloader/mcuboot-prefix/src/mcuboot-stamp/mcuboot-build D:/with_mcuboot/build/_sysbuild/sysbuild/images/bootloader/mcuboot-prefix/src/mcuboot-stamp/mcuboot-build

    cmd.exe /C "cd /D D:\with_mcuboot\build\mcuboot && C:\ncs\toolchains\ce3b5ff664\opt\bin\cmake.exe --build ."

    ninja: build stopped: subcommand failed.

    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\ce3b5ff664\opt\bin\cmake.EXE' --build D:/with_mcuboot/build

  • Hi MTB,

    There seem to be some issues with inserting code blocks at the moment. We are aware of it and are investigating it.

    Regarding your new error, the clue is here:

    MTB said:
    ninja: error: 'C:/ncs/v2.7.0/bootloader/mcuboot/priv.pem', needed by 'zephyr/autogen-pubkey.c', missing and no known rule to make it

    It indicates that the build system interprets the file name as a relative path with respect to the <sdk>/bootloader/mcuboot folder.

    The solution to this would be to use absolute path instead.

  • Hello Hieu,

    My initial plan was to use absolute path (see my initial post), which is also not possible and results in the malformed string error from the initial post.

    What would be the proper format to specifiy an absolute path? 

Related