fw_printenv or fw_setenv on TX2

Hi,

I am able to build fw_printenv and the kernel that enables /dev/mmcblk0boot0 and /dev/mmcblk0boot1 based on https://devtalk.nvidia.com/default/topic/802197/jetson-tk1/problem-solved-support-for-uboot-tools-fw_printenv-fw_setenv-on-linux-for-tegra/. When I run fw_printenv, I would get this:

Warning: Bad CRC, using default environment
bootcmd=run distro_bootcmd
bootdelay=5
baudrate=115200

My /etc/fw_env.config is also:
/dev/mmcblk0boot1 0x3fe000 0x2000

Any idea?

Thanks,
Tom88

Hi tom88
How do you figure out the /dev/mmcblk0boot1 0x3fe000 0x2000?
This value may different with TX1.

Hi ShaneCCC,

Actually those values are for TX1 (see https://devtalk.nvidia.com/default/topic/802197/jetson-tk1/problem-solved-support-for-uboot-tools-fw_printenv-fw_setenv-on-linux-for-tegra/) and I am looking for values that would work with TX2.

I tried replacing device offset with 0x0000 based on ‘cat /sys/block/mmcblk0boot1/alignment_offset’ but still no luck.

My /etc/fw_env.config now looks like this:
/dev/mmcblk0boot1 0x0000 0x2000

fw_printenv still returns:
Warning: Bad CRC, using default environment
bootcmd=run distro_bootcmd
bootdelay=5
baudrate=115200

Hi tom
The warning message possible cause by the environment not set.

This warning is displayed when you try to access an uninitialized on-disk u-boot environment.
If you have serial access you may just interrupt the boot process by typing CR and then:

saveenv
reset

https://github.com/umiddelb/armhf/issues/22

When the system is flashed, the region of eMMC that could/does hold the U-Boot environment is not written. This is why U-Boot prints “Warning: Bad CRC, using default environment”. Because of this, U-Boot uses a default environment that’s built into the U-Boot binary. This will also cause fw_printenv to fail to read the environment from eMMC, since there is none stored there.

If you want to write the environment to eMMC, you can:
a) Power on/reboot the system
b) Wait for U-Boot to run
c) Interrupt the U-Boot boot process
d) In U-Boot, run “env default -f -a; saveenv”

After that, the environment will be saved in eMMC, so (a) U-Boot will read the environment from eMMC when booting instead of using its built-in default copy (b) fw_printenv should be able to read the environment from eMMC.

Hi ShaneCCC,

First of all, thanks for you replies. Here is what I found out based on your responses:

“env default -f -a; saveenv” did not change or do anything on my TX2, but “saveenv;reset” gets rid of Bad-CRC error message when printing env variables. If I want to set a variable to something else like so:
“sudo fw_printenv bootdelay 0”, it comes back with “bootdelay=2 ## Error: “0” not defined”.

That command is incorrect, Do you want to change the value you need? Than you need use fw_setenv instead of fw_printenv. Also you need to below link to enable the write permission.

https://devtalk.nvidia.com/default/topic/802197/jetson-tk1/problem-solved-support-for-uboot-tools-fw_printenv-fw_setenv-on-linux-for-tegra/.

Hi ShaneCCC,

I think you solved my problem. After renaming fw_printenv to fw_setenv, everything seems to work. I did not even have to go into UBoot shell to run those 2 commands you gave me after reflashing. I did not think renaming or copying fw_printenv to fw_setenv would make a difference but it does.

Thanks again.

Hi @tom88 @ShaneCCC,

I was able to get the fw_printenv working (without the Bad CRC warning), but while fw_setenv bootdelay 0, i get this error.

Write error on /dev/mmcblk0boot1: Operation not permitted
Error: can’t write fw_env to flash

Can you help me how can set the write permissions on this partition or if i am doing something wrong?

Did you run the command by sudo?

Hi @ShaneCCC,

Yes i did.

Try below command before fw_serenv.

sudo su
echo 0 > /sys/block/mmcblkXbootY/force_ro

1 Like