<?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>signed_by_b0_s1_image.bin vs signed_by_mcuboot_and_b0_s1_image_update.bin</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95700/signed_by_b0_s1_image-bin-vs-signed_by_mcuboot_and_b0_s1_image_update-bin</link><description>I am using b0 and MCUBoot (configured with two slots) and am trying to find documentation that explains the difference between &amp;quot;signed_by_b0_s0_image.bin&amp;quot; vs &amp;quot;signed_by_mcuboot_and_b0_s0_image_update.bin&amp;quot;. 
 
 Any help appreciated.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 25 Jan 2023 11:39:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95700/signed_by_b0_s1_image-bin-vs-signed_by_mcuboot_and_b0_s1_image_update-bin" /><item><title>RE: signed_by_b0_s1_image.bin vs signed_by_mcuboot_and_b0_s1_image_update.bin</title><link>https://devzone.nordicsemi.com/thread/406434?ContentTypeID=1</link><pubDate>Wed, 25 Jan 2023 11:39:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a57bea79-1004-4d8f-81d7-0be7caa7f9d6</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="brandon_ask_questions"]&lt;blockquote&gt;&lt;div&gt;AFIAIK the reason for why MCUboot will require signatures to authenticate&amp;nbsp;is since MCUboot is handling the image swapping.&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;/div&gt;
