All of lore.kernel.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Lars Michael <lh_post@yahoo.com>, u-boot@lists.denx.de
Cc: Ben Gardiner <bengardiner@nanometrics.ca>, linux-mtd@lists.infradead.org
Subject: Re: U-Boot: using nand write to flash an ubi image, ubi part fails
Date: Wed, 01 Jun 2011 14:56:15 +0300	[thread overview]
Message-ID: <1306929375.4405.116.camel@localhost> (raw)
In-Reply-To: <891190.21758.qm@web30201.mail.mud.yahoo.com>

On Wed, 2011-06-01 at 00:57 -0700, Lars Michael wrote:
> Hello,
> 
> Using mkfs.ubifs and ubinize I have created an image with 5 volumes.
> In Linux I could flash it using "ubiformat /dev/mtd1 -f /root/ubi.img"
> and attach it using "ubiattach /dev/ubi_ctrl -m 1". It worked.

OK.

> In production I would prefer to write the image from U-Boot. So in
> U-Boot I used "nand erase" then "nand write" to flash the image. Then
> I want to attach by "ubi part" command - but this fails: "UBI error:
> ubi_init: UBI error: cannot initialize UBI, error -17"

Sorry, I'm not familiar with U-boot, so probably cc-ing U-boot mailing
list would be a good idea.

> Then I booted Linux (via nfs) and tried to re-format+attach, but now
> it fails. Format complains about eraseblock contents and missing erase
> counters: 
> 
> ubiformat: warning!: 1099 of 2036 eraseblocks contain non-ubifs data
> ubiformat: warning!: only 937 of 2036 eraseblocks have valid erase
> counter

OK, this means that many eraseblocks in the flash contain some data
which does not look like UBI headers.

> 
> The ubiattach now reports lots of:
> ...
> UBI error: check_corruption: PEB 0 contains corrupted VID header, and
> the data does not contain all 0xFF, this may be a non-UBI PEB or a
> severe VID header corruption which requires manual inspection
> 
> UBI warning: process_eb: valid VID header but corrupted EC header at
> PEB 4
> ...

OK.

> I realize that the U-Boot 'nand erase' does not preserve the erase
> counters. So what would be the correct way to erase and write in
> U-Boot?

I do not know, you need to ask U-boot-aware people. I've CCed some.

>  And why is the ubiformat not able to correct the problems?

It should be able to format any flash. Probably this is a bug. Can you
reproduce this with nandsim please? Just insmod nandsim on your PC (see
http://www.linux-mtd.infradead.org/faq/nand.html#L_nand_nandsim or
modinfo nandsim), write some garbage there or your image, and try to
format it.

If you can describe how I can reproduce this in my PC, I might look at
this. Or you can just debug ubiformat yourself.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

WARNING: multiple messages have this Message-ID (diff)
From: Artem Bityutskiy <dedekind1@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] U-Boot: using nand write to flash an ubi image, ubi part fails
Date: Wed, 01 Jun 2011 14:56:15 +0300	[thread overview]
Message-ID: <1306929375.4405.116.camel@localhost> (raw)
In-Reply-To: <891190.21758.qm@web30201.mail.mud.yahoo.com>

On Wed, 2011-06-01 at 00:57 -0700, Lars Michael wrote:
> Hello,
> 
> Using mkfs.ubifs and ubinize I have created an image with 5 volumes.
> In Linux I could flash it using "ubiformat /dev/mtd1 -f /root/ubi.img"
> and attach it using "ubiattach /dev/ubi_ctrl -m 1". It worked.

OK.

> In production I would prefer to write the image from U-Boot. So in
> U-Boot I used "nand erase" then "nand write" to flash the image. Then
> I want to attach by "ubi part" command - but this fails: "UBI error:
> ubi_init: UBI error: cannot initialize UBI, error -17"

Sorry, I'm not familiar with U-boot, so probably cc-ing U-boot mailing
list would be a good idea.

> Then I booted Linux (via nfs) and tried to re-format+attach, but now
> it fails. Format complains about eraseblock contents and missing erase
> counters: 
> 
> ubiformat: warning!: 1099 of 2036 eraseblocks contain non-ubifs data
> ubiformat: warning!: only 937 of 2036 eraseblocks have valid erase
> counter

OK, this means that many eraseblocks in the flash contain some data
which does not look like UBI headers.

> 
> The ubiattach now reports lots of:
> ...
> UBI error: check_corruption: PEB 0 contains corrupted VID header, and
> the data does not contain all 0xFF, this may be a non-UBI PEB or a
> severe VID header corruption which requires manual inspection
> 
> UBI warning: process_eb: valid VID header but corrupted EC header at
> PEB 4
> ...

OK.

> I realize that the U-Boot 'nand erase' does not preserve the erase
> counters. So what would be the correct way to erase and write in
> U-Boot?

I do not know, you need to ask U-boot-aware people. I've CCed some.

>  And why is the ubiformat not able to correct the problems?

It should be able to format any flash. Probably this is a bug. Can you
reproduce this with nandsim please? Just insmod nandsim on your PC (see
http://www.linux-mtd.infradead.org/faq/nand.html#L_nand_nandsim or
modinfo nandsim), write some garbage there or your image, and try to
format it.

If you can describe how I can reproduce this in my PC, I might look at
this. Or you can just debug ubiformat yourself.

-- 
Best Regards,
Artem Bityutskiy (????? ????????)

  reply	other threads:[~2011-06-01 12:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-01  7:57 U-Boot: using nand write to flash an ubi image, ubi part fails Lars Michael
2011-06-01 11:56 ` Artem Bityutskiy [this message]
2011-06-01 11:56   ` [U-Boot] " Artem Bityutskiy
2011-06-01 13:41   ` Ben Gardiner
2011-06-01 13:41     ` [U-Boot] " Ben Gardiner
2011-07-18  9:29     ` Lars Michael
2011-07-18  9:29       ` [U-Boot] " Lars Michael
2011-09-29  2:11       ` Aaron Williams
2011-09-30  3:33         ` Lars Michael
2011-09-30  6:46           ` Aaron Williams
2011-10-01 19:01             ` Lars Michael
2011-09-29  2:43 ` Matthew L. Creech
2011-09-29  2:43   ` [U-Boot] " Matthew L. Creech
2011-09-30  3:44   ` Lars Michael
2011-09-30  3:44     ` [U-Boot] " Lars Michael
2011-10-03 20:36     ` Scott Wood
2011-10-03 20:36       ` Scott Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1306929375.4405.116.camel@localhost \
    --to=dedekind1@gmail.com \
    --cc=bengardiner@nanometrics.ca \
    --cc=lh_post@yahoo.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.