public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* ubi image only mounts once
@ 2011-06-01 17:52 Douglass, Woody
  2011-06-02  4:03 ` Matthew L. Creech
  0 siblings, 1 reply; 8+ messages in thread
From: Douglass, Woody @ 2011-06-01 17:52 UTC (permalink / raw)
  To: linux-mtd

To whom it may concern;

I am trying to build a linux image to run on a custom omap3530 board. I
have reached a point where my build system builds a UBI image that can
be mounted exactly once; subsequent mounts fail. Here is the related
dmesg output:

When it works:

[  131.461883] omap2-nand driver initializing
[  131.466796] OMAP NAND: use WAIT0 as R/B# pin
[  131.504669] NAND device: Manufacturer ID: 0xad, Chip ID: 0xba (Hynix
NAND 256MiB 1,8V 16-bit)
[  131.524658] omap_ident_nand_chip:1352 ad ba
[  131.528869] Creating 5 MTD partitions on "omap2-nand":
[  131.534057] 0x000000000000-0x000000080000 : "X-Loader"
[  131.544036] 0x000000080000-0x000000260000 : "U-Boot"
[  131.552947] 0x000000260000-0x000000280000 : "U-Boot Env"
[  131.561065] 0x000000280000-0x000000680000 : "Kernel"
[  131.570281] 0x000000680000-0x000010000000 : "File System"
[  131.668182] OneNAND driver initializing
[  131.677215] UBI: attaching mtd4 to ubi0
[  131.681091] UBI: physical eraseblock size:   131072 bytes (128 KiB)
[  131.687744] UBI: logical eraseblock size:    129024 bytes
[  131.693176] UBI: smallest flash I/O unit:    2048
[  131.697998] UBI: sub-page size:              512
[  131.702636] UBI: VID header offset:          512 (aligned 512)
[  131.708923] UBI: data offset:                2048
[  132.483612] UBI: volume 0 ("rootfs") re-sized from 1041 to 1970 LEBs
[  132.495361] UBI: attached mtd4 to ubi0
[  132.499145] UBI: MTD device name:            "File System"
[  132.504852] UBI: MTD device size:            249 MiB
[  132.509857] UBI: number of good PEBs:        1993
[  132.514678] UBI: number of bad PEBs:         3
[  132.519165] UBI: max. allowed volumes:       128
[  132.523803] UBI: wear-leveling threshold:    4096
[  132.528594] UBI: number of internal volumes: 1
[  132.533081] UBI: number of user volumes:     1
[  132.537628] UBI: available PEBs:             0
[  132.542114] UBI: total number of reserved PEBs: 1993
[  132.547180] UBI: number of PEBs reserved for bad PEB handling: 19
[  132.553314] UBI: max/mean erase counter: 4/2
[  132.557678] UBI: image sequence number: 859895637
[  132.563018] UBI: background thread "ubi_bgt0d" started, PID 425

When it doesn't:

[  196.955749] omap2-nand driver initializing
[  196.960693] OMAP NAND: use WAIT0 as R/B# pin
[  196.998199] NAND device: Manufacturer ID: 0xad, Chip ID: 0xba (Hynix
NAND 256MiB 1,8V 16-bit)
[  197.018188] omap_ident_nand_chip:1352 ad ba
[  197.022399] Creating 5 MTD partitions on "omap2-nand":
[  197.027587] 0x000000000000-0x000000080000 : "X-Loader"
[  197.037536] 0x000000080000-0x000000260000 : "U-Boot"
[  197.046417] 0x000000260000-0x000000280000 : "U-Boot Env"
[  197.054565] 0x000000280000-0x000000680000 : "Kernel"
[  197.063781] 0x000000680000-0x000010000000 : "File System"
[  197.161712] OneNAND driver initializing
[  197.170745] UBI: attaching mtd4 to ubi0
[  197.174621] UBI: physical eraseblock size:   131072 bytes (128 KiB)
[  197.181274] UBI: logical eraseblock size:    129024 bytes
[  197.186706] UBI: smallest flash I/O unit:    2048
[  197.191528] UBI: sub-page size:              512
[  197.196166] UBI: VID header offset:          512 (aligned 512)
[  197.202453] UBI: data offset:                2048
[  197.311676] UBI error: ubi_io_read: error -74 while reading 64 bytes
from PEB 277:0, read 64 bytes
[  197.321197] UBI error: ubi_io_read: error -74 while reading 64 bytes
from PEB 278:0, read 64 bytes
[  197.330718] UBI error: ubi_io_read: error -74 while reading 64 bytes
from PEB 279:0, read 64 bytes
[  197.341644] UBI error: ubi_io_read: error -74 while reading 64 bytes
from PEB 284:0, read 64 bytes
[  197.983612] UBI error: ubi_read_volume_table: the layout volume was
not found
[  197.994171] UBI error: ubi_init: cannot attach mtd4
[  198.001983] UBI error: ubi_init: UBI error: cannot initialize UBI,
error -22

Note that I've run Angstrom linux on this board before, with the same
kernel; it worked fine.

I am using these commands to create the image:
mkfs.ubifs -r /mnt/storage/hc-build/output/fs -o
/mnt/storage/hc-build/build/fs/root.ubifs -m 2048 -e 129024 -c 2047 -U 
ubinize -o /mnt/storage/hc-build/output/boot/root.ubi -m 2048 -p 131072
-s 512 /mnt/storage/hc-build/build/fs/ubinize.conf

and my ubinize.conf is:
[ubifs]
mode=ubi
image=/mnt/storage/hc-build/build/fs/root.ubifs
vol_id=0
vol_size=128MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize

Thank you very much for any insight you can provide.

-Woodrow Douglass

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ubi image only mounts once
  2011-06-01 17:52 ubi image only mounts once Douglass, Woody
@ 2011-06-02  4:03 ` Matthew L. Creech
  2011-06-06 15:53   ` Douglass, Woody
  0 siblings, 1 reply; 8+ messages in thread
From: Matthew L. Creech @ 2011-06-02  4:03 UTC (permalink / raw)
  To: Douglass, Woody; +Cc: linux-mtd

On Wed, Jun 1, 2011 at 1:52 PM, Douglass, Woody
<Woodrow.Douglass@qinetiq-na.com> wrote:
>
> I am trying to build a linux image to run on a custom omap3530 board. I
> have reached a point where my build system builds a UBI image that can
> be mounted exactly once; subsequent mounts fail. Here is the related
> dmesg output:
>
<snip>

Hi,

How are you flashing the image on to NAND - using "ubiformat", or a
direct flashing utility like "nandwrite"?  I ask because it sounds
like the problem described here:

http://linux-mtd.infradead.org/faq/ubifs.html#L_why_ubiformat

Using "ubiformat" or generating the UBIFS image with the
free-space-fixup (-F) flag will fix the problem, if that's what it is.
If you use the mkfs.ubifs fixup flag, you'll need a very recent kernel
(3.0-rc1), and possibly also Ben Gardiner's patches from a couple days
ago:

http://lists.infradead.org/pipermail/linux-mtd/2011-May/035737.html

-- 
Matthew L. Creech

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: ubi image only mounts once
  2011-06-02  4:03 ` Matthew L. Creech
