3

While in U-boot in an arm based board (wb45n), I manually erase and then mark a block bad.

U-Boot> nand erase 0x00720000 20000

NAND erase: device 0 offset 0x00720000, size 0x20000
Erasing at 0x720000 -- 100% complete.
OK
U-Boot> nand markbad 0x00720000
block 0x00720000 successfully marked as bad
U-Boot> nand bad
>
Device 0 bad blocks:
00720000

I write software and can see the bad blocks being skipped in the process.

NAND write: device 0 offset 0x5e0000, size 0x16c0000
Skip bad block 0x00720000
23855104 bytes written: OK

After the software writing, I reboot and the bad blocks are not there.

U-Boot> nand bad
>
Device 0 bad blocks:
U-Boot>

Seems as if they have been automatically corrected. If I don't erase the blocks before marking them bad, I can write software successfully but I (often but not always) get the following error during the kernel boot: (I don' t really know why this error message is produced, any explanations are welcome)

UBI error: scan_peb: bad image sequence number 1748114077 in PEB 175, expected 1578922167

Erase counter header dump:

    magic          0x55424923
    version        1
    ec             1
    vid_hdr_offset 2048
    data_offset    4096
    image_seq      1748114077
    hdr_crc        0x285278f

Starting kernel ...

Uncompressing Linux... done, booting the kernel.

add to erase: PEB 0, EC 0 UBI error: ubi_compare_lebs: unsupported on-flash UBI format
UBI error: ubi_attach_mtd_dev: failed to attach mtd6, error -22
UBI error: ubi_init: cannot attach mtd6
UBIFS error (pid 1): ubifs_mount: cannot open "ubi0:rootfs", error -19
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown- block(0,0)

What I am trying to do is test the board to see how many bad blocks it can handle before failing.

Is the way I mark the bad blocks correct?
Why do the bad blocks disappear?
Is there a way to mark bad blocks that will persist?
What does the last error mean?

2

https://community.nxp.com/thread/334536#comment-453692

the error is related to a problem in the flashing of the board, that is:

  1. you flash a new image incorrectly - you do not erase whole flash

  2. you flash a new image - by erasing only the erase blocks where you write, but not erasing the rest of eraseblock.

I can imagine this happening if

  • you omitted your nand erase or
  • you wrote an image with N blocks marked bad on the NAND, then subsequently wrote the same image but with N-1 blocks marked bad on the NAND. After the end of the current image, there would be 1 block left over at the end from the previous image, which would not have been overwritten.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.