public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* nandwrite/ubi memory corruption?
@ 2008-10-16 10:10 Michal Ludvig
  2008-10-16 14:49 ` Artem Bityutskiy
  2008-10-16 15:01 ` Ben Dooks
  0 siblings, 2 replies; 16+ messages in thread
From: Michal Ludvig @ 2008-10-16 10:10 UTC (permalink / raw)
  To: linux-mtd

Hi all,

I've got an ARM board with 64MB of NAND flash with 3 logical partitions
and am experiencing (probably) memory corruption of UBI/UBIFS on
/dev/mtd2 after writing data with nandwrite to /dev/mtd1.

These are my logical partitions on NAND:

S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2410-nand s3c2410-nand: Tacls=3, 30ns Twrph0=7 70ns, Twrph1=3 30ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB
3,3V 8-bit)
Scanning device for bad blocks
Creating 3 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x00000000-0x00050000 : "boot"
0x00050000-0x00220000 : "kernel"
0x00220000-0x04000000 : "ubi"
s3c2410-nand s3c2410-nand: clock idle support enabled



I use u-boot 1.1.4 as the bootloader and 2.6.27 as the kernel. The
kernel image size is 1492552 bytes, that should fit into the kernel
partition as far as I can tell.

When I load the kernel in u-boot and write into NAND with 'nandw'
command of u-boot it works fine.

However when I use nandwrite from linux it does "something" but
1) the kernel won't boot
2) it probably corrupted the 'ubi' partition:

~ # nandwrite -p /dev/mtd1 uimage26
Writing data to block 0
Writing data to block 4000
[...]
Writing data to block 164000
Writing data to block 168000
Writing data to block 16c000

~ # ls
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB
2414:15360, written 0 bytes
UBI warning: ubi_eba_write_leb: failed to write data to PEB 2414
UBI: recover PEB 2414, move data to PEB 2428
UBI warning: ubi_io_read_vid_hdr: bad magic number at PEB 2414: 00000000
instead of 55424921
UBI warning: ubi_ro_mode: switch to read-only mode
UBIFS error (pid 224): ubifs_wbuf_sync_nolock: cannot write 512 bytes to
LEB 746:14336
UBIFS error (pid 224): ubifs_bg_wbufs_sync: cannot sync write-buffer,
error -5
UBIFS warning (pid 224): ubifs_ro_mode: switched to read-only mode, error -5

So it experienced some corruption and switched to read-only mode.

Auto-completeing commands in shell doesn't work either:

~ # nandd<tab>
UBIFS error (pid 241): ubifs_read_node: bad node type (0 but expected 9)
UBIFS error (pid 241): ubifs_read_node: bad node at LEB 757:11760
UBIFS error (pid 241): ubifs_iget: failed to read inode 232, error -22
UBIFS error (pid 241): ubifs_lookup: dead directory entry 'nanddump',
error -22

When I reset the board the just written kernel won't boot:

NAND Flash Reading
dst base address          = 0x30100000
Source start block number = 20
Source size  (0x4000*n)   = 0x180000
status 1
## Booting image at 30100000 ...
status 2
Bad Header Checksum
status -2

But after reloading a good kernel into NAND in u-boot and booting it
everything looks ok and I can run 'ls' and 'nanddump' just fine. I can't
tell whether the UBIFS volume is corrupted or not (is there some ubifsck
tool available?) but nothing obvious pops up.

Nandwrite is ~2 days old one from git, kernel is 2.6.27, both compiled
with gcc 3.4.6. CPU is Samsung S3C2410 (ARM920T arch), NAND as above.

So the summary is
1) Writing a kernel image with nandwrite into a MTD partition /dev/mtd1,
where the kernel image is smaller than the partition.
2) Ubi/ubifs using MTD partition /dev/mtd2 gets corrupted (memory only?)
3) The written kernel won't boot. The same one written from u-boot works
fine.

It's all 100% reproducible.

Do you need any other information?

Michal

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

* Re: nandwrite/ubi memory corruption?
  2008-10-16 10:10 nandwrite/ubi memory corruption? Michal Ludvig