@ 2011-06-06 15:53   ` Douglass, Woody
  2011-06-06 16:08     ` Artem Bityutskiy
  2011-06-06 16:13     ` Matthew L. Creech
  0 siblings, 2 replies; 8+ messages in thread
From: Douglass, Woody @ 2011-06-06 15:53 UTC (permalink / raw)
  To: Matthew L. Creech; +Cc: linux-mtd

Matt, 

Thanks for the quick reply. I have tried both ubiformat (passing -f with
my image) and nandwrite, both seem to behave the same way. The
filesystem mounts once, but when I reboot, it doesn't ever mount again.

I cannot upgrade my kernel as my development schedule is too aggressive;
I don't have time. I'm using 2.6.32 for now; if I fail at getting UBI to
work, I can fall back on jffs2, which works, but I prefer UBIFS.

Note that I did successfully load a ubi image with this kernel In the
past with a filesystem image generated from OpenEmbedded. Could my
mkfs.ubifs/ubinize be the issue?

Thanks,
Woody


Woodrow Douglass
Software Design Engineer
QinetiQ North America
Technology Solutions Group
137 Delta Drive
Pittsburgh, PA 15238
(412) 449 1492
woodrow.douglass@qinetiq-na.com

**********************************************************************
THIS MESSAGE IS INTENDED ONLY FOR THE USE OF THE INDIVIDUAL OR ENTITY TO
WHICH IT IS ADDRESSED AND MAY CONTAIN INFORMATION THAT IS PRIVILEGED,
CONFIDENTIAL, AND EXEMPT FROM DISCLOSURE UNDER APPLICABLE LAW. If the
reader of this message is not the intended recipient, or the employee or
agent responsible for delivering the message to the intended recipient,
you are hereby notified that any dissemination, distribution,
forwarding, or copying of this communication is strictly prohibited.
Whilst this message has been swept by anti-virus software, you are
solely responsible for ensuring that any mail or attachments you receive
are virus free. We disclaim liability for any damage you suffer as a
consequence of receiving any virus; further communication will signify
your consent to this. If you have received this communication in error,
please notify info@automatika.com by e-mail or telephone, and delete the
original message. Thank you.
**********************************************************************

> -----Original Message-----
> From: Matthew L. Creech [mailto:mlcreech@gmail.com]
> Sent: Thursday, June 02, 2011 12:04 AM 0
> To: Douglass, Woody
> Cc: linux-mtd@lists.infradead.org
> Subject: Re: ubi image only mounts once
> 
> On Wed, Jun 1, 2011 at 1:52 PM, Douglass, Woody
> <Woodrow.Douglass@qinetiq-na.com> wrote:
> >
> > I am trying to build a linux image to run on a custom omap3530
board.
> I
> > have reached a point where my build system builds a UBI image that
> can
> > be mounted exactly once; subsequent mounts fail. Here is the related
> > dmesg output:
> >
> <snip>
> 
> Hi,
> 
> How are you flashing the image on to NAND - using "ubiformat", or a
> direct flashing utility like "nandwrite"?  I ask because it sounds
> like the problem described here:
> 
> http://linux-mtd.infradead.org/faq/ubifs.html#L_why_ubiformat
> 
> Using "ubiformat" or generating the UBIFS image with the
> free-space-fixup (-F) flag will fix the problem, if that's what it is.
> If you use the mkfs.ubifs fixup flag, you'll need a very recent kernel
> (3.0-rc1), and possibly also Ben Gardiner's patches from a couple days
> ago:
> 
> http://lists.infradead.org/pipermail/linux-mtd/2011-May/035737.html
> 
> --
> Matthew L. Creech

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: ubi image only mounts once
  2011-06-06 15:53   ` Douglass, Woody
