Signing file with a relative key path

Hello,

In my project I have b0, mcuboot and an app. My nRF SDK version is v2.7.0.

My project works fine if I use an absolute address in SB_CONFIG_BOOT_SIGNATURE_KEY_FILE but it doesn't work anymore when I put a relative address (SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="${APP_DIR}/keys/mcuboot_private.pem").


In fact, the compilation goes well but when signing the file it fails in the file b0_mcuboot_signing.cmake to find the file given by the content of "keyfile": FileNotFoundError: [Errno 2] No such file or directory: '/keys/mcuboot_private.pem'


By analyzing, I notice that in "keyfile" there is the string "${APP_DIR}/keys/mcuboot_private.pem": I imagine that it is because the instruction at the beginning of the function is "set(keyfile "${SB_CONFIG_BOOT_SIGNATURE_KEY_FILE}")" and that therefore it only copies the content of SB_CONFIG_BOOT_SIGNATURE_KEY_FILE (witch is "${APP_DIR}/keys/mcuboot_private.pem") without converting ${APP_DIR}?

How could I do so that the value in SB_CONFIG_BOOT_SIGNATURE_KEY_FILE has the full path and not that extra ${APP_DIR}?

Thanks

Parents
  • Hello,

    In nRF Connect SDK v2.7.0, the introduction of Sysbuild might have changed how the build system manages paths and configurations, but I'm not completely sure as I haven't tested it myself. Which Nordic chip/DK are you using?

    Could you try using get_filename_component inside CMake? This command will convert a relative path to an absolute path. For example: get_filename_component(keyfile "${SB_CONFIG_BOOT_SIGNATURE_KEY_FILE}" ABSOLUTE ${CMAKE_CURRENT_SOURCE_DIR}). See this.

    #  Define the relative APP_DIR
    
    # Define the relative path to the key file
    
    # Convert the relative path to an absolute path for signing purposes (using the get_filename_component())

    Kind Regards,

    Abhijith

Reply
  • Hello,

    In nRF Connect SDK v2.7.0, the introduction of Sysbuild might have changed how the build system manages paths and configurations, but I'm not completely sure as I haven't tested it myself. Which Nordic chip/DK are you using?

    Could you try using get_filename_component inside CMake? This command will convert a relative path to an absolute path. For example: get_filename_component(keyfile "${SB_CONFIG_BOOT_SIGNATURE_KEY_FILE}" ABSOLUTE ${CMAKE_CURRENT_SOURCE_DIR}). See this.

    #  Define the relative APP_DIR
    
    # Define the relative path to the key file
    
    # Convert the relative path to an absolute path for signing purposes (using the get_filename_component())

    Kind Regards,

    Abhijith

Children
Related