@ 2008-10-16 14:49 ` Artem Bityutskiy
  2008-10-16 14:56   ` Artem Bityutskiy
  2008-10-16 15:01 ` Ben Dooks
  1 sibling, 1 reply; 16+ messages in thread
From: Artem Bityutskiy @ 2008-10-16 14:49 UTC (permalink / raw)
  To: Michal Ludvig; +Cc: linux-mtd

On Thu, 2008-10-16 at 23:10 +1300, Michal Ludvig wrote:
> Hi all,
> 
> I've got an ARM board with 64MB of NAND flash with 3 logical partitions
> and am experiencing (probably) memory corruption of UBI/UBIFS on
> /dev/mtd2 after writing data with nandwrite to /dev/mtd1.
> 
> These are my logical partitions on NAND:
> 
> S3C24XX NAND Driver, (c) 2004 Simtec Electronics
> s3c2410-nand s3c2410-nand: Tacls=3, 30ns Twrph0=7 70ns, Twrph1=3 30ns
> NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB
> 3,3V 8-bit)
> Scanning device for bad blocks
> Creating 3 MTD partitions on "NAND 64MiB 3,3V 8-bit":
> 0x00000000-0x00050000 : "boot"
> 0x00050000-0x00220000 : "kernel"
> 0x00220000-0x04000000 : "ubi"
> s3c2410-nand s3c2410-nand: clock idle support enabled
> 
> 
> 
> I use u-boot 1.1.4 as the bootloader and 2.6.27 as the kernel. The
> kernel image size is 1492552 bytes, that should fit into the kernel
> partition as far as I can tell.
> 
> When I load the kernel in u-boot and write into NAND with 'nandw'
> command of u-boot it works fine.
> 
> However when I use nandwrite from linux it does "something" but
> 1) the kernel won't boot
> 2) it probably corrupted the 'ubi' partition:
> 
> ~ # nandwrite -p /dev/mtd1 uimage26
> Writing data to block 0
> Writing data to block 4000
> [...]
> Writing data to block 164000
> Writing data to block 168000
> Writing data to block 16c000
> 
> ~ # ls
> UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB
> 2414:15360, written 0 bytes
> UBI warning: ubi_eba_write_leb: failed to write data to PEB 2414
> UBI: recover PEB 2414, move data to PEB 2428
> UBI warning: ubi_io_read_vid_hdr: bad magic number at PEB 2414: 00000000
> instead of 55424921
> UBI warning: ubi_ro_mode: switch to read-only mode
> UBIFS error (pid 224): ubifs_wbuf_sync_nolock: cannot write 512 bytes to
> LEB 746:14336
> UBIFS error (pid 224): ubifs_bg_wbufs_sync: cannot sync write-buffer,
> error -5
> UBIFS warning (pid 224): ubifs_ro_mode: switched to read-only mode, error -5

Could you please try ubiformat instead of nandwrite? See here:
http://www.linux-mtd.infradead.org/faq/ubi.html#L_ubierase

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

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

* Re: nandwrite/ubi memory corruption?
  2008-10-16 14:49 ` Artem Bityutskiy
@ 2008-10-16 14:56   ` Artem Bityutskiy
  2008-10-16 22:10     ` Michal Ludvig
  0 siblings, 1 reply; 16+ messages in thread
From: Artem Bityutskiy @ 2008-10-16 14:56 UTC (permalink / raw)
  To: Michal Ludvig; +Cc: linux-mtd

