MCUBoot private key on nrf5340dk

Hi,

I work with win10 laptop, Toolchain  nrf Connect SDK 1.6.1 on a nrf5340dk. I use peripheral_uart sample.

I follow the guide:

https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/ncs-dfu

It's work well.

But now, I need to use a private MCUBoot Key like on this ticket:

https://devzone.nordicsemi.com/f/nordic-q-a/71892/cmake-warning-using-default-mcuboot-key-it-should-not-be-used-for-production

I created the priv.pem file with opennssl:

"

-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIFOsF97yRp38uZW7PJbvFAwK1Uivv6VzIA7Kw79z3Am+oAoGCCqGSM49
AwEHoUQDQgAEHYxvVXgkcjwdhVkUDEDJ7EdLO5HAdiwDLCHXcS5uH41mMAbp8rDI
Ykb+splDuAQFsxV8sxuXZYW2zg3jb4+vxg==
-----END EC PRIVATE KEY-----

"

I put priv.pem in my repertory:

D:\elect\projets_nordic_D\dfu_peripheral_uart_private_key

I created the mcuboot.conf:

I modified the prj.conf:

I modified the CmakeList.txt:

But when I build it with west I this following "fatal error":

FATAL ERROR: command exited with status 1: 'D:\elect\ncs\v1.6.1\toolchain\opt\bin\cmake.EXE' --build 'D:\elect\projets_nordic_D\dfu_peripheral_uart_private_key\build'

Could you help to understand the error and make MCUBoot private key working ?

Best regards,

Rob

Parents
  • Hi,

    Try adding these configs to your mcuboot.conf

    CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256=y
    CONFIG_PCD=y

  • Hi Øivind,

    Thank you for your answer.

    I tried to add to mcuboot.conf:

    "

    CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256=y
    CONFIG_PCD=y

    "

    The build work, I had this message before flashing:

    "

    D:\elect\projets_nordic_D\dfu_peripheral_uart_private_key>west flash
    -- west flash: rebuilding
    [0/17] Performing build step for 'mcuboot_subimage'
    ninja: no work to do.
    [1/11] Performing build step for 'b0_subimage'
    ninja: no work to do.
    [2/7] Performing build step for 'hci_rpmsg_subimage'
    [0/5] Performing build step for 'b0n_subimage'
    ninja: no work to do.
    -- west flash: using runner nrfjprog
    Using board 960132679
    FATAL ERROR: The hex file contains data placed in the UICR, which needs a full erase before reprogramming. Run west flash again with --force, --erase, or --recover.

    "

    So I tried: "west flash recover"

    and I had this message from the Uart:

    "

    *** Booting Zephyr OS build v2.6.0-rc1-ncs1  ***
    Attempting to boot slot 0.
    No fw_info struct found.
    Attempting to boot slot 1.
    No fw_info struct found.
    No bootable image found. Aborting boot.
    "

    It look like I miss something to make image bootable...

    Here is a zip of my project:

    Best Regards,

    Rob

  • Hi Øivind,

    Could you help me to make image bootable, please ?

    Best Regards,

    Rob

  • Hi,

    Sorry for the late reply, it has been busy this last week.

    I am able to boot the image when I add CONFIG_FW_INFO=y to mcuboot.conf.

  • Thanks you very much for your reply.

    I had CONFIG_FW_INFO=y to mcuboot.conf,

    but now I have this message:

    "

    *** Booting Zephyr OS build v2.6.0-rc1-ncs1  ***
    Attempting to boot slot 0.
    Attempting to boot from address 0x8200.
    Verifying signature against key 0.
    Hash: 0x2e...e0
    Firmware signature verified.
    Firmware version 1
    Setting monotonic counter (version: 1, slot: 0)
    *** Booting Zephyr OS build v2.6.0-rc1-ncs1  ***
    I: Starting bootloader
    W: Failed reading sectors; BOOT_MAX_IMG_SECTORS=128 - too small?
    E: Unable to find bootable image

    "

    How can I increase the BOOT_MAX_IMG_SECTORS ?

    Best Regards,

    Rob

Reply
  • Thanks you very much for your reply.

    I had CONFIG_FW_INFO=y to mcuboot.conf,

    but now I have this message:

    "

    *** Booting Zephyr OS build v2.6.0-rc1-ncs1  ***
    Attempting to boot slot 0.
    Attempting to boot from address 0x8200.
    Verifying signature against key 0.
    Hash: 0x2e...e0
    Firmware signature verified.
    Firmware version 1
    Setting monotonic counter (version: 1, slot: 0)
    *** Booting Zephyr OS build v2.6.0-rc1-ncs1  ***
    I: Starting bootloader
    W: Failed reading sectors; BOOT_MAX_IMG_SECTORS=128 - too small?
    E: Unable to find bootable image

    "

    How can I increase the BOOT_MAX_IMG_SECTORS ?

    Best Regards,

    Rob

Children
No Data
Related