@ 2011-06-06 16:08     ` Artem Bityutskiy
  2011-06-06 18:31       ` Douglass, Woody
  2011-06-06 16:13     ` Matthew L. Creech
  1 sibling, 1 reply; 8+ messages in thread
From: Artem Bityutskiy @ 2011-06-06 16:08 UTC (permalink / raw)
  To: Douglass, Woody; +Cc: linux-mtd, Matthew L. Creech

On Mon, 2011-06-06 at 11:53 -0400, Douglass, Woody wrote:
> Matt, 
> 
> Thanks for the quick reply. I have tried both ubiformat (passing -f with
> my image) and nandwrite, both seem to behave the same way. The
> filesystem mounts once, but when I reboot, it doesn't ever mount again.
> 
> I cannot upgrade my kernel as my development schedule is too aggressive;
> I don't have time. I'm using 2.6.32 for now; if I fail at getting UBI to
> work, I can fall back on jffs2, which works, but I prefer UBIFS.
> 
> Note that I did successfully load a ubi image with this kernel In the
> past with a filesystem image generated from OpenEmbedded. Could my
> mkfs.ubifs/ubinize be the issue?

I am sure the problem is your OMAP flash driver - it does not support
sub-pages correctly. There were several discussions. I have not idea
what is your kernel and which hacks it has.

Anyway, first try to check if I was right - run the mtd_subpagetest
test: http://www.linux-mtd.infradead.org/doc/general.html#L_mtd_tests

My prediction - it will fail. Let's check this.

If I'm right - you have 2 choices:

1. Fix the driver.
2. Do not use sub-pages (means you'll waste a bit more flash space).

For the latter - assume your sub-page size = page size = 2048 bytes, and
adjust your mkfs.ubifs/ubinise/ubisformat parameters accordingly. Feel
free to ask for more help - I do not want to write much now before you
have verified my theory.

Also, running all mtd tests is a good idea.

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ubi image only mounts once
  2011-06-06 15:53   ` Douglass, Woody
  2011-06-06 16:08     ` Artem Bityutskiy
@ 2011-06-06 16:13     ` Matthew L. Creech
  1 sibling, 0 replies; 8+ messages in thread
From: Matthew L. Creech @ 2011-06-06 16:13 UTC (permalink / raw)
  To: Douglass, Woody; +Cc: linux-mtd

On Mon, Jun 6, 2011 at 11:53 AM, Douglass, Woody
<Woodrow.Douglass@qinetiq-na.com> wrote:
> Matt,
>
> Thanks for the quick reply. I have tried both ubiformat (passing -f with
> my image) and nandwrite, both seem to behave the same way. The
> filesystem mounts once, but when I reboot, it doesn't ever mount again.
>

OK, if you tried using ubiformat and got the same error, then it's not
the problem I mentioned.

