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.

fw_printenv, fw_setenv not working???

 

Hi,

I am using OMAP3 EVM kit.

I am getting "Cannot read bad block mark: Invalid argument" while reading the u-boot environment variables from linux console. I can erase and read/write environment variables from u-boot with no problem and even with flash_erase and flash_dump mtd-utils so I know the Nand sectors are not bad.

********************************************************

/ # ./fw_printenv
Cannot read bad block mark: Invalid argument

********************************************************

I commented the bad block sectors check and crc check in fw_printenv source code in u-boot-omap3/tools/env and recompiled.

Now I can print the u-boot environment variables correctly.

But, now fw_setenv is not writing the environment variables. I get the below error:

******************************************************

/ # fw_setenv bootdelay 5

Writing new environment at 0x240000 on /dev/mtd/mtd2
MTD erase error on /dev/mtd/mtd2: Invalid argument
Error: can't write fw_env to flash

******************************************************

I can erase environment partition using mtd with no problem.

My fw_env.config file looks like:

/ # cat /etc/fw_env.config
/dev/mtd/mtd2 0x240000 0x40000 0x20000 0x2

I have compiled fw_printenv as below:

make env  CROSS_COMPILE=/home/pawan//work/cross-compiler-armv5l/bin/armv5l-

/ # cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00080000 00020000 "xloader"
mtd1: 001c0000 00020000 "bootloader"
mtd2: 00040000 00020000 "environment"
mtd3: 05000000 00020000 "recovery"
mtd4: 05000000 00020000 "cache"
mtd5: 00040000 00020000 "misc"
mtd6: 00a00000 00020000 "boot"
mtd7: 08000000 00020000 "system"
mtd8: 0d340000 00020000 "userdata"

 

Please revert if anybody has any suggestion on how to change u-boot environment variables from linux.

Thanks,

Pawan

  • / # cat /etc/fw_env.config

    /dev/mtd/mtd2 0x240000 0x40000 0x20000 0x2 c

    chk your config and try again.

    it works on my side.

    and...i should tell you i had my uboot patch and the kernel tooo  too support the spec ecc form rbl.

    but.. i had disable the hardware ecc form the kernel source ..

    maybe this hope you

    regards, Mike

  • Thanks Mike for your reply.

    I have checked the fw_env.config and it seems to be correct.

    I did not understand what exactly you mean by "and...i should tell you i had my uboot patch and the kernel tooo  too support the spec ecc form rbl"

    I checked my kernel configurations also and it has HW ECC disabled for MTD.

    Moreover I could read/write/erase from linux mtd-utils just perfect. but not with fw_setenv.

    Thanks,

    Pawan

  • the default parameters of uboot is written  at 0x3c0000(dvsdk 4.0) and you should configure you configure file to that place.

    btw, are you sure you parameters are correct ?

    i doubt your partition is /dev/mtd/mtd2:, shouldnot it be /dev/mtd2?

    also i should check how ot enable HW ECC .. without error... just want to findout the way to do it ..

    regards, Mike

  • parameters are correct.  I am able to read the u-boot environment from linux using fw_printenv correctly.

    /dev/mtd/mtd2 device is also correct because I am able to erase "environment" partition using "flash_erase /dev/mtd/mtd2 0 0"

    My opinion is flash_erase cmd(mtd-utils) does something extra which fw_setenv is unable to so.

  • Same issue here. The recent xloader, uboot uses HW-ECC by default (exactly you have to set "nandecc hw 2"). So everything is fine, except I can't use fw_setenv in Linux anymore. Get uncorrectable error : Warning: Bad CRC, using default environment

    So my suspect is, that fw_setenv / fw_getenv doesn't handle this HW ECC.

    How can I either

    a) use HW ECC with fw_setenv / getenv from linux

    b) if this is not possible: use SW ECC for the environment in uboot?

    Best regards

    Arno

  • I just found that fw_setenv is just the top of an iceberg.  I need nandwrite that handles HW ECC as well - otherwise I can't update uboot/kernel ...  at linux shell. So is this possible and how?