[U-Boot] handling of bad blocks in nand

Ben Gardiner bengardiner at nanometrics.ca
Fri Jul 9 14:56:40 CEST 2010


On Fri, Jul 9, 2010 at 5:12 AM, Arno Steffen
<arno.steffen at googlemail.com> wrote:
> Sorry another question to that.
>
> As for instance I want to have 10MB for root partion and keep 2 blocks
> extra as reserve for some bad blocks.
> I will erase the hole 10MB+2block, write 10MB. That's what I do in uboot.
>
> But in Kernel I have some partition table like this:
>
>    {
>        .name           = "root(1)",
>        .offset         = MTDPART_OFS_APPEND,
>        .size           = 82*(64*2048),        /*10MB + 256k*/
>        .mask_flags     = MTD_WRITEABLE /* force read-only */
>    },
>
> There are right now the 2 extra blocks inside (but they haven't been
> written or formatted).
> That is wrong, isn't it? The kernel might now write beyond the 10MB.
>
> I think I have to set size to 80*(62*2048) and append the 2 extra
> blocks to the offset in the next Partition to leave this 2 block free.
>
> But I am not sure. So thanks for a quick look and an advice.

I think you are are correct in specifying the total size of your partition.

If you are putting an MTD filesystem in that partition then the
filesystem itself will take care of bad blocks that might occur in the
partition during runtime. During the flash programming of this
filesystem using nand write.jffs2 (or .e) will skip bad blocks that
might occur in the partition.

If you are putting an image (kernel or initrd) into the partition then
the 'nand read.e' and 'nand write.e' (as well as mtd-utils nandwrite)
will handle bad blocks by skipping over them.

Either way, it is best to specify the partition by its total size.

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
+1 (613) 592-6776 x239
http://www.nanometrics.ca


More information about the U-Boot mailing list