Fw_printenv show incorrect values


My setup: Jetson TX2 + U-boot with enabled CONFIG_BOOTCOUNT_LIMIT and CONFIG_BOOTCOUNT_ENV.
Configuration of /etc/fw_env.config looks like:

/dev/mmcblk0boot1 0x3fe000 0x2000

Problem is: fw_printenv and U-boot internal shell shows me different values.

Example: I set “bootlimit” variable to 10 via “fw_setenv” then reboot device, open U-Boot shell and “printenv bootlimit” shows me 2 instead of 10.

Or vice versa: when I tried to write variable from U-Boot via “setenv bootlimit 20” then run “saveenv”, reboot to Linux and “fw_printenv” shows me “10”

I tried to change /dev/mmcblk0boot1 to /dev/mmcblk0boot0 in /etc/fw_env.config but no luck

Does this only happen to bootlimit variable or other variables too?

Well, the reason is incorrect configuration of “fw_env.conf”

I find out that correct config should look like this:

/dev/mmcblk0boot1 0x3bb000 0x20000
/dev/mmcblk0boot1 0x3db000 0x20000

Why this config isn’t documented anywhere in Jetson manual?

Sorry, my bad.

To find out correct values, go to U-Boot sources, and find OFFSET_OF_UBOOT_ENV in include/configs/tegra186-common.h

In case of native nVidia U-Boot, offset will be: “-0x28000”, and resulting config:

/dev/mmcblk0boot1 -0x28000 0x2000

Notice the minus sign before value