<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX ProcessorsのトピックRe: IMX8QXP secure boot</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/IMX8QXP-secure-boot/m-p/1421962#M187697</link>
    <description>&lt;P&gt;Have you ever read the doc yuri provided?&lt;/P&gt;
&lt;P&gt;Have you ?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you read it, you will find&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;The OS container needs to be prepared with proper container header in order to
sign the OS image. Using imx-mkimage tool provided by NXP, the OS image can be
wrapped into a container format.&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;PRE&gt;- Build the kernel image for the target

  $ make SOC=&amp;lt;SoC name&amp;gt; flash_kernel
  $ mv &amp;lt;SoC name&amp;gt;/flash.bin &amp;lt;SoC name&amp;gt;/flash_os.bin&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://source.codeaurora.org/external/imx/imx-mkimage/tree/iMX8QX/soc.mak?h=lf-5.10.52-2.1.0" target="_blank" rel="noopener"&gt;https://source.codeaurora.org/external/imx/imx-mkimage/tree/iMX8QX/soc.mak?h=lf-5.10.52-2.1.0&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN class="nf"&gt;flash_kernel&lt;/SPAN&gt;&lt;SPAN class="o"&gt;:&lt;/SPAN&gt; &lt;SPAN class="k"&gt;$(&lt;/SPAN&gt;&lt;SPAN class="nv"&gt;MKIMG&lt;/SPAN&gt;&lt;SPAN class="k"&gt;)&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Image&lt;/SPAN&gt; &lt;SPAN class="n"&gt;fsl&lt;/SPAN&gt;-&lt;SPAN class="n"&gt;imx&lt;/SPAN&gt;8&lt;SPAN class="n"&gt;qxp&lt;/SPAN&gt;-&lt;SPAN class="n"&gt;mek&lt;/SPAN&gt;.&lt;SPAN class="n"&gt;dtb&lt;/SPAN&gt;
	./&lt;SPAN class="k"&gt;$(&lt;/SPAN&gt;MKIMG&lt;SPAN class="k"&gt;)&lt;/SPAN&gt; -soc QX -rev B0 -c -ap Image a35 0x80280000 --data fsl-imx8qxp-mek.dtb 0x83000000 -out flash.bin