> I cannot upgrade my kernel as my development schedule is too aggressive;
> I don't have time. I'm using 2.6.32 for now; if I fail at getting UBI to
> work, I can fall back on jffs2, which works, but I prefer UBIFS.
>

That's fine, an upgrade should only be necessary to add support for
the fixup flag, which you don't need if you use ubiformat.

So it looks like it's something else (maybe platform-specific?), sorry.

-- 
Matthew L. Creech

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: ubi image only mounts once
  2011-06-06 16:08     ` Artem Bityutskiy
@ 2011-06-06 18:31       ` Douglass, Woody
  2011-06-06 18:53         ` Artem Bityutskiy
  0 siblings, 1 reply; 8+ messages in thread
From: Douglass, Woody @ 2011-06-06 18:31 UTC (permalink / raw)
  To: dedekind1; +Cc: linux-mtd

Artem,

Thanks, you're correct, subpages aren't working properly! First I tried applying this patch to solve the issue: https://patchwork.kernel.org/patch/749762/

The test still fails. Next, I changed the -s argument to ubinize from 512 to 2048; I also added -s 2048 to my ubiformat arguments.

Now, on boot, this happens:

[  357.992767] UBI: attaching mtd4 to ubi0
[  357.996673] UBI: physical eraseblock size:   131072 bytes (128 KiB)
[  358.003631] UBI: logical eraseblock size:    129024 bytes
[  358.009185] UBI: smallest flash I/O unit:    2048
[  358.013916] UBI: sub-page size:              512
[  358.018646] UBI: VID header offset:          512 (aligned 512)
[  358.024505] UBI: data offset:                2048
[  358.030639] UBI error: validate_ec_hdr: bad VID header offset 2048, expected 512
[  358.038085] UBI error: validate_ec_hdr: bad EC header
[  358.043426] UBI error: ubi_io_read_ec_hdr: validation failed for PEB 0
[  358.050292] UBI error: ubi_init: cannot attach mtd4
[  358.057708] UBI error: ubi_init: UBI error: cannot initialize UBI, error -22

How can I re set the sub-page size?

-Woody


> -----Original Message-----
> From: Artem Bityutskiy [mailto:dedekind1@gmail.com]
> Sent: Monday, June 06, 2011 12:08 PM 12
> To: Douglass, Woody
> Cc: Matthew L. Creech; linux-mtd@lists.infradead.org
> Subject: RE: ubi image only mounts once
> 
> On Mon, 2011-06-06 at 11:53 -0400, Douglass, Woody wrote:
> > Matt,
> >
> > Thanks for the quick reply. I have tried both ubiformat (passing -f
> with
> > my image) and nandwrite, both seem to behave the same way. The
> > filesystem mounts once, but when I reboot, it doesn't ever mount
> again.
> >
> > I cannot upgrade my kernel as my development schedule is too
> aggressive;
> > I don't have time. I'm using 2.6.32 for now; if I fail at getting UBI
> to
> > work, I can fall back on jffs2, which works, but I prefer UBIFS.
> >
> > Note that I did successfully load a ubi image with this kernel In the
> > past with a filesystem image generated from OpenEmbedded. Could my
> > mkfs.ubifs/ubinize be the issue?
> 
> I am sure the problem is your OMAP flash driver - it does not support
> sub-pages correctly. There were several discussions. I have not idea
> what is your kernel and which hacks it has.
> 
> Anyway, first try to check if I was right - run the mtd_subpagetest
> test: http://www.linux-mtd.infradead.org/doc/general.html#L_mtd_tests
> 
> My prediction - it will fail. Let's check this.
> 
> If I'm right - you have 2 choices:
> 
> 1. Fix the driver.
> 2. Do not use sub-pages (means you'll waste a bit more flash space).
> 
> For the latter - assume your sub-page size = page size = 2048 bytes,
> and
> adjust your mkfs.ubifs/ubinise/ubisformat parameters accordingly. Feel
> free to ask for more help - I do not want to write much now before you
> have verified my theory.
> 
> Also, running all mtd tests is a good idea.
> 
> --
> Best Regards,
> Artem Bityutskiy (Артём Битюцкий)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ubi image only mounts once
  2011-06-06 18:31       ` Douglass, Woody
@ 2011-06-06 18:53         ` Artem Bityutskiy
  2011-06-06 19:14           ` Douglass, Woody
  0 siblings, 1 reply; 8+ messages in thread
From: Artem Bityutskiy @ 2011-06-06 18:53 UTC (permalink / raw)
  To: Douglass, Woody; +Cc: linux-mtd

