<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>MCUBOOT build failed with PK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/100413/mcuboot-build-failed-with-pk</link><description>So I have been having problem settings up MCUBOOT with a private key. I have been following the tutorial mentionned on the nrf documentation https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/app_dev/bootloaders_and_dfu/bootloader_adding</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 13 Jun 2023 09:11:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/100413/mcuboot-build-failed-with-pk" /><item><title>RE: MCUBOOT build failed with PK</title><link>https://devzone.nordicsemi.com/thread/430672?ContentTypeID=1</link><pubDate>Tue, 13 Jun 2023 09:11:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e105c6a-ae75-4157-957f-7e035d85ca05</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I will continue to help in this case.&lt;/p&gt;
&lt;p&gt;Looks like you are trying to build MCUboot as standalone.&lt;br /&gt;In the nRF Connect SDK, we generally recommend building it as a &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/app_dev/multi_image/index.html"&gt;child image&lt;/a&gt; of a project.&lt;/p&gt;
&lt;p&gt;To set custom keys using the multi-image approach, see my &lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/keys_and_signatures/mcuboot_smp_custom_key"&gt;MCUBoot Custom Key with SMP Server sample&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can still build it standalone though. If this is what you want, there is a bug.&lt;/p&gt;
&lt;p&gt;Here is the fix for said bug:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;diff --git a/boot/zephyr/nrf_cleanup.c b/boot/zephyr/nrf_cleanup.c
index f567b97e..6344a985 100644
--- a/boot/zephyr/nrf_cleanup.c
+++ b/boot/zephyr/nrf_cleanup.c
@@ -20,7 +20,7 @@
 
 #include &amp;lt;string.h&amp;gt;
 
-#if defined(USE_PARTITION_MANAGER)
+#if (USE_PARTITION_MANAGER)
 #include &amp;lt;pm_config.h&amp;gt;
 #endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBOOT build failed with PK</title><link>https://devzone.nordicsemi.com/thread/429766?ContentTypeID=1</link><pubDate>Wed, 07 Jun 2023 12:20:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa91fca7-7e84-47ef-b3ae-00cf21398cee</guid><dc:creator>KLarocqueEMFluids</dc:creator><description>&lt;p&gt;Any updates on the matter ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBOOT build failed with PK</title><link>https://devzone.nordicsemi.com/thread/429312?ContentTypeID=1</link><pubDate>Mon, 05 Jun 2023 13:17:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebff2930-eecd-4031-8af2-c5945ead0247</guid><dc:creator>KLarocqueEMFluids</dc:creator><description>&lt;p&gt;In steps how I did&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;1. I used OpenSSL to generate a RSA 2048 key in WSL.&amp;nbsp;&amp;nbsp;openssl genrsa -out private.pem 2048&lt;/p&gt;
&lt;p&gt;2. I put that private key .pem file under a folder called &amp;#39;keys&amp;#39; inside my project&lt;/p&gt;
&lt;p&gt;3. Within my CmakeLists.txt file I added these lines to find the path relative to my key folder as it should be appended within the child image mcuboot.conf&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;set(mcuboot_key_file ${CMAKE_CURRENT_LIST_DIR}/keys/private.pem)
set(mcuboot_CONFIG_BOOT_SIGNATURE_KEY_FILE &amp;quot;\&amp;quot;${mcuboot_key_file}\&amp;quot;&amp;quot;)
if (EXISTS &amp;quot;${CMAKE_CURRENT_SOURCE_DIR}/mcuboot.conf&amp;quot;)
    list(APPEND mcuboot_OVERLAY_CONFIG
      &amp;quot;${CMAKE_CURRENT_SOURCE_DIR}/mcuboot.conf&amp;quot;
      )
endif()
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As you can see within my logs the file is found and not skipped to the DEBUG option.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBOOT build failed with PK</title><link>https://devzone.nordicsemi.com/thread/429310?ContentTypeID=1</link><pubDate>Mon, 05 Jun 2023 13:09:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc81cdbe-67b7-4d97-8582-f435dc86fdd3</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;How did you generate and include your private key to your project?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>