&lt;p&gt;But there is no image swapping for updating MCUBoot. &lt;/p&gt;[/quote]
&lt;p&gt;Good thing you followed up on this, because I see I was a bit unclear/too fast with this comment, so I&amp;#39;ll expand on this some more: It&amp;#39;s correct that there are no swapping, but the signature is not only for the transport of the image. B0 checks versions and chooses that MCUboot version which is the newest version. Then b0 validates that MCUboot version before it boots. It can validate with both signature and/or hash, but the default is signature.&lt;/p&gt;
&lt;p&gt;This sample should illustrate how it&amp;#39;s done:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/main/samples/bootloader/src/main.c"&gt;https://github.com/nrfconnect/sdk-nrf/blob/main/samples/bootloader/src/main.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Please feel free to ask more questions if you still have anything unanswered&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: signed_by_b0_s1_image.bin vs signed_by_mcuboot_and_b0_s1_image_update.bin</title><link>https://devzone.nordicsemi.com/thread/406353?ContentTypeID=1</link><pubDate>Tue, 24 Jan 2023 22:12:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77e451a7-5bf0-47bf-a725-9ef01af5c4c7</guid><dc:creator>brandon_ask_questions</dc:creator><description>&lt;p&gt;Thank you for the thorough response.&lt;/p&gt;
[quote userid="107683" url="~/f/nordic-q-a/95700/signed_by_b0_s1_image-bin-vs-signed_by_mcuboot_and_b0_s1_image_update-bin/405976"]Also its worth noting this about the app primary/secondary slot: per documentation about &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/mcuboot/design.html#image-slots"&gt;image slots&lt;/a&gt;[/quote]
&lt;p&gt;I understand that MCUBoot authenticates and swaps the contents in mcuboot_secondary and&amp;nbsp;mcuboot_primary to perform a update.&lt;/p&gt;
[quote userid="107683" url="~/f/nordic-q-a/95700/signed_by_b0_s1_image-bin-vs-signed_by_mcuboot_and_b0_s1_image_update-bin/405976"]AFIAIK the reason for why MCUboot will require signatures to authenticate&amp;nbsp;is since MCUboot is handling the image swapping.[/quote]
&lt;p&gt;But there is no image swapping for updating MCUBoot. The file name &amp;quot;&lt;span&gt;signed_by_mcuboot_and_b0_s0_image_update.bin&amp;quot; implies that there is swapping or MCUBoot is authenticating the s0/s1 update prior to writing.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;My interpretation is that it&amp;nbsp;is signed by MCUBoot purely to &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.2.0/subsys/net/lib/fota_download/src/fota_download.c#L117"&gt;make the fota_download&lt;/a&gt;&amp;nbsp;library compatible and&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.2.0/subsys/dfu/dfu_target/src/dfu_target.c#L41"&gt;not fail the target check&lt;/a&gt;. I am not using the fota_download library and my conf does not have it enabled.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: signed_by_b0_s1_image.bin vs signed_by_mcuboot_and_b0_s1_image_update.bin</title><link>https://devzone.nordicsemi.com/thread/405976?ContentTypeID=1</link><pubDate>Mon, 23 Jan 2023 09:10:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac1efdd0-03b8-47c8-aaa6-942998e0e46b</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Apologies for the delayed response time, I&amp;#39;ve been out of office since last week.&lt;/p&gt;
[quote user="brandon_ask_questions"]when OTA&amp;#39;ing a MCUBoot is &amp;quot;&lt;span&gt;signed_by_mcuboot_and_b0_s0_image_update.bin&amp;quot; written by the main application to the&amp;nbsp;mucboot_secondary Application slot or s0?&lt;/span&gt;[/quote]
&lt;p&gt;They are written for s0 (or s1 for signed_by_x_s1_image_update.bin&amp;quot;) per&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/app_build_system.html#mcuboot-output-build-files"&gt;MCUboot output build files&lt;/a&gt;, and has nothing to do with the primary or secondary application slot (which are reserved for the application itself).&lt;/p&gt;
&lt;p&gt;As an example (to attempt) to illustrate this: In your firmware with an updatable bootloader you will have a B0, S0 and S1 slot in addition to the application slot(s). In FW v.1, you will run the immutable bootloader in b0 and the second stage bootloader in S0. The immutable bootloader will ensure that itself runs first, followed by whatever is in S0, then it will run the application.&lt;/p&gt;
&lt;p&gt;If you want to update the bootloader in FW v.2 you will have to use &amp;quot;&lt;span&gt;signed_by_mcuboot_and_b0_s1_image_update&amp;quot; to put the new instance of MCUboot in S1. The immutable bootloader (b0) will now update to run itself first, then use s1 (and ignore s0), and then the app.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;If you want to update the bootloader yet again in FW v.3 you will need to use s0_image_update and put the new instance of MCUboot in s0 and now you will overwrite the first instance of mcuboot stored in s0. This procedure repeats for FW v.X.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also its worth noting this about the app primary/secondary slot: per documentation about &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/mcuboot/design.html#image-slots"&gt;image slots&lt;/a&gt;&amp;nbsp;&amp;quot;&lt;em&gt;Normally, the bootloader will only run an image from the primary slot, so images must be built such that they can run from that fixed location in flash (the exception to this is the direct-xip and the ram-load upgrade mode). If the bootloader needs to run the image resident in the secondary slot, it must copy its contents into the primary slot before doing so, either by swapping the two images or by overwriting the contents of the primary slot.&amp;quot;&lt;/em&gt;&lt;/p&gt;
[quote user="brandon_ask_questions"]I am confused on why it is signed by MCUboot sense MCUBoot isnt authenticating &amp;quot;signed_by_mcuboot_and_b0_s0_image_update.bin&amp;quot; (i.e. bootchain is b0-&amp;gt;mcuboot-&amp;gt;app)[/quote]
&lt;p&gt;AFIAIK the reason for why MCUboot will require signatures to authenticate&amp;nbsp;is since MCUboot is handling the image swapping.&lt;/p&gt;
&lt;p&gt;Let me know if this clarifies things for you!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: signed_by_b0_s1_image.bin vs signed_by_mcuboot_and_b0_s1_image_update.bin</title><link>https://devzone.nordicsemi.com/thread/405309?ContentTypeID=1</link><pubDate>Tue, 17 Jan 2023 15:26:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19a36491-f6db-4a53-bffc-9508aa14240a</guid><dc:creator>brandon_ask_questions</dc:creator><description>&lt;p&gt;Hi AHaug,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for answering.&lt;br /&gt;&lt;br /&gt;Another question, when OTA&amp;#39;ing a MCUBoot is &amp;quot;&lt;span&gt;signed_by_mcuboot_and_b0_s0_image_update.bin&amp;quot; written by the main application to the&amp;nbsp;mucboot_secondary Application slot or s0?&amp;nbsp;I am confused on why it is signed by MCUboot sense MCUBoot isnt authenticating &amp;quot;signed_by_mcuboot_and_b0_s0_image_update.bin&amp;quot; (i.e. bootchain is b0-&amp;gt;mcuboot-&amp;gt;app)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: signed_by_b0_s1_image.bin vs signed_by_mcuboot_and_b0_s1_image_update.bin</title><link>https://devzone.nordicsemi.com/thread/405164?ContentTypeID=1</link><pubDate>Tue, 17 Jan 2023 08:26:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee9115af-35c0-46b3-94f3-136b285a670c</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;We have&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/app_build_system.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/app_build_system.html&amp;nbsp;&lt;/a&gt;which describes&amp;nbsp;&lt;span&gt;signed_by_mcuboot_and_b0_s0_image_update (&lt;/span&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/app_build_system.html#mcuboot-output-build-files"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/app_build_system.html#mcuboot-output-build-files&lt;/a&gt;), which is the image you will want to use.&lt;/p&gt;
&lt;p&gt;If you examine CMake, then you can see that signed_by_b0_ is generated in&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/81c0de2459dbb41248edf632f8678b515c074d8a/subsys/bootloader/cmake/sign.cmake#L78"&gt;sign.cmake&lt;/a&gt;&amp;nbsp;and is later used in &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/81c0de2459dbb41248edf632f8678b515c074d8a/modules/mcuboot/CMakeLists.txt#L497"&gt;nrf/modules/mcuboot/CMakeLists.txt t&lt;/a&gt;o generate&amp;nbsp;signed_by_mcuboot_and_b0&lt;/p&gt;
&lt;p&gt;You will want to use&amp;nbsp;signed_by_b0 if you use NSIB as the only bootloader, ref this (unofficial) sample:&amp;nbsp;&lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/updatable_bootloader/nsib_simple"&gt;https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/updatable_bootloader/nsib_simple&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I know that this documentation is hard to find, and I will have a chat with our tech writers if we can add some documentation about&amp;nbsp;&lt;span&gt;signed_by_b0_image in the build system page I linked at the top&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Let me know if this answers your questions!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kind regards,&lt;br /&gt;Andreas&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>