<?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: iMX 8M Nano - boot script messes up boot partition</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/iMX-8M-Nano-boot-script-messes-up-boot-partition/m-p/1319304#M177983</link>
    <description>&lt;P&gt;"I had to build the environment with the mkenvimage tool and then let the fw_env.config know where to find that file inside the vfat boot partition."&amp;nbsp; How exactly is this done?&lt;/P&gt;</description>
    <pubDate>Thu, 05 Aug 2021 22:57:00 GMT</pubDate>
    <dc:creator>jdavid75_presonus</dc:creator>
    <dc:date>2021-08-05T22:57:00Z</dc:date>
    <item>
      <title>iMX 8M Nano - boot script messes up boot partition</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX-8M-Nano-boot-script-messes-up-boot-partition/m-p/1164523#M163121</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I'm experiencing a weird problem when trying to add my own boot.scr to the boot partition. My setup looks like the following: imx8mnddr4evk EvalBoard, SD Card as flash memory&lt;/P&gt;&lt;P&gt;WKS File:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;part u-boot --source rawcopy --sourceparams="file=imx-boot" --ondisk mmcblk1 --no-table --align 32&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;part /boot --source bootimg-partition --ondisk mmcblk1 --fstype=vfat --label boot --active --align 4096 --size 64&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;part /rootA --source rootfs --ondisk mmcblk1 --fstype=ext4 --label ROOTA --align 4096&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;part /rootB --source rootfs --ondisk mmcblk1 --fstype=ext4 --label ROOTB --align 4096&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;bootloader --ptable msdos&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;So I'm planning a symmetric rootfs on the SD card. I placed the devicetree inside the /rootfs/boot/. I also installed rauc and added my boot.scr to the boot partition. It looks like the following (sorry, the indentation is messed up):&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;test -n "${BOOT_ORDER}" || setenv BOOT_ORDER "ROOTA ROOTB"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;test -n "${BOOT_ROOTA_LEFT}" || setenv BOOT_ROOTA_LEFT 3&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;test -n "${BOOT_ROOTB_LEFT}" || setenv BOOT_ROOTB_LEFT 3&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;setenv bootargs&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;setenv loaddevicetree "ext4load mmc 1:2 ${fdt_addr} /boot/imx8mn-ddr4-evk.dtb"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;for BOOT_SLOT in "${BOOT_ORDER}"; do&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;if test "x${bootargs}" != "x"; then&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;# skip remaining slots&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;elif test "x${BOOT_SLOT}" = "xROOTA"; then&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;if test ${BOOT_ROOTA_LEFT} -gt 0; then&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;echo "Found valid slot A, ${BOOT_ROOTA_LEFT} attempts remaining"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;setexpr BOOT_ROOTA_LEFT ${BOOT_ROOTA_LEFT} - 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;setenv load_kernel "ext4load mmc 1:2 ${loadaddr} /boot/Image"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;setenv bootargs "${default_bootargs} root=/dev/mmcblk1p2 rauc.slot=ROOTA rootwait rw"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;fi&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;elif test "x${BOOT_SLOT}" = "xROOTB"; then&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;if test ${BOOT_ROOTB_LEFT} -gt 0; then&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;echo "Found valid slot rootB, ${BOOT_ROOTB_LEFT} attempts remaining"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;setexpr BOOT_ROOTB_LEFT ${BOOT_ROOTB_LEFT} - 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;setenv load_kernel "ext4load mmc 1:3 ${loadaddr} /boot/Image"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;setenv bootargs "${default_bootargs} root=/dev/mmcblk1p3 rauc.slot=ROOTB rootwait rw"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;fi&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;fi&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;done&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;if test -n "${bootargs}"; then&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;saveenv&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;else&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;echo "No valid slot found, resetting tries to 3"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;setenv BOOT_ROOTA_LEFT 3&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;setenv BOOT_ROOTB_LEFT 3&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;saveenv&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;reset&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;fi&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;echo "Loading Device Tree"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;run loaddevicetree&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;echo "Loading kernel"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;run load_kernel&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;echo "Starting..."&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;booti ${loadaddr} - ${fdt_addr}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;And finally the system.conf of rauc:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;[system]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;compatible=XYZ&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;bootloader=uboot&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;[slot.rootfs.0]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;device=/dev/mmcblk1p2&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;type=ext4&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;bootname=ROOTA&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;[slot.rootfs.1]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;device=/dev/mmcblk1p3&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;type=ext4&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;bootname=ROOTB&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;When I now flash the SD Card with the image created by wic, then uboot boots, it's executing the script, loads the kernel and the device tree and Linux is booting. However, when I now reset the system and let u-boot come up again, it tells me, that no filesystem could be found. And when analyzing the SD card with ubuntu, the partition FS type of the boot (!) partition is "unknown". I found out that when NOT adding my own boot.scr to the boot partition, it boots properly again and again. So how can my own boot.scr mess up the partition? FYI, I haven't set up the fw_env.config yet since I cannot find out the necessary info like device offset, env size and so on. But could that also lead to a destroyed first boot partition? What am I missing here?&lt;/P&gt;&lt;P&gt;Thank you VERY much in advance for your help, guys!&lt;BR /&gt;Hanky&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 12:47:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX-8M-Nano-boot-script-messes-up-boot-partition/m-p/1164523#M163121</guid>
      <dc:creator>HankyBan</dc:creator>
      <dc:date>2020-10-08T12:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: iMX 8M Nano - boot script messes up boot partition</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX-8M-Nano-boot-script-messes-up-boot-partition/m-p/1167233#M163442</link>
      <description>&lt;P&gt;Solved. The fw_env.config is very critical. It needs to be set up correctly or it simply writes at the wrong place screwing up your partition(s). That's one point. The other point is that the BSP imx-yocto-bsp does NOT provide any U-Boot environment build script or recipe in order to access the environment of U-Boot from the linux user space. I had to build the environment with the mkenvimage tool and then let the fw_env.config know where to find that file inside the vfat boot partition. Then it worked.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 07:14:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX-8M-Nano-boot-script-messes-up-boot-partition/m-p/1167233#M163442</guid>
      <dc:creator>HankyBan</dc:creator>
      <dc:date>2020-10-14T07:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: iMX 8M Nano - boot script messes up boot partition</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX-8M-Nano-boot-script-messes-up-boot-partition/m-p/1319304#M177983</link>
      <description>&lt;P&gt;"I had to build the environment with the mkenvimage tool and then let the fw_env.config know where to find that file inside the vfat boot partition."&amp;nbsp; How exactly is this done?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 22:57:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX-8M-Nano-boot-script-messes-up-boot-partition/m-p/1319304#M177983</guid>
      <dc:creator>jdavid75_presonus</dc:creator>
      <dc:date>2021-08-05T22:57:00Z</dc:date>
    </item>
  </channel>
</rss>