On Thu, 2008-10-16 at 17:49 +0300, Artem Bityutskiy wrote:
> On Thu, 2008-10-16 at 23:10 +1300, Michal Ludvig wrote:
> > Hi all,
> > 
> > I've got an ARM board with 64MB of NAND flash with 3 logical partitions
> > and am experiencing (probably) memory corruption of UBI/UBIFS on
> > /dev/mtd2 after writing data with nandwrite to /dev/mtd1.
> > 
> > These are my logical partitions on NAND:
> > 
> > S3C24XX NAND Driver, (c) 2004 Simtec Electronics
> > s3c2410-nand s3c2410-nand: Tacls=3, 30ns Twrph0=7 70ns, Twrph1=3 30ns
> > NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB
> > 3,3V 8-bit)
> > Scanning device for bad blocks
> > Creating 3 MTD partitions on "NAND 64MiB 3,3V 8-bit":
> > 0x00000000-0x00050000 : "boot"
> > 0x00050000-0x00220000 : "kernel"
> > 0x00220000-0x04000000 : "ubi"
> > s3c2410-nand s3c2410-nand: clock idle support enabled
> > 
> > 
> > 
> > I use u-boot 1.1.4 as the bootloader and 2.6.27 as the kernel. The
> > kernel image size is 1492552 bytes, that should fit into the kernel
> > partition as far as I can tell.
> > 
> > When I load the kernel in u-boot and write into NAND with 'nandw'
> > command of u-boot it works fine.
> > 
> > However when I use nandwrite from linux it does "something" but
> > 1) the kernel won't boot
> > 2) it probably corrupted the 'ubi' partition:
> > 
> > ~ # nandwrite -p /dev/mtd1 uimage26
> > Writing data to block 0
> > Writing data to block 4000
> > [...]
> > Writing data to block 164000
> > Writing data to block 168000
> > Writing data to block 16c000
> > 
> > ~ # ls
> > UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB
> > 2414:15360, written 0 bytes
> > UBI warning: ubi_eba_write_leb: failed to write data to PEB 2414
> > UBI: recover PEB 2414, move data to PEB 2428
> > UBI warning: ubi_io_read_vid_hdr: bad magic number at PEB 2414: 00000000
> > instead of 55424921
> > UBI warning: ubi_ro_mode: switch to read-only mode
> > UBIFS error (pid 224): ubifs_wbuf_sync_nolock: cannot write 512 bytes to
> > LEB 746:14336
> > UBIFS error (pid 224): ubifs_bg_wbufs_sync: cannot sync write-buffer,
> > error -5
> > UBIFS warning (pid 224): ubifs_ro_mode: switched to read-only mode, error -5
> 
> Could you please try ubiformat instead of nandwrite? See here:
> http://www.linux-mtd.infradead.org/faq/ubi.html#L_ubierase

Also, please, give me your page and sub-page size. See here:
http://www.linux-mtd.infradead.org/faq/ubi.html#L_find_min_io_size

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

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

* Re: nandwrite/ubi memory corruption?
  2008-10-16 10:10 nandwrite/ubi memory corruption? Michal Ludvig
  2008-10-16 14:49 ` Artem Bityutskiy
@ 2008-10-16 15:01 ` Ben Dooks
  2008-10-16 21:43   ` Michal Ludvig
  1 sibling, 1 reply; 16+ messages in thread
From: Ben Dooks @ 2008-10-16 15:01 UTC (permalink / raw)
  To: Michal Ludvig; +Cc: linux-mtd

On Thu, Oct 16, 2008 at 11:10:29PM +1300, Michal Ludvig wrote:
> Hi all,
> 
> I've got an ARM board with 64MB of NAND flash with 3 logical partitions
> and am experiencing (probably) memory corruption of UBI/UBIFS on
> /dev/mtd2 after writing data with nandwrite to /dev/mtd1.
> 
> These are my logical partitions on NAND:
> 
> S3C24XX NAND Driver, (c) 2004 Simtec Electronics
> s3c2410-nand s3c2410-nand: Tacls=3, 30ns Twrph0=7 70ns, Twrph1=3 30ns
> NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB
> 3,3V 8-bit)
> Scanning device for bad blocks
> Creating 3 MTD partitions on "NAND 64MiB 3,3V 8-bit":
> 0x00000000-0x00050000 : "boot"
> 0x00050000-0x00220000 : "kernel"
> 0x00220000-0x04000000 : "ubi"
> s3c2410-nand s3c2410-nand: clock idle support enabled

hmm, could you try disabling the clock-idle support?
 
> 
> 
> I use u-boot 1.1.4 as the bootloader and 2.6.27 as the kernel. The
> kernel image size is 1492552 bytes, that should fit into the kernel
> partition as far as I can tell.
> 
> When I load the kernel in u-boot and write into NAND with 'nandw'
> command of u-boot it works fine.
> 
> However when I use nandwrite from linux it does "something" but
> 1) the kernel won't boot
> 2) it probably corrupted the 'ubi' partition:
> 
> ~ # nandwrite -p /dev/mtd1 uimage26
> Writing data to block 0
> Writing data to block 4000
> [...]
> Writing data to block 164000
> Writing data to block 168000
> Writing data to block 16c000
> 
> ~ # ls
> UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB
> 2414:15360, written 0 bytes
> UBI warning: ubi_eba_write_leb: failed to write data to PEB 2414
> UBI: recover PEB 2414, move data to PEB 2428
> UBI warning: ubi_io_read_vid_hdr: bad magic number at PEB 2414: 00000000
> instead of 55424921
> UBI warning: ubi_ro_mode: switch to read-only mode
> UBIFS error (pid 224): ubifs_wbuf_sync_nolock: cannot write 512 bytes to
> LEB 746:14336
> UBIFS error (pid 224): ubifs_bg_wbufs_sync: cannot sync write-buffer,
> error -5
> UBIFS warning (pid 224): ubifs_ro_mode: switched to read-only mode, error -5
> 
> So it experienced some corruption and switched to read-only mode.
> 
> Auto-completeing commands in shell doesn't work either:
> 
> ~ # nandd<tab>
> UBIFS error (pid 241): ubifs_read_node: bad node type (0 but expected 9)
> UBIFS error (pid 241): ubifs_read_node: bad node at LEB 757:11760
> UBIFS error (pid 241): ubifs_iget: failed to read inode 232, error -22
> UBIFS error (pid 241): ubifs_lookup: dead directory entry 'nanddump',
> error -22
> 
> When I reset the board the just written kernel won't boot:
> 
> NAND Flash Reading
> dst base address          = 0x30100000
> Source start block number = 20
> Source size  (0x4000*n)   = 0x180000
> status 1
> ## Booting image at 30100000 ...
> status 2
> Bad Header Checksum
> status -2
> 
> But after reloading a good kernel into NAND in u-boot and booting it
> everything looks ok and I can run 'ls' and 'nanddump' just fine. I can't
> tell whether the UBIFS volume is corrupted or not (is there some ubifsck
> tool available?) but nothing obvious pops up.
> 
> Nandwrite is ~2 days old one from git, kernel is 2.6.27, both compiled
> with gcc 3.4.6. CPU is Samsung S3C2410 (ARM920T arch), NAND as above.
> 
> So the summary is
> 1) Writing a kernel image with nandwrite into a MTD partition /dev/mtd1,
> where the kernel image is smaller than the partition.
> 2) Ubi/ubifs using MTD partition /dev/mtd2 gets corrupted (memory only?)
> 3) The written kernel won't boot. The same one written from u-boot works
> fine.
> 
> It's all 100% reproducible.
> 
> Do you need any other information?
> 
> Michal
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

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

* Re: nandwrite/ubi memory corruption?
  2008-10-16 15:01 ` Ben Dooks
@ 2008-10-16 21:43   ` Michal Ludvig
  2008-10-16 21:56     ` Ben Dooks
  0 siblings, 1 reply; 16+ messages in thread
From: Michal Ludvig @ 2008-10-16 21:43 UTC (permalink / raw)
  To: Ben Dooks; +Cc: linux-mtd

Ben Dooks wrote:
> On Thu, Oct 16, 2008 at 11:10:29PM +1300, Michal Ludvig wrote:
>> Hi all,
>>
>> I've got an ARM board with 64MB of NAND flash with 3 logical partitions
>> and am experiencing (probably) memory corruption of UBI/UBIFS on
>> /dev/mtd2 after writing data with nandwrite to /dev/mtd1.
>> [...]
>> s3c2410-nand s3c2410-nand: clock idle support enabled
> 
> hmm, could you try disabling the clock-idle support?

How do I do that?

Michal

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

* Re: nandwrite/ubi memory corruption?
  2008-10-16 21:43   ` Michal Ludvig
@ 2008-10-16 21:56     ` Ben Dooks
  2008-10-16 23:01       ` Michal Ludvig
  2008-10-17 11:03       ` Artem Bityutskiy
  0 siblings, 2 replies; 16+ messages in thread
From: Ben Dooks @ 2008-10-16 21:56 UTC (permalink / raw)
  To: Michal Ludvig; +Cc: linux-mtd, Ben Dooks

