I've build an image for my Jetson Nano with yocto using the meta-tegra layer.
This build is using u-boot as bootloader which is set to save the environment on an MMC partition (mmcblk0p14).
gdisk -l /dev/mmcblk0
shows the following:
Number Start (sector) End (sector) Size Code Name
...
14 20996096 20998143 1024.0 KiB 8300 UBOOTENV
...
And the sector size is 512.
I've then configured u-boot-tegra/include/configs/p3450-porg.h
with:
...
/* Env is located in it's own partition */
#define CONFIG_ENV_IS_IN_MMC
#define CONFIG_SYS_MMC_ENV_DEV 1
#define CONFIG_ENV_OFFSET (20996096 * 512)
...
Where CONFIG_ENV_OFFSET
= Start_Sector * Block_Size
This works fine (as far as I can see) as the environment is saved successfully to MMC when i use saveenv
.
However, the environment i get when i print it in u-boot shell is NOT the same as when i print the environment with fw_printenv
u-boot tool. I have set the /etc/fw_env.config
to:
# Device name Device offset Env size
/dev/mmcblk0p14 0 0x2000
So what I've gathered is that, either the fw_env.config
is set wrong or the u-boot environment is saved somewhere else on the MMC and no the partition 14.
Does anyone have suggestions to what i could try?
*****************************************************EDIT:*****************************************************
Doing dd if=/dev/mmcblk0p14 of=tmp.txt
and reading the tmp.txt file shows the environment that the fw_printenv
shows and not the environment I'm seeing in u-boot shell.
So something must be wrong in the u-boot-tegra/include/configs/p3450-porg.h
configuration. I just wonder where it actually writes the environment to when i do a saveenv
...
Any Idea what I can try to change?
As stated in the comments to the question, the offset is a 32-bit integer so attempting to give it the value of more than 4,294,967,295 (which 20996096 * 512 is) is not gonna work.
To fix it, I've rearranged my partition scheme to have my uboot environment partition as partition 1 instead of 14 and changed the fw_env.config
and p3450-porg.h
patch accordingly.