&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;If you want, you can modify to add a ramdisk to sign.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want, you can modify anything to sign.&lt;/P&gt;
&lt;P&gt;That is to say, anything you need for boot without authentication. Just add to the os container by imx-mkimge then you can use the athentication boot.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The BSP example is use the Image,&amp;nbsp;fsl-imx8qxp-mek.dtb to do none athentication.&lt;/P&gt;
&lt;P&gt;and just put the&amp;nbsp;Image,&amp;nbsp;fsl-imx8qxp-mek.dtb to os container by imx-mkimage and sign it, then can do anthentication boot.&lt;/P&gt;
&lt;P&gt;It is container, Image0 ~ ImageN.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;authenticate_os_container will help you copy the image for example the Image(kernel) to the loader address 0x80280000&amp;nbsp; (-ap Image a35 0x80280000 in imx-mkimage).&lt;/P&gt;
&lt;P&gt;Before, you use the fatload to load the Image to the 0x80280000.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}&lt;/P&gt;
&lt;P&gt;#define CONFIG_LOADADDR 0x80280000&lt;/P&gt;
&lt;P&gt;dr_mode with "peripheral"&lt;/P&gt;
&lt;P&gt;"fi; " \&lt;/P&gt;
&lt;P&gt;"if test ${sec_boot} = yes; then " \&lt;/P&gt;
&lt;P&gt;"${get_cmd} ${cntr_addr} ${cntr_file}; " \&lt;/P&gt;
&lt;P&gt;"if run auth_os; then " \&lt;/P&gt;
&lt;P&gt;"run boot_os; " \&lt;/P&gt;
&lt;P&gt;"else " \&lt;/P&gt;
&lt;P&gt;"echo ERR: failed to authenticate; " \&lt;/P&gt;
&lt;P&gt;"fi; " \&lt;/P&gt;
&lt;P&gt;"else " \&lt;/P&gt;
&lt;P&gt;"${get_cmd} ${loadaddr} ${image}; " \&lt;/P&gt;
&lt;P&gt;"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \&lt;/P&gt;
&lt;P&gt;"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \&lt;/P&gt;
&lt;P&gt;"run boot_os; " \&lt;/P&gt;
&lt;P&gt;"else " \&lt;/P&gt;
&lt;P&gt;"echo WARN: Cannot load the DT; " \&lt;/P&gt;
&lt;P&gt;"fi; " \&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;int authenticate_os_container(ulong addr)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;..........&lt;/P&gt;
&lt;P&gt;..........&lt;/P&gt;
&lt;P&gt;..........&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* Copy images to dest address */&lt;/P&gt;
&lt;P&gt;for (i = 0; i &amp;lt; phdr-&amp;gt;num_images; i++) {&lt;/P&gt;
&lt;P&gt;img = (struct boot_img_t *)(addr +&lt;/P&gt;
&lt;P&gt;sizeof(struct container_hdr) +&lt;/P&gt;
&lt;P&gt;i * sizeof(struct boot_img_t));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;debug("img %d, dst 0x%x, src 0x%lux, size 0x%x\n",&lt;/P&gt;
&lt;P&gt;i, (uint32_t) img-&amp;gt;dst, img-&amp;gt;offset + addr, img-&amp;gt;size);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;memcpy((void *)img-&amp;gt;dst, (const void *)(img-&amp;gt;offset + addr),&lt;/P&gt;
&lt;P&gt;img-&amp;gt;size);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;s = img-&amp;gt;dst &amp;amp; ~(CONFIG_SYS_CACHELINE_SIZE - 1);&lt;/P&gt;
&lt;P&gt;e = ALIGN(img-&amp;gt;dst + img-&amp;gt;size, CONFIG_SYS_CACHELINE_SIZE) - 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;flush_dcache_range(s, e);&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="无标题.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/172291iF700A73DDDEFFF91/image-size/large?v=v2&amp;amp;px=999" role="button" title="无标题.png" alt="无标题.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Mar 2022 14:59:17 GMT</pubDate>
    <dc:creator>BiyongSUN</dc:creator>
    <dc:date>2022-03-02T14:59:17Z</dc:date>
    <item>
      <title>IMX8QXP secure boot</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/IMX8QXP-secure-boot/m-p/1419465#M187497</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;After reading the IMX8QXP secure boot document, it is found that only uboot is signed.&lt;/P&gt;&lt;P&gt;How does the KERNEL sign and boot?&amp;nbsp; Is there any document?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Feb 2022 02:51:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/IMX8QXP-secure-boot/m-p/1419465#M187497</guid>
      <dc:creator>gravity_one</dc:creator>
      <dc:date>2022-02-25T02:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: IMX8QXP secure boot</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/IMX8QXP-secure-boot/m-p/1419503#M187502</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/90146"&gt;@gravity_one&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; please refer to the following:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://source.codeaurora.org/external/imx/uboot-imx/tree/doc/imx/ahab/guides/sign_os_cntr.txt?h=lf_v2021.04" target="_blank"&gt;https://source.codeaurora.org/external/imx/uboot-imx/tree/doc/imx/ahab/guides/sign_os_cntr.txt?h=lf_v2021.04&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Yuri.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Feb 2022 04:05:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/IMX8QXP-secure-boot/m-p/1419503#M187502</guid>
      <dc:creator>Yuri</dc:creator>
      <dc:date>2022-02-25T04:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: IMX8QXP secure boot</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/IMX8QXP-secure-boot/m-p/1421505#M187666</link>
      <description>&lt;P&gt;Hi Yuri，&lt;/P&gt;&lt;P&gt;But when FOTA is upgraded, only KERNEL IMAGE and DTB are upgraded, how to boot safely?&lt;BR /&gt;How do I verify that KERNEL IMAGE and DTB are signed?&lt;/P&gt;&lt;P&gt;Brs，&lt;/P&gt;&lt;P&gt;Gravity&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 02:33:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/IMX8QXP-secure-boot/m-p/1421505#M187666</guid>
      <dc:creator>gravity_one</dc:creator>
      <dc:date>2022-03-02T02:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: IMX8QXP secure boot</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/IMX8QXP-secure-boot/m-p/1421962#M187697</link>
      <description>&lt;P&gt;Have you ever read the doc yuri provided?&lt;/P&gt;
&lt;P&gt;Have you ?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you read it, you will find&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;The OS container needs to be prepared with proper container header in order to
sign the OS image. Using imx-mkimage tool provided by NXP, the OS image can be
wrapped into a container format.&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;PRE&gt;- Build the kernel image for the target

  $ make SOC=&amp;lt;SoC name&amp;gt; flash_kernel
  $ mv &amp;lt;SoC name&amp;gt;/flash.bin &amp;lt;SoC name&amp;gt;/flash_os.bin&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://source.codeaurora.org/external/imx/imx-mkimage/tree/iMX8QX/soc.mak?h=lf-5.10.52-2.1.0" target="_blank" rel="noopener"&gt;https://source.codeaurora.org/external/imx/imx-mkimage/tree/iMX8QX/soc.mak?h=lf-5.10.52-2.1.0&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN class="nf"&gt;flash_kernel&lt;/SPAN&gt;&lt;SPAN class="o"&gt;:&lt;/SPAN&gt; &lt;SPAN class="k"&gt;$(&lt;/SPAN&gt;&lt;SPAN class="nv"&gt;MKIMG&lt;/SPAN&gt;&lt;SPAN class="k"&gt;)&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Image&lt;/SPAN&gt; &lt;SPAN class="n"&gt;fsl&lt;/SPAN&gt;-&lt;SPAN class="n"&gt;imx&lt;/SPAN&gt;8&lt;SPAN class="n"&gt;qxp&lt;/SPAN&gt;-&lt;SPAN class="n"&gt;mek&lt;/SPAN&gt;.&lt;SPAN class="n"&gt;dtb&lt;/SPAN&gt;
	./&lt;SPAN class="k"&gt;$(&lt;/SPAN&gt;MKIMG&lt;SPAN class="k"&gt;)&lt;/SPAN&gt; -soc QX -rev B0 -c -ap Image a35 0x80280000 --data fsl-imx8qxp-mek.dtb 0x83000000 -out flash.bin
&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;If you want, you can modify to add a ramdisk to sign.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want, you can modify anything to sign.&lt;/P&gt;
&lt;P&gt;That is to say, anything you need for boot without authentication. Just add to the os container by imx-mkimge then you can use the athentication boot.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The BSP example is use the Image,&amp;nbsp;fsl-imx8qxp-mek.dtb to do none athentication.&lt;/P&gt;
&lt;P&gt;and just put the&amp;nbsp;Image,&amp;nbsp;fsl-imx8qxp-mek.dtb to os container by imx-mkimage and sign it, then can do anthentication boot.&lt;/P&gt;
&lt;P&gt;It is container, Image0 ~ ImageN.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;authenticate_os_container will help you copy the image for example the Image(kernel) to the loader address 0x80280000&amp;nbsp; (-ap Image a35 0x80280000 in imx-mkimage).&lt;/P&gt;
&lt;P&gt;Before, you use the fatload to load the Image to the 0x80280000.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}&lt;/P&gt;
&lt;P&gt;#define CONFIG_LOADADDR 0x80280000&lt;/P&gt;
&lt;P&gt;dr_mode with "peripheral"&lt;/P&gt;
&lt;P&gt;"fi; " \&lt;/P&gt;
&lt;P&gt;"if test ${sec_boot} = yes; then " \&lt;/P&gt;
&lt;P&gt;"${get_cmd} ${cntr_addr} ${cntr_file}; " \&lt;/P&gt;
&lt;P&gt;"if run auth_os; then " \&lt;/P&gt;
&lt;P&gt;"run boot_os; " \&lt;/P&gt;
&lt;P&gt;"else " \&lt;/P&gt;
&lt;P&gt;"echo ERR: failed to authenticate; " \&lt;/P&gt;
&lt;P&gt;"fi; " \&lt;/P&gt;
&lt;P&gt;"else " \&lt;/P&gt;
&lt;P&gt;"${get_cmd} ${loadaddr} ${image}; " \&lt;/P&gt;
&lt;P&gt;"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \&lt;/P&gt;
&lt;P&gt;"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \&lt;/P&gt;
&lt;P&gt;"run boot_os; " \&lt;/P&gt;
&lt;P&gt;"else " \&lt;/P&gt;
&lt;P&gt;"echo WARN: Cannot load the DT; " \&lt;/P&gt;
&lt;P&gt;"fi; " \&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;int authenticate_os_container(ulong addr)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;..........&lt;/P&gt;
&lt;P&gt;..........&lt;/P&gt;
&lt;P&gt;..........&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* Copy images to dest address */&lt;/P&gt;
&lt;P&gt;for (i = 0; i &amp;lt; phdr-&amp;gt;num_images; i++) {&lt;/P&gt;
&lt;P&gt;img = (struct boot_img_t *)(addr +&lt;/P&gt;
&lt;P&gt;sizeof(struct container_hdr) +&lt;/P&gt;
&lt;P&gt;i * sizeof(struct boot_img_t));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;debug("img %d, dst 0x%x, src 0x%lux, size 0x%x\n",&lt;/P&gt;
&lt;P&gt;i, (uint32_t) img-&amp;gt;dst, img-&amp;gt;offset + addr, img-&amp;gt;size);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;memcpy((void *)img-&amp;gt;dst, (const void *)(img-&amp;gt;offset + addr),&lt;/P&gt;
&lt;P&gt;img-&amp;gt;size);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;s = img-&amp;gt;dst &amp;amp; ~(CONFIG_SYS_CACHELINE_SIZE - 1);&lt;/P&gt;
&lt;P&gt;e = ALIGN(img-&amp;gt;dst + img-&amp;gt;size, CONFIG_SYS_CACHELINE_SIZE) - 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;flush_dcache_range(s, e);&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="无标题.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/172291iF700A73DDDEFFF91/image-size/large?v=v2&amp;amp;px=999" role="button" title="无标题.png" alt="无标题.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 14:59:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/IMX8QXP-secure-boot/m-p/1421962#M187697</guid>
      <dc:creator>BiyongSUN</dc:creator>
      <dc:date>2022-03-02T14:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: IMX8QXP secure boot</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/IMX8QXP-secure-boot/m-p/1423498#M187833</link>
      <description>&lt;P&gt;Hi，&lt;/P&gt;&lt;P&gt;Thank you for your reply!&lt;/P&gt;&lt;P&gt;The information made me understand！&lt;/P&gt;&lt;P&gt;Gravity&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2022 09:27:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/IMX8QXP-secure-boot/m-p/1423498#M187833</guid>
      <dc:creator>gravity_one</dc:creator>
      <dc:date>2022-03-05T09:27:19Z</dc:date>
    </item>
  </channel>
</rss>