On Fri, Oct 17, 2008 at 10:43:57AM +1300, Michal Ludvig wrote:
> Ben Dooks wrote:
> > On Thu, Oct 16, 2008 at 11:10:29PM +1300, Michal Ludvig wrote:
> >> Hi all,
> >>
> >> I've got an ARM board with 64MB of NAND flash with 3 logical partitions
> >> and am experiencing (probably) memory corruption of UBI/UBIFS on
> >> /dev/mtd2 after writing data with nandwrite to /dev/mtd1.
> >> [...]
> >> s3c2410-nand s3c2410-nand: clock idle support enabled
> > 
> > hmm, could you try disabling the clock-idle support?
> 
> How do I do that?

there should be a Kconfig entry to do it when the s3c2410 nand driver
is selected.
 
> Michal

-- 
-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.

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

* Re: nandwrite/ubi memory corruption?
  2008-10-16 14:56   ` Artem Bityutskiy
@ 2008-10-16 22:10     ` Michal Ludvig
  2008-10-17 11:02       ` Artem Bityutskiy
  2008-10-17 12:06       ` Artem Bityutskiy
  0 siblings, 2 replies; 16+ messages in thread
From: Michal Ludvig @ 2008-10-16 22:10 UTC (permalink / raw)
  To: dedekind; +Cc: linux-mtd

Artem Bityutskiy wrote:
> On Thu, 2008-10-16 at 17:49 +0300, Artem Bityutskiy wrote:
>> On Thu, 2008-10-16 at 23:10 +1300, Michal Ludvig wrote:
>>> Hi all,
>>>
>>> I've got an ARM board with 64MB of NAND flash with 3 logical partitions
>>> and am experiencing (probably) memory corruption of UBI/UBIFS on
>>> /dev/mtd2 after writing data with nandwrite to /dev/mtd1.
>>>
>>> These are my logical partitions on NAND:
>>> [...]
>>>
>>> ~ # ls
>>> UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB
>>> 2414:15360, written 0 bytes
>>> UBI warning: ubi_eba_write_leb: failed to write data to PEB 2414
>>> UBI: recover PEB 2414, move data to PEB 2428
>>> UBI warning: ubi_io_read_vid_hdr: bad magic number at PEB 2414: 00000000
>>> instead of 55424921
>>> UBI warning: ubi_ro_mode: switch to read-only mode
>>> UBIFS error (pid 224): ubifs_wbuf_sync_nolock: cannot write 512 bytes to
>>> LEB 746:14336
>>> UBIFS error (pid 224): ubifs_bg_wbufs_sync: cannot sync write-buffer,
>>> error -5
>>> UBIFS warning (pid 224): ubifs_ro_mode: switched to read-only mode, error -5
>> Could you please try ubiformat instead of nandwrite? 

~ # ubiformat /dev/mtd1 -v
ubiformat: mtd1 (NAND), size 1900544 bytes (1.8 MiB), 16384 eraseblocks
of 16384 bytes (16.0 KiB), min. I/O size 512 bytes
libscan: start scanning eraseblocks 0-116
libscan: scanning eraseblock 0: alien
libscan: scanning eraseblock 1: alien
[...]
libscan: scanning eraseblock 90: alien
libscan: scanning eraseblock 91: alien
libscan: scanning eraseblock 92: empty
libscan: scanning eraseblock 93: empty


[...]
libscan: scanning eraseblock 115: empty
libscan: finished, mean EC 0, 0 OK, 0 corrupted, 24 empty, 92 alien, bad 0
ubiformat: 24 eraseblocks are supposedly empty
ubiformat: warning!: 92 of 116 eraseblocks contain non-ubifs data
ubiformat: continue? (yes/no)  yes
ubiformat: warning!: only 0 of 116 eraseblocks have valid erase counter
ubiformat: erase counter 0 will be used for all eraseblocks
ubiformat: note, arbitrary erase counter value may be specified using -e
option
ubiformat: continue? (yes/no)  yes
ubiformat: use erase counter 0 for all eraseblocks
ubiformat: eraseblock 0: erase, do not write EC, leave for vtbl
ubiformat: eraseblock 1: erase, do not write EC, leave for vtbl
ubiformat: eraseblock 2: erase, write EC 0
ubiformat: eraseblock 3: erase, write EC 0


[...]
ubiformat: eraseblock 115: erase, write EC 0
ubiformat: write volume table to eraseblocks 0 and 1
~ #

Nothing was apparently broken after ubiformat, system kept running
smoothly. But I can't use ubiformat for writing kernel image, can I?

Is there any other way to write raw kernel image to /dev/mtd1 other than
using nandwrite?

> Also, please, give me your page and sub-page size. 

UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size:   16384 bytes (16 KiB)
UBI: logical eraseblock size:    15360 bytes
UBI: smallest flash I/O unit:    512
UBI: VID header offset:          512 (aligned 512)
UBI: data offset:                1024
UBI: attached mtd2 to ubi0
UBI: MTD device name:            "ubi"
UBI: MTD device size:            61 MiB
UBI: number of good PEBs:        3960
UBI: number of bad PEBs:         0
UBI: max. allowed volumes:       89
UBI: wear-leveling threshold:    256
UBI: number of internal volumes: 1
UBI: number of user volumes:     1
UBI: available PEBs:             2054
UBI: total number of reserved PEBs: 1906
UBI: number of PEBs reserved for bad PEB handling: 195
UBI: max/mean erase counter: 4/0

Michal

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

* Re: nandwrite/ubi memory corruption?
  2008-10-16 21:56     ` Ben Dooks
@ 2008-10-16 23:01       ` Michal Ludvig
  2008-10-17  2:06         ` Michal Ludvig
  2008-10-17 11:03       ` Artem Bityutskiy
  1 sibling, 1 reply; 16+ messages in thread
From: Michal Ludvig @ 2008-10-16 23:01 UTC (permalink / raw)
  To: Ben Dooks; +Cc: linux-mtd

Ben Dooks wrote:
> On Fri, Oct 17, 2008 at 10:43:57AM +1300, Michal Ludvig wrote:
>> Ben Dooks wrote:
>>> On Thu, Oct 16, 2008 at 11:10:29PM +1300, Michal Ludvig wrote:
>>>> Hi all,
>>>>
>>>> I've got an ARM board with 64MB of NAND flash with 3 logical partitions
>>>> and am experiencing (probably) memory corruption of UBI/UBIFS on
>>>> /dev/mtd2 after writing data with nandwrite to /dev/mtd1.
>>>> [...]
>>>> s3c2410-nand s3c2410-nand: clock idle support enabled
>>> hmm, could you try disabling the clock-idle support?
>> How do I do that?
> 
> there should be a Kconfig entry to do it when the s3c2410 nand driver
> is selected.

Ah, I see. OK, with clock-idle off nandwrite didn't corrupt ubi/ubifs
but the kernel still wouldn't boot:

NAND Flash Reading
dst base address          = 0x30100000
Source start block number = 20
Source size  (0x4000*n)   = 0x180000
status 1
## Booting image at 30100000 ...
Bad Magic Number
status -1
u-boot>

Michal

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

* Re: nandwrite/ubi memory corruption?
  2008-10-16 23:01       ` Michal Ludvig
@ 2008-10-17  2:06         ` Michal Ludvig
  0 siblings, 0 replies; 16+ messages in thread
From: Michal Ludvig @ 2008-10-17  2:06 UTC (permalink / raw)
  To: Ben Dooks; +Cc: linux-mtd

Michal Ludvig wrote:
> Ben Dooks wrote:
>> On Fri, Oct 17, 2008 at 10:43:57AM +1300, Michal Ludvig wrote:
>>> Ben Dooks wrote:
>>>> On Thu, Oct 16, 2008 at 11:10:29PM +1300, Michal Ludvig wrote:
>>>>> Hi all,
>>>>>
>>>>> I've got an ARM board with 64MB of NAND flash with 3 logical partitions
>>>>> and am experiencing (probably) memory corruption of UBI/UBIFS on
>>>>> /dev/mtd2 after writing data with nandwrite to /dev/mtd1.
>>>>> [...]
>>>>> s3c2410-nand s3c2410-nand: clock idle support enabled
>>>> hmm, could you try disabling the clock-idle support?
>>> How do I do that?
>> there should be a Kconfig entry to do it when the s3c2410 nand driver
>> is selected.
> 
> Ah, I see. OK, with clock-idle off nandwrite didn't corrupt ubi/ubifs
> but the kernel still wouldn't boot:

