<?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: U-boot Environment Offset i.MX8MP</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/U-boot-Environment-Offset-i-MX8MP/m-p/1325370#M178656</link>
    <description>&lt;P&gt;You are right it was my oversight that caused me to be confused. When setting an environment via fw_setenv and subsequently printing it via fw_printenv the variables are displayed at the bottom of the printout block. However when calling printenv from u-boot command line the variables are displayed at the top of the prinout block.&lt;BR /&gt;&lt;BR /&gt;Thank you for your answer!&lt;/P&gt;</description>
    <pubDate>Wed, 18 Aug 2021 09:46:41 GMT</pubDate>
    <dc:creator>GrzesiakLu</dc:creator>
    <dc:date>2021-08-18T09:46:41Z</dc:date>
    <item>
      <title>U-boot Environment Offset i.MX8MP</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/U-boot-Environment-Offset-i-MX8MP/m-p/1324675#M178581</link>
      <description>&lt;P&gt;Hello!&lt;BR /&gt;I am currently struggling with reading from and to the U-boot environment from Linux on edm-g-imx8mp board from Technexion. I have build the U-boot binary using U-boot-tn-imx Yocto repository provided by Technexion and later attempted to build u-boot firmware utils. I have managed to pinpoint my issue to be related to placement of the U-boot+SPL, and some other imx8mp binaries on the eMMC drive.&lt;/P&gt;&lt;P&gt;To provision the device I am using UUU ( Universal Update Utility) to firstly flash the aforementioned imx-boot binary (as it was created via U-boot recipe in Yocto Project) followed by .wic.bz2 file containing another copy of bootloader as well as /boot and /rootFS partitions as describbed by the imx-boot-bootpart.wks file in Yocto Project. The contents of .wks file are shown below.&lt;/P&gt;&lt;TABLE border="0" cellspacing="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="17"&gt;# short-description: Create SD card image with a boot partition&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;# long-description:&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;# Create an image that can be written onto a SD card using dd for use&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;# with i.MX SoC family&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;# It uses u-boot + other binaries gathered together on imx-boot file&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;#&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;# The disk layout used is:&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;# - ---------- -------------- --------------&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;# | | imx-boot | boot | rootfs |&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;# - ---------- -------------- --------------&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;# ^ ^ ^ ^ ^&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;# | | | | |&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;# 0 | 8MiB 72MiB 72MiB + rootfs + IMAGE_EXTRA_SPACE (default 10MiB)&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;# 32 32 or 33kiB&lt;/TD&gt;&lt;TD&gt;see reference manual&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;#&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;part u-boot --source rawcopy --sourceparams="file=imx-boot" --ondisk mmcblk --no-table --align 32&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;part /boot --source bootimg-partition --ondisk mmcblk --fstype=vfat --label boot --active --align 8192 --size 64&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;part / --source rootfs --ondisk mmcblk --fstype=ext4 --label root --align 8192&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;bootloader --ptable msdos&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My issue is now that when I restart the device the U-boot environment that is being read mismatches the U-boot environment pointed to by sbin/fw_printenv and sbin/fw_setenv. I am aware of the fact that the memory addresses these point to can be dynamically changed at runtime via changes to the /etc/fw_env.config file. I am however unable to determine correct offset and size values for the edm-g-imx8mp board. Additionally the values as generated by fw-utils recipe are incorrect and have to be adjusted. The contents of the fw_env.config follow below:&lt;/P&gt;&lt;P&gt;# Configuration file for fw_(printenv/setenv) utility.&lt;BR /&gt;# Up to two entries are valid, in this case the redundant&lt;BR /&gt;# environment sector is assumed present.&lt;BR /&gt;# Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash.&lt;BR /&gt;# Futhermore, if the Flash sector size is omitted, this value is assumed to&lt;BR /&gt;# be the same as the Environment size, which is valid for NOR and SPI-dataflash&lt;BR /&gt;# Device offset must be prefixed with 0x to be parsed as a hexadecimal value.&lt;/P&gt;&lt;P&gt;# NOR example&lt;BR /&gt;# MTD device name Device offset Env. size Flash sector size Number of sectors&lt;BR /&gt;/dev/mtd1 0x0000 0x4000 0x4000&lt;BR /&gt;/dev/mtd2 0x0000 0x4000 0x4000&lt;/P&gt;&lt;P&gt;# MTD SPI-dataflash example&lt;BR /&gt;# MTD device name Device offset Env. size Flash sector size Number of sectors&lt;BR /&gt;#/dev/mtd5 0x4200 0x4200&lt;BR /&gt;#/dev/mtd6 0x4200 0x4200&lt;/P&gt;&lt;P&gt;# NAND example&lt;BR /&gt;#/dev/mtd0 0x4000 0x4000 0x20000 2&lt;/P&gt;&lt;P&gt;# On a block device a negative offset is treated as a backwards offset from the&lt;BR /&gt;# end of the device/partition, rather than a forwards offset from the start.&lt;/P&gt;&lt;P&gt;# Block device example&lt;BR /&gt;#/dev/mmcblk0 0xc0000 0x20000&lt;BR /&gt;#/dev/mmcblk0 -0x20000 0x20000&lt;/P&gt;&lt;P&gt;# VFAT example&lt;BR /&gt;#/boot/uboot.env 0x0000 0x4000&lt;/P&gt;&lt;P&gt;# UBI volume&lt;BR /&gt;#/dev/ubi0_0 0x0 0x1f000 0x1f000&lt;BR /&gt;#/dev/ubi0_1 0x0 0x1f000 0x1f000&lt;/P&gt;&lt;P&gt;# UBI volume by name&lt;BR /&gt;#/dev/ubi0:env 0x0 0x1f000 0x1f000&lt;BR /&gt;#/dev/ubi0:env-redund 0x0 0x1f000 0x1f000&lt;/P&gt;&lt;P&gt;Commenting out the mtd1 and mtd2 devices and changing the mmblk0 to be mmcblk2 along with inserting offset and size as defined in u-boot-tn-imx-fw-utils/git/configs/edm-gimx8mp_defconfig repeated below, result in me being able to write and read from U-boot environment on Hardware User Space Partition i.e mmcblk2&lt;/P&gt;&lt;P&gt;CONFIG_ENV_SIZE=0x1000&lt;BR /&gt;CONFIG_ENV_OFFSET=0x400000&lt;/P&gt;&lt;P&gt;This however is not the U-boot environment that the device uses at boot-up. I am unaware where the start-up U-boot environment is on the MMC flash memory. Based on the output of the mmc_burn_all.lst file shown below. The U-boot binary is being flashed to the mmblk2boot0 partition. After doing some reading I found out that the U-boot environment in many cases is then present on the mmcblk2boot1, but I am unable to verify that. Contents of the mmc_burn_all.lst are shown below:&lt;/P&gt;&lt;P&gt;uuu_version 1.2.39&lt;/P&gt;&lt;P&gt;# This command will be run when i.MX6/7 i.MX8MM, i.MX8MQ&lt;BR /&gt;SDP: boot -f _flash.bin&lt;/P&gt;&lt;P&gt;# This command will be run when ROM support stream mode&lt;BR /&gt;# i.MX8QXP, i.MX8QM&lt;BR /&gt;SDPS: boot -f _flash.bin&lt;/P&gt;&lt;P&gt;# These commands will be run when use SPL and will be skipped if no spl&lt;BR /&gt;# SDPU will be deprecated. please use SDPV instead of SDPU&lt;BR /&gt;# {&lt;BR /&gt;SDPU: delay 1000&lt;BR /&gt;SDPU: write -f _flash.bin -offset 0x57c00&lt;BR /&gt;SDPU: jump&lt;BR /&gt;# }&lt;/P&gt;&lt;P&gt;# These commands will be run when use SPL and will be skipped if no spl&lt;BR /&gt;# if (SPL support SDPV)&lt;BR /&gt;# {&lt;BR /&gt;SDPV: delay 1000&lt;BR /&gt;SDPV: write -f _flash.bin -skipspl&lt;BR /&gt;SDPV: jump&lt;BR /&gt;# }&lt;/P&gt;&lt;P&gt;FB: ucmd setenv fastboot_dev mmc&lt;BR /&gt;FB: ucmd setenv mmcdev ${emmc_dev}&lt;BR /&gt;FB: ucmd mmc dev ${emmc_dev}&lt;BR /&gt;FB: flash -raw2sparse all _rootfs.sdcard&lt;BR /&gt;FB: flash bootloader _flash.bin&lt;BR /&gt;FB: ucmd if env exists emmc_ack; then ; else setenv emmc_ack 0; fi;&lt;BR /&gt;FB: ucmd mmc partconf ${emmc_dev} ${emmc_ack} 1 0&lt;BR /&gt;FB: done&lt;BR /&gt;&lt;BR /&gt;Could somebody provide me with correct values for the fw_env.config file so that I can read and write to the U-boot environment placed in either mmcblk2boot0 or mmcblk2boot1 partitions?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Aug 2021 10:38:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/U-boot-Environment-Offset-i-MX8MP/m-p/1324675#M178581</guid>
      <dc:creator>GrzesiakLu</dc:creator>
      <dc:date>2021-08-17T10:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: U-boot Environment Offset i.MX8MP</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/U-boot-Environment-Offset-i-MX8MP/m-p/1325096#M178632</link>
      <description>&lt;P&gt;doesn't matter the bootloader (flash.bin) boot from eMMC one of two boot partitions or from user partition.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The u-boot environment is always saved to&amp;nbsp; user partition.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;/&lt;SPAN&gt;etc/fw_env.config&amp;nbsp; should be&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;/dev/mmcblk2 0x400000 0x1000&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;just one line is enough.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Aug 2021 02:39:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/U-boot-Environment-Offset-i-MX8MP/m-p/1325096#M178632</guid>
      <dc:creator>BiyongSUN</dc:creator>
      <dc:date>2021-08-18T02:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: U-boot Environment Offset i.MX8MP</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/U-boot-Environment-Offset-i-MX8MP/m-p/1325370#M178656</link>
      <description>&lt;P&gt;You are right it was my oversight that caused me to be confused. When setting an environment via fw_setenv and subsequently printing it via fw_printenv the variables are displayed at the bottom of the printout block. However when calling printenv from u-boot command line the variables are displayed at the top of the prinout block.&lt;BR /&gt;&lt;BR /&gt;Thank you for your answer!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Aug 2021 09:46:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/U-boot-Environment-Offset-i-MX8MP/m-p/1325370#M178656</guid>
      <dc:creator>GrzesiakLu</dc:creator>
      <dc:date>2021-08-18T09:46:41Z</dc:date>
    </item>
  </channel>
</rss>