On Mon, Jun 6, 2011 at 9:31 PM, Douglass, Woody
<Woodrow.Douglass@qinetiq-na.com> wrote:
>
> Artem,
>
> Thanks, you're correct, subpages aren't working properly! First I tried applying this patch to solve the issue: https://patchwork.kernel.org/patch/749762/
>
> The test still fails. Next, I changed the -s argument to ubinize from 512 to 2048; I also added -s 2048 to my ubiformat arguments.
>
> Now, on boot, this happens:
>
> [  357.992767] UBI: attaching mtd4 to ubi0
> [  357.996673] UBI: physical eraseblock size:   131072 bytes (128 KiB)
> [  358.003631] UBI: logical eraseblock size:    129024 bytes
> [  358.009185] UBI: smallest flash I/O unit:    2048
> [  358.013916] UBI: sub-page size:              512
> [  358.018646] UBI: VID header offset:          512 (aligned 512)
> [  358.024505] UBI: data offset:                2048
> [  358.030639] UBI error: validate_ec_hdr: bad VID header offset 2048, expected 512
> [  358.038085] UBI error: validate_ec_hdr: bad EC header
> [  358.043426] UBI error: ubi_io_read_ec_hdr: validation failed for PEB 0
> [  358.050292] UBI error: ubi_init: cannot attach mtd4
> [  358.057708] UBI error: ubi_init: UBI error: cannot initialize UBI, error -22
>
> How can I re set the sub-page size?

Take a look here:
http://linux-mtd.infradead.org/faq/ubi.html#L_vid_offset_mismatch

Also modinfo ubi

If you attach UBI using the kernel boot parameters, use mtd=X,2048,
where X is your number.

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: ubi image only mounts once
  2011-06-06 18:53         ` Artem Bityutskiy
@ 2011-06-06 19:14           ` Douglass, Woody
  0 siblings, 0 replies; 8+ messages in thread
From: Douglass, Woody @ 2011-06-06 19:14 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: linux-mtd

Artem,

That fixed it!

Thanks for all of your help; My next task is to find the right set of patches for this nand driver; but I have a temporary solution in the mean time.

Thanks again,
Woody


> -----Original Message-----
> From: Artem Bityutskiy [mailto:dedekind1@gmail.com]
> Sent: Monday, June 06, 2011 2:54 PM 14
> To: Douglass, Woody
> Cc: linux-mtd@lists.infradead.org
> Subject: Re: ubi image only mounts once
> 
> On Mon, Jun 6, 2011 at 9:31 PM, Douglass, Woody
> <Woodrow.Douglass@qinetiq-na.com> wrote:
> >
> > Artem,
> >
> > Thanks, you're correct, subpages aren't working properly! First I
> tried applying this patch to solve the issue:
> https://patchwork.kernel.org/patch/749762/
> >
> > The test still fails. Next, I changed the -s argument to ubinize from
> 512 to 2048; I also added -s 2048 to my ubiformat arguments.
> >
> > Now, on boot, this happens:
> >
> > [  357.992767] UBI: attaching mtd4 to ubi0
> > [  357.996673] UBI: physical eraseblock size:   131072 bytes (128
> KiB)
> > [  358.003631] UBI: logical eraseblock size:    129024 bytes
> > [  358.009185] UBI: smallest flash I/O unit:    2048
> > [  358.013916] UBI: sub-page size:              512
> > [  358.018646] UBI: VID header offset:          512 (aligned 512)
> > [  358.024505] UBI: data offset:                2048
> > [  358.030639] UBI error: validate_ec_hdr: bad VID header offset
> 2048, expected 512
> > [  358.038085] UBI error: validate_ec_hdr: bad EC header
> > [  358.043426] UBI error: ubi_io_read_ec_hdr: validation failed for
> PEB 0
> > [  358.050292] UBI error: ubi_init: cannot attach mtd4
> > [  358.057708] UBI error: ubi_init: UBI error: cannot initialize UBI,
> error -22
> >
> > How can I re set the sub-page size?
> 
> Take a look here:
> http://linux-mtd.infradead.org/faq/ubi.html#L_vid_offset_mismatch
> 
> Also modinfo ubi
> 
> If you attach UBI using the kernel boot parameters, use mtd=X,2048,
> where X is your number.
> 
> --
> Best Regards,
> Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-06-06 19:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-01 17:52 ubi image only mounts once Douglass, Woody
2011-06-02  4:03 ` Matthew L. Creech
2011-06-06 15:53   ` Douglass, Woody
2011-06-06 16:08     ` Artem Bityutskiy
2011-06-06 18:31       ` Douglass, Woody
2011-06-06 18:53         ` Artem Bityutskiy
2011-06-06 19:14           ` Douglass, Woody
2011-06-06 16:13     ` Matthew L. Creech

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox