This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

uboot variables are not saving from linux

Hi All,


We have BBB prototype board running with SDK-8 OS, We are setting U-Boot env variables by using fw_setenv tools from linux. What we have seen the issue is sometimes(5 outof 50 times) the u-boot env variables are not updated and retained with the old value.

Can anyone describe the failure? We have not got any error messages on u-boot prompt.

  • Hi Pavan,

    Do you observe same error messages? Is the problem appear on one board only or it was observed on several boards with same frequency?
    I guess that the could be caused by problem (damaged) memory chip but it should be checked.

    BR
    Tsvetolin Shulev

  • Thank you for your reply,

    This is happening in most of the boards, as per my analysis crc_check is failing which is leading to switch the env partition. Why CRC is failing sometimes?
  • Hello,

    What changes have you done to build your fw_setenv ? did you build it or downloaded from somewhere else ?
    Where are your env supposed to be stored spi/mmc/nand ?

    Cheers,
    --Prabhakar Lad
  • Hi Prabhakar,


    We are using mmc to store env,u-boot and kernel.

    We buit from SDK-8 OS and below is the config file configured to use fw_setenv tools.

    ************************ config file *****************************************

    # Configuration file for fw_(printenv/setenv) utility.
    # Up to two entries are valid, in this case the redundant
    # environment sector is assumed present.
    # Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash.
    # Futhermore, if the Flash sector size is ommitted, this value is assumed to
    # be the same as the Environment size, which is valid for NOR and SPI-dataflash

    # NOR example
    # MTD device name    Device offset    Env. size    Flash sector size    Number of sectors
    #/dev/mtd1        0x0000        0x4000        0x4000
    #/dev/mtd2        0x0000        0x4000        0x4000

    # MTD SPI-dataflash example
    # MTD device name    Device offset    Env. size    Flash sector size    Number of sectors
    #/dev/mtd5        0x4200        0x4200
    #/dev/mtd6        0x4200        0x4200

    # NAND example
    #/dev/mtd0        0x4000        0x4000        0x20000            2

    # Block device example
    #/dev/mmcblk0        0xc0000        0x20000
    /dev/mmcblk0boot1    0x00000        0x20000
    /dev/mmcblk0boot1    0x00000        0x20000
    ******************************************************************************

    /dev/mmcblock0boot1 is the partition where we are storing env variables in mmc.

    In detail, the problem is, we have one env variable called "validbootpart". The application in linux sets the "validbootpart" variable to either 2 or 3 or 5 based on the condition by using fw_setenv tool. If the current partition is 2 and if the application decided to switch the "validbootpart" to 3, the application uses fw_setenv tool to set and does sync and softreboot. Sometimes 2 out of 50 or 100 times, "validbootpart" is not updating and which results to boot from "validbootpart" 2 instead of 3.

    We are guessing that crc is corrupting and no error messages seen on u-boot prompt. We have enabled redundant configuration in configs.

    Can you please confirm the config above defined is correct?

    Please help us to find out the root cause, its a blocker for us to deliver the product.

    Thanks,

    -Pavan

  • Hello,

    Can you also post the env partition config for MMC, it should be in you .h file.

    Cheers,
    --Prabhakar Lad
  • I shared config file for your reference.
  • Hello,

    When you say you have enabled redundant option the following is wrong,
    /dev/mmcblk0boot1 0x00000 0x20000
    /dev/mmcblk0boot1 0x00000 0x20000

    What are the following set to ?

    CONFIG_ENV_OFFSET
    CONFIG_ENV_SIZE
    CONFIG_ENV_OFFSET_REDUND
    CONFIG_ENV_SIZE_REDUND

    This can be obtained from .h file which I had asked to attach for.

    Cheers,
    --PrabhaKar Lad
  • Shared config as private message, please check.

    We defined 0x0000 as Primary env partition and 0x20000 as Redundant env partition in config.h

    Please check and confirm.
  • Hello,

    Sorry I never check messages.

    If you are using the fw_env.config, comment out the line CONFIG_FILE in fw_env.h when you build fw_setenv.

    Now coming to fw_env.config file:

    I assume you have created partition's in DT for mmc, So I assume you have one partition for env
    assuming "mmcblk0p1", the config file should something like below:

    /dev/mmcblk0p1 0x0 0x20000
    /dev/mmcblk0p1 0x20000 0x20000

    Now example 2 if you have 2 partitions for env say mmcblk0p1 and mmcblk0p2

    /dev/mmcblk0p1 0x0 0x20000
    /dev/mmcblk0p2 0x0 0x20000

    Cheers,
    --Prabhakar Lad