It looks like if nandwrite writes some nonsense onto the flash.

I did:
~ # nanddump -o -b -f dump.pre-nandwrite /dev/mtd1
~ # nandwrite -p /dev/mtd1 uimage26
~ # nanddump -o -b -f dump.post-nandwrite /dev/mtd1

dump.post-nandwrite is different from dump.pre-nandwrite but doesn't
seem to have much in common with uimage26.

OTOH dump.pre-nandwrite contains the kernel image that has been stored
by u-boot's nandw. So the /dev/mtd1 offset is probably OK.

Any ideas on what's wrong?

Michal

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

* Re: nandwrite/ubi memory corruption?
  2008-10-16 22:10     ` Michal Ludvig
@ 2008-10-17 11:02       ` Artem Bityutskiy
  2008-10-17 12:09         ` Artem Bityutskiy
  2008-10-17 12:06       ` Artem Bityutskiy
  1 sibling, 1 reply; 16+ messages in thread
From: Artem Bityutskiy @ 2008-10-17 11:02 UTC (permalink / raw)
  To: Michal Ludvig; +Cc: linux-mtd

On Fri, 2008-10-17 at 11:10 +1300, Michal Ludvig wrote:
> Nothing was apparently broken after ubiformat, system kept running
> smoothly. But I can't use ubiformat for writing kernel image, can I?

No, but I do not think it would be very difficult to add this
functionality.

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

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

* Re: nandwrite/ubi memory corruption?
  2008-10-16 21:56     ` Ben Dooks
  2008-10-16 23:01       ` Michal Ludvig
@ 2008-10-17 11:03       ` Artem Bityutskiy
  2008-10-17 13:42         ` Ben Dooks
  1 sibling, 1 reply; 16+ messages in thread
From: Artem Bityutskiy @ 2008-10-17 11:03 UTC (permalink / raw)
  To: Ben Dooks; +Cc: linux-mtd, Michal Ludvig

On Thu, 2008-10-16 at 22:56 +0100, Ben Dooks wrote:
> there should be a Kconfig entry to do it when the s3c2410 nand driver
> is selected.

Ben,

is that right that s3c2410-nand does not support sub-pages?

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

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

* Re: nandwrite/ubi memory corruption?
  2008-10-16 22:10     ` Michal Ludvig
  2008-10-17 11:02       ` Artem Bityutskiy
@ 2008-10-17 12:06       ` Artem Bityutskiy
  1 sibling, 0 replies; 16+ messages in thread
From: Artem Bityutskiy @ 2008-10-17 12:06 UTC (permalink / raw)
  To: Michal Ludvig; +Cc: linux-mtd

On Fri, 2008-10-17 at 11:10 +1300, Michal Ludvig wrote:
> Nothing was apparently broken after ubiformat, system kept running
> smoothly. But I can't use ubiformat for writing kernel image, can I?
> 
> Is there any other way to write raw kernel image to /dev/mtd1 other than
> using nandwrite?

Using nandwrite for UBI is bad by definition because you loose your
erase-counters and screw up wear-leveling.

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

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

* Re: nandwrite/ubi memory corruption?
  2008-10-17 11:02       ` Artem Bityutskiy
@ 2008-10-17 12:09         ` Artem Bityutskiy
  2008-10-18 20:34           ` Michal Ludvig
  0 siblings, 1 reply; 16+ messages in thread
From: Artem Bityutskiy @ 2008-10-17 12:09 UTC (permalink / raw)
  To: Michal Ludvig; +Cc: linux-mtd

On Fri, 2008-10-17 at 14:02 +0300, Artem Bityutskiy wrote:
> On Fri, 2008-10-17 at 11:10 +1300, Michal Ludvig wrote:
> > Nothing was apparently broken after ubiformat, system kept running
> > smoothly. But I can't use ubiformat for writing kernel image, can I?
> 
> No, but I do not think it would be very difficult to add this
> functionality.

Wait. Sorry, your kernel sit in different partition and that partition
is not UBI. This means ubiformat will not help you and you should use
nandwrite. Just debug nandwrite and fix it.

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

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

* Re: nandwrite/ubi memory corruption?
  2008-10-17 11:03       ` Artem Bityutskiy
@ 2008-10-17 13:42         ` Ben Dooks
  2008-10-17 13:44           ` Artem Bityutskiy
  0 siblings, 1 reply; 16+ messages in thread
From: Ben Dooks @ 2008-10-17 13:42 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: linux-mtd, Michal Ludvig, Ben Dooks

On Fri, Oct 17, 2008 at 02:03:54PM +0300, Artem Bityutskiy wrote:
> On Thu, 2008-10-16 at 22:56 +0100, Ben Dooks wrote:
> > there should be a Kconfig entry to do it when the s3c2410 nand driver
> > is selected.
> 
> Ben,
> 
> is that right that s3c2410-nand does not support sub-pages?

do you mean reads from non-page aligned addresses? currently a whole
page must be read/written to allow the hardware ecc unit to function
properly.

-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.

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

* Re: nandwrite/ubi memory corruption?
  2008-10-17 13:42         ` Ben Dooks
@ 2008-10-17 13:44           ` Artem Bityutskiy
  0 siblings, 0 replies; 16+ messages in thread
From: Artem Bityutskiy @ 2008-10-17 13:44 UTC (permalink / raw)
  To: Ben Dooks; +Cc: linux-mtd, Michal Ludvig

On Fri, 2008-10-17 at 14:42 +0100, Ben Dooks wrote:
> On Fri, Oct 17, 2008 at 02:03:54PM +0300, Artem Bityutskiy wrote:
> > On Thu, 2008-10-16 at 22:56 +0100, Ben Dooks wrote:
> > > there should be a Kconfig entry to do it when the s3c2410 nand driver
> > > is selected.
> > 
> > Ben,
> > 
> > is that right that s3c2410-nand does not support sub-pages?
> 
> do you mean reads from non-page aligned addresses?

I meant the ability to do two 256-byte writes to NAND pages, instead of
only one 512-byte write. 

>  currently a whole
> page must be read/written to allow the hardware ecc unit to function
> properly.

OK, thanks.

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

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

* Re: nandwrite/ubi memory corruption?
  2008-10-17 12:09         ` Artem Bityutskiy
@ 2008-10-18 20:34           ` Michal Ludvig
  0 siblings, 0 replies; 16+ messages in thread
From: Michal Ludvig @ 2008-10-18 20:34 UTC (permalink / raw)
  To: dedekind; +Cc: linux-mtd

Artem Bityutskiy wrote:
> On Fri, 2008-10-17 at 14:02 +0300, Artem Bityutskiy wrote:
>> On Fri, 2008-10-17 at 11:10 +1300, Michal Ludvig wrote:
>>> Nothing was apparently broken after ubiformat, system kept running
>>> smoothly. But I can't use ubiformat for writing kernel image, can I?
>> No, but I do not think it would be very difficult to add this
>> functionality.
> 
> Wait. Sorry, your kernel sit in different partition and that partition
> is not UBI. [...] Just debug nandwrite and fix it.

Just that? Easy ;-)
I'll have a look at it but as I don't know much about the whole flash /
mtd interface it may be a bit of challenge.

Michal

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

end of thread, other threads:[~2008-10-18 20:33 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-16 10:10 nandwrite/ubi memory corruption? Michal Ludvig
2008-10-16 14:49 ` Artem Bityutskiy
2008-10-16 14:56   ` Artem Bityutskiy
2008-10-16 22:10     ` Michal Ludvig
2008-10-17 11:02       ` Artem Bityutskiy
2008-10-17 12:09         ` Artem Bityutskiy
2008-10-18 20:34           ` Michal Ludvig
2008-10-17 12:06       ` Artem Bityutskiy
2008-10-16 15:01 ` Ben Dooks
2008-10-16 21:43   ` Michal Ludvig
2008-10-16 21:56     ` Ben Dooks
2008-10-16 23:01       ` Michal Ludvig
2008-10-17  2:06         ` Michal Ludvig
2008-10-17 11:03       ` Artem Bityutskiy
2008-10-17 13:42         ` Ben Dooks
2008-10-17 13:44           ` Artem Bityutskiy

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