AnsweredAssumed Answered

MPC8308 :: fw_setenv crashes and corrupts U-Boot environment

Question asked by Nikolay Chernov on Mar 15, 2013
Latest reply on Jun 24, 2013 by Nikolay Chernov

Hi all,


I have a problem with fw_setenv utility on MPC8308.


Problem has been noticed in software update procedure where we need to change some U-Boot environment variables from bash script. It appeared that fw_setenv sometimes fails when it is called in script with other file operations with flash.


Following script reproduce this problem. It copies file from one NAND partition to another and then sets some value to dummy U-Boot variable.



echo "Starting fw_setenv stress test..."

rm -rf /mnt/data/testdir

mkdir /mnt/data/testdir 


while [ $x -le 1000 ]


    cp /usr/bin/ /mnt/data/testdir/file$x

    fw_setenv dummy "dummy-$x"

    echo "fw_setenv executed $x times"

    x=$(( $x + 1 ))


echo "Test succeded"


Typical output looks like that


fw_setenv executed 453 times

fw_setenv executed 454 times

fw_setenv executed 455 times

fw_setenv executed 456 times

Oops: Machine check, sig: 7 [#1]


Modules linked in:

NIP: c01c6990 LR: c01c7b2c CTR: c001c6c8

REGS: c7063cf0 TRAP: 0200 Not tainted (

MSR: 00049030 <EE,ME,IR,DR> CR: 42000442 XER: 20000000

TASK = c78628c0[7056] 'fw_setenv' THREAD: c7062000

GPR00: 00000000 c7063da0 c78628c0 c79cc7a4 00060706 00000024 d1960361 00000001

GPR08: 00000001 c9080000 24002022 c0020000 001f648c 1001d6ac 10018010 10010000

GPR16: 00000000 00000000 c7063dc8 c0310000 c7063da8 c001ba28 00000000 00006f6f

GPR24: c7941818 c7941834 c79417e0 00000000 00000001 00060706 00010813 c79cc7a4

Call Trace:

[c7063da0] [c01c7b50] 0xc01c7b50 (unreliable)

[c7063e10] [c01c7e64] 0xc01c7e64

[c7063e80] [c01c0a50] 0xc01c0a50

[c7063e90] [c01c2b74] 0xc01c2b74

[c7063ef0] [c0075f28] 0xc0075f28

[c7063f10] [c0076440] 0xc0076440

[c7063f40] [c001141c] 0xc001141c

--- Exception: c01 at 0xff606ec

  LR = 0x10001644

Instruction dump:

41860024 2f800004 419e005c 419a0040 4186001c 7c031a78 7c630034 5463d97e

4e800020 8123000c 7c09222e 8123000c <7c69222e> 7c031a78 7c630034 5463d97e

---[ end trace 7560118e3d077417 ]---

Erase at 0x00ce0000 failed immediately: errno -5

Erase at 0x00ce0000 failed immediately: errno -5

JFFS2: marking eraseblock at 00ce0000

as bad<4>nand_bbt: Error while writing bad block table -5

Similar problem was described here. Unfortunately there was no solution except a workaround that doesn't work for us.

I have already tried to build fw_setenv from latest U-Boot release. Doesn't help.

Looks like something is wrong with MTD driver... I feel that we need to update kernel... But I would like to find some simple solution.