fw_printenv does not work reliable

  • Hello,

    we have to read/write u-boot environment variables from Linux user space. I added the u-boot-fw-utils to the image, my fw_env.config is

    /dev/mmcblk2boot0 0x00040000 0x4000

    /dev/mmcblk2boot0 0x00040000 0x4000

    Basically, everything seems to work. However, changes in environment variables from u-boot become sometimes not visible in Linux. One way to make this 100% reproducible is the following sequence:

    - create a variable from Linux, e.g. "fw_setenv zzz 42"

    - boot to u-boot, "printenv" shows the created variable as expected "zzz=42"

    - now delete the variable from u-boot "setenv zzz", and "saveenv"

    - verify with "printenv" that the variable is really deleted

    - boot to Linux, "fw_printenv" still shows "zzz=42" (!!!)

    - boot again to u-boot, the variable is still not listed with "printenv"

    First I thought this happens only if variables are deleted from u-boot (in which case I could use a workaround), but the problem occurs also when u-boot just changes variable values, though not always.

    Do you have any hints how I can fix this problem?


    U-Boot 2021.04-F+S-fsimx8mp-Y2023.09 (Aug 31 2023 - 12:56:23 +0000) for F&S

    NBoot: 2023.09


  • > Can't directly help you with your issue

    Oh, actually you did! Your hint solved the issue. I had a wrong assumption about the meaning of the 2nd line. And indeed, mistakes with the redundant environment are a good explanation for such effects. Thanks a lot for your help!