<?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>topic Bad CRC after saving uboot Environment in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Bad-CRC-after-saving-uboot-Environment/m-p/1097952#M160741</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;I created a uboot environment file by this command:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;$ mkenvimage -s 0x4200 -o &lt;SPAN&gt;uEnv.bin&lt;/SPAN&gt; uboot-env.txt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I load this uboot env file in uboot command line:&lt;/P&gt;&lt;P&gt;=&amp;gt; fatload mmc 3:1 0x12100000 uEnv.bin&lt;BR /&gt;16896 bytes read in 15 ms (1.1 MiB/s)&lt;BR /&gt;=&amp;gt; env import -c 0x12100000 0x4200&lt;BR /&gt;=&amp;gt; &lt;STRONG&gt;env print bootcompleted&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;bootcompleted=true&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;It works, because the value of var&amp;nbsp;&lt;STRONG&gt;bootcompleted&lt;/STRONG&gt; is correct. Afterthat, I would like to change the value of&amp;nbsp;&lt;STRONG&gt;bootcompleted and save to uEnv.bin&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;=&amp;gt;&lt;STRONG&gt; setenv bootcompleted false&lt;/STRONG&gt; &lt;BR /&gt;=&amp;gt; env export -c 0x12100000 -s 0x4200 &lt;BR /&gt;=&amp;gt; fatwrite mmc 3:1 0x12100000 uEnv.bin 0x4200&lt;BR /&gt;16896 bytes written&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Then, I reboot the board and import uboot env from uEnv.bin again&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;=&amp;gt; fatload mmc 3:1 0x12100000 uEnv.bin&lt;BR /&gt;16896 bytes read in 18 ms (916 KiB/s)&lt;BR /&gt;=&amp;gt; env import -c 0x12100000 0x4200&lt;BR /&gt;&lt;STRONG&gt;## Error: bad CRC, import failed&lt;/STRONG&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It said that imported failed because bad CRC. how to fix this problem? Please advise!&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Apr 2020 10:07:48 GMT</pubDate>
    <dc:creator>trongthinh</dc:creator>
    <dc:date>2020-04-15T10:07:48Z</dc:date>
    <item>
      <title>Bad CRC after saving uboot Environment</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Bad-CRC-after-saving-uboot-Environment/m-p/1097952#M160741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;I created a uboot environment file by this command:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;$ mkenvimage -s 0x4200 -o &lt;SPAN&gt;uEnv.bin&lt;/SPAN&gt; uboot-env.txt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I load this uboot env file in uboot command line:&lt;/P&gt;&lt;P&gt;=&amp;gt; fatload mmc 3:1 0x12100000 uEnv.bin&lt;BR /&gt;16896 bytes read in 15 ms (1.1 MiB/s)&lt;BR /&gt;=&amp;gt; env import -c 0x12100000 0x4200&lt;BR /&gt;=&amp;gt; &lt;STRONG&gt;env print bootcompleted&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;bootcompleted=true&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;It works, because the value of var&amp;nbsp;&lt;STRONG&gt;bootcompleted&lt;/STRONG&gt; is correct. Afterthat, I would like to change the value of&amp;nbsp;&lt;STRONG&gt;bootcompleted and save to uEnv.bin&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;=&amp;gt;&lt;STRONG&gt; setenv bootcompleted false&lt;/STRONG&gt; &lt;BR /&gt;=&amp;gt; env export -c 0x12100000 -s 0x4200 &lt;BR /&gt;=&amp;gt; fatwrite mmc 3:1 0x12100000 uEnv.bin 0x4200&lt;BR /&gt;16896 bytes written&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Then, I reboot the board and import uboot env from uEnv.bin again&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;=&amp;gt; fatload mmc 3:1 0x12100000 uEnv.bin&lt;BR /&gt;16896 bytes read in 18 ms (916 KiB/s)&lt;BR /&gt;=&amp;gt; env import -c 0x12100000 0x4200&lt;BR /&gt;&lt;STRONG&gt;## Error: bad CRC, import failed&lt;/STRONG&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It said that imported failed because bad CRC. how to fix this problem? Please advise!&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Apr 2020 10:07:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Bad-CRC-after-saving-uboot-Environment/m-p/1097952#M160741</guid>
      <dc:creator>trongthinh</dc:creator>
      <dc:date>2020-04-15T10:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: Bad CRC after saving uboot Environment</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Bad-CRC-after-saving-uboot-Environment/m-p/1097953#M160742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/trongthinh"&gt;trongthinh&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The &lt;STRONG&gt;"mkenvimage"&lt;/STRONG&gt; source generates the redundant environment variable from text file based on key-value pairs. It is appending the CRC at the beginning of the generated binary file, to make sure at load time that the file is not corrupted.You can&amp;nbsp;see the implementation&amp;nbsp;of&amp;nbsp;&lt;STRONG&gt;"mkenvimage"&lt;/STRONG&gt; source code located at &lt;STRONG&gt;"tools/mkenvimage.c"&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you&amp;nbsp;are over-writing&amp;nbsp;&amp;nbsp;uEnv.bin&amp;nbsp;file in u-boot using the "&lt;STRONG&gt;fatwrite"&lt;/STRONG&gt;&amp;nbsp;command. Next time you try to import the same binary file it will&amp;nbsp;give a CRC error as you are getting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to me, you should import the new u-boot environment variable and then you can save those environment variables &lt;STRONG&gt;"saveenv"&lt;/STRONG&gt;. If you want, you can change and again save them. After importing once it will be always shown in &lt;STRONG&gt;"printenv"&lt;/STRONG&gt; and there won't be the requirement of importing again. I don't see any requirement to&amp;nbsp;write the updated u-boot variable to the binary(uEnv.bin) file again. Is there any specific use case for which you want to write back to binary file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Feel free to let us know if you&amp;nbsp;have any confusion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kunal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Apr 2020 11:07:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Bad-CRC-after-saving-uboot-Environment/m-p/1097953#M160742</guid>
      <dc:creator>kunalkotecha1</dc:creator>
      <dc:date>2020-04-21T11:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Bad CRC after saving uboot Environment</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Bad-CRC-after-saving-uboot-Environment/m-p/1097954#M160743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Kunal,&lt;/P&gt;&lt;P&gt;I think it is an incorrect usage in my case. Thank for clarify me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2020 09:59:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Bad-CRC-after-saving-uboot-Environment/m-p/1097954#M160743</guid>
      <dc:creator>trongthinh</dc:creator>
      <dc:date>2020-05-08T09:59:04Z</dc:date>
    </item>
  </channel>
</rss>

