public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] ubi part failing on NAND
@ 2009-12-17 21:09 Jeff Angielski
  2009-12-18  8:16 ` Stefan Roese
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff Angielski @ 2009-12-17 21:09 UTC (permalink / raw)
  To: u-boot


The "ubi part" command is failing for me on my PowerPC 85xx board.  I am 
not trying to do anything special, just create the partitions and 
volumes so that I can try writing an ubi.img.  It spits out enough 
information that it looks like it did work but it prints out an error 
nonetheless.

And of course there is the long standing issue of the reported MTD 
number not making any sense.  But previous posts have discounted this as 
an issue.

Here is the snippet of the error:

UBI error: ubi_init: cannot attach mtd2
UBI: mtd2 is detached from ubi0
UBI error: ubi_init: UBI error: cannot initialize UBI, error -17
UBI init error -17


Here is a cleaned up version of the session log:

=> mtdparts

device nor0 <f8000000.nor>, # parts = 8
  #: name                size            offset          mask_flags
  0: config              0x00020000      0x00000000      0
  1: kernel              0x00260000      0x00020000      0
  2: fdt                 0x00020000      0x00280000      0
  3: tinyfs              0x00600000      0x002a0000      0
  4: rootfs              0x076a0000      0x008a0000      0
  5: u-boot-env-r        0x00020000      0x07f40000      1
  6: u-boot-env          0x00020000      0x07f60000      1
  7: u-boot              0x00080000      0x07f80000      1

device nand0 <f4000000.nand>, # parts = 2
  #: name                size            offset          mask_flags
  0: fs1                 0x20000000      0x00000000      0
  1: fs2                 0x20000000      0x20000000      0

=> nand erase 0x0 0x40000000

NAND erase: device 0 whole chip
Skipping bad block at  0x01200000
Skipping bad block at  0x0e880000
Skipping bad block at  0x1cd80000
Skipping bad block at  0x2b300000
Skipping bad block at  0x323c0000
Skipping bad block at  0x364c0000
Skipping bad block at  0x37cc0000
Erasing at 0x3ffc0000 -- 100% complete.
OK

=> ubi part fs1
Creating 1 MTD partitions on "nand0":
0x000000000000-0x000020000000 : "mtd=0"
UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size:   262144 bytes (256 KiB)
UBI: logical eraseblock size:    253952 bytes
UBI: smallest flash I/O unit:    4096
UBI: VID header offset:          4096 (aligned 4096)
UBI: data offset:                8192
UBI: empty MTD device detected
UBI: create volume table (copy #1)
UBI: create volume table (copy #2)
UBI: attached mtd2 to ubi0
UBI: MTD device name:            "mtd=0"
UBI: MTD device size:            512 MiB
UBI: number of good PEBs:        2045
UBI: number of bad PEBs:         3
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     0
UBI: available PEBs:             2021
UBI: total number of reserved PEBs: 24
UBI: number of PEBs reserved for bad PEB handling: 20
UBI: max/mean erase counter: 0/0
UBI error: ubi_init: cannot attach mtd2
UBI: mtd2 is detached from ubi0
UBI error: ubi_init: UBI error: cannot initialize UBI, error -17
UBI init error -17
exit not allowed from main input shell.


My last sync with the denx git was when 2.6.31 was released.  Here is my 
version:
=> ver

U-Boot 2009.08-00213-gfdf80f7 (Dec 17 2009 - 12:57:07)



Jeff Angielski
The PTR Group
www.theptrgroup.com

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

* [U-Boot] ubi part failing on NAND
  2009-12-17 21:09 [U-Boot] ubi part failing on NAND Jeff Angielski
@ 2009-12-18  8:16 ` Stefan Roese
  2009-12-18 12:35   ` hedwin
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Roese @ 2009-12-18  8:16 UTC (permalink / raw)
  To: u-boot

Jeff,

On Thursday 17 December 2009 22:09:03 Jeff Angielski wrote:
> The "ubi part" command is failing for me on my PowerPC 85xx board.  I am
> not trying to do anything special, just create the partitions and
> volumes so that I can try writing an ubi.img.  It spits out enough
> information that it looks like it did work but it prints out an error
> nonetheless.
> 
> And of course there is the long standing issue of the reported MTD
> number not making any sense.  But previous posts have discounted this as
> an issue.

Patches to fix/change this are welcome. :)
 
> Here is the snippet of the error:
> 
> UBI error: ubi_init: cannot attach mtd2
> UBI: mtd2 is detached from ubi0
> UBI error: ubi_init: UBI error: cannot initialize UBI, error -17
> UBI init error -17

-17 == EEXIST. Looking at the code (build.c) shows that ubi_attach_mtd_dev() 
is returning this error code in case the MTD device is already attached. Even 
though the UBI implementation should handle this without any problems. I have 
to admit that I'm a bit out of ideas what's going wrong in your case. I just 
checked again and UBI works fine for me with the latest version:


=> mtdparts                      

device nand0 <nand>, # parts = 3
 #: name                size            offset          mask_flags
 0: bootloader          0x00100000      0x00000000      0         
 1: rootfs              0x01000000      0x00100000      0         
 2: ubifs               0x02f00000      0x01100000      0         

active partition: nand0,0 - (bootloader) 0x00100000 @ 0x00000000

defaults:
mtdids  : nand0=nand
mtdparts: mtdparts=nand:1m(bootloader),16m(rootfs),-(ubifs)
=> nand erase 1100000 2f00000                              

NAND erase: device 0 offset 0x1100000, size 0x2f00000
Erasing at 0x3ffc000 -- 100% complete.               
OK                                                   
=> ubi part ubifs                                    
Creating 1 MTD partitions on "nand0":                
0x000001100000-0x000004000000 : "mtd=2"              
UBI: attaching mtd1 to ubi0                          
UBI: physical eraseblock size:   16384 bytes (16 KiB)
UBI: logical eraseblock size:    15872 bytes         
UBI: smallest flash I/O unit:    512                 
UBI: sub-page size:              256                 
UBI: VID header offset:          256 (aligned 256)   
UBI: data offset:                512                 
UBI: empty MTD device detected                       
UBI: create volume table (copy #1)                   
UBI: create volume table (copy #2)                   
UBI: attached mtd1 to ubi0                           
UBI: MTD device name:            "mtd=2"             
UBI: MTD device size:            47 MiB              
UBI: number of good PEBs:        3008                
UBI: number of bad PEBs:         0                   
UBI: max. allowed volumes:       92                  
UBI: wear-leveling threshold:    4096                
UBI: number of internal volumes: 1                   
UBI: number of user volumes:     0                   
UBI: available PEBs:             2974                
UBI: total number of reserved PEBs: 34               
UBI: number of PEBs reserved for bad PEB handling: 30
UBI: max/mean erase counter: 0/0                     
=> mtdparts                                          

device nand0 <nand>, # parts = 3
 #: name                size            offset          mask_flags
 0: bootloader          0x00100000      0x00000000      0         
 1: rootfs              0x01000000      0x00100000      0         
 2: ubifs               0x02f00000      0x01100000      0         

active partition: nand0,0 - (bootloader) 0x00100000 @ 0x00000000

defaults:
mtdids  : nand0=nand
mtdparts: mtdparts=nand:1m(bootloader),16m(rootfs),-(ubifs)
=> nand erase 100000 1000000                               

NAND erase: device 0 offset 0x100000, size 0x1000000
Erasing at 0x10fc000 -- 100% complete.
OK
=> ubi part rootfs
UBI: mtd1 is detached from ubi0
Creating 1 MTD partitions on "nand0":
0x000000100000-0x000001100000 : "mtd=1"
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size:   16384 bytes (16 KiB)
UBI: logical eraseblock size:    15872 bytes
UBI: smallest flash I/O unit:    512
UBI: sub-page size:              256
UBI: VID header offset:          256 (aligned 256)
UBI: data offset:                512
UBI: empty MTD device detected
UBI: create volume table (copy #1)
UBI: create volume table (copy #2)
UBI: attached mtd1 to ubi0
UBI: MTD device name:            "mtd=1"
UBI: MTD device size:            16 MiB
UBI: number of good PEBs:        1024
UBI: number of bad PEBs:         0
UBI: max. allowed volumes:       92
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     0
UBI: available PEBs:             1010
UBI: total number of reserved PEBs: 14
UBI: number of PEBs reserved for bad PEB handling: 10
UBI: max/mean erase counter: 0/0
=>


Perhaps you should try the latest version as well. Could be that this is a bug 
already fixed now. Otherwise you need to debug this problem yourself, since I 
can't reproduce it here.

Cheers,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

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

* [U-Boot] ubi part failing on NAND
  2009-12-18  8:16 ` Stefan Roese
@ 2009-12-18 12:35   ` hedwin
  2009-12-18 12:41     ` Stefan Roese
  2009-12-18 14:47     ` Jeff Angielski
  0 siblings, 2 replies; 8+ messages in thread
From: hedwin @ 2009-12-18 12:35 UTC (permalink / raw)
  To: u-boot

Jeff, what is the size of your allocateble memory. Had to increase it to 4MB
to get it working.

On Fri, Dec 18, 2009 at 9:16 AM, Stefan Roese <sr@denx.de> wrote:
> Jeff,
>
> On Thursday 17 December 2009 22:09:03 Jeff Angielski wrote:
>> The "ubi part" command is failing for me on my PowerPC 85xx board. ?I am
>> not trying to do anything special, just create the partitions and
>> volumes so that I can try writing an ubi.img. ?It spits out enough
>> information that it looks like it did work but it prints out an error
>> nonetheless.
>>
>> And of course there is the long standing issue of the reported MTD
>> number not making any sense. ?But previous posts have discounted this as
>> an issue.
>
> Patches to fix/change this are welcome. :)
>
>> Here is the snippet of the error:
>>
>> UBI error: ubi_init: cannot attach mtd2
>> UBI: mtd2 is detached from ubi0
>> UBI error: ubi_init: UBI error: cannot initialize UBI, error -17
>> UBI init error -17
>
> -17 == EEXIST. Looking at the code (build.c) shows that ubi_attach_mtd_dev()
> is returning this error code in case the MTD device is already attached. Even
> though the UBI implementation should handle this without any problems. I have
> to admit that I'm a bit out of ideas what's going wrong in your case. I just
> checked again and UBI works fine for me with the latest version:
>
>
> => mtdparts
>
> device nand0 <nand>, # parts = 3
> ?#: name ? ? ? ? ? ? ? ?size ? ? ? ? ? ?offset ? ? ? ? ?mask_flags
> ?0: bootloader ? ? ? ? ?0x00100000 ? ? ?0x00000000 ? ? ?0
> ?1: rootfs ? ? ? ? ? ? ?0x01000000 ? ? ?0x00100000 ? ? ?0
> ?2: ubifs ? ? ? ? ? ? ? 0x02f00000 ? ? ?0x01100000 ? ? ?0
>
> active partition: nand0,0 - (bootloader) 0x00100000 @ 0x00000000
>
> defaults:
> mtdids ?: nand0=nand
> mtdparts: mtdparts=nand:1m(bootloader),16m(rootfs),-(ubifs)
> => nand erase 1100000 2f00000
>
> NAND erase: device 0 offset 0x1100000, size 0x2f00000
> Erasing at 0x3ffc000 -- 100% complete.
> OK
> => ubi part ubifs
> Creating 1 MTD partitions on "nand0":
> 0x000001100000-0x000004000000 : "mtd=2"
> UBI: attaching mtd1 to ubi0
> UBI: physical eraseblock size: ? 16384 bytes (16 KiB)
> UBI: logical eraseblock size: ? ?15872 bytes
> UBI: smallest flash I/O unit: ? ?512
> UBI: sub-page size: ? ? ? ? ? ? ?256
> UBI: VID header offset: ? ? ? ? ?256 (aligned 256)
> UBI: data offset: ? ? ? ? ? ? ? ?512
> UBI: empty MTD device detected
> UBI: create volume table (copy #1)
> UBI: create volume table (copy #2)
> UBI: attached mtd1 to ubi0
> UBI: MTD device name: ? ? ? ? ? ?"mtd=2"
> UBI: MTD device size: ? ? ? ? ? ?47 MiB
> UBI: number of good PEBs: ? ? ? ?3008
> UBI: number of bad PEBs: ? ? ? ? 0
> UBI: max. allowed volumes: ? ? ? 92
> UBI: wear-leveling threshold: ? ?4096
> UBI: number of internal volumes: 1
> UBI: number of user volumes: ? ? 0
> UBI: available PEBs: ? ? ? ? ? ? 2974
> UBI: total number of reserved PEBs: 34
> UBI: number of PEBs reserved for bad PEB handling: 30
> UBI: max/mean erase counter: 0/0
> => mtdparts
>
> device nand0 <nand>, # parts = 3
> ?#: name ? ? ? ? ? ? ? ?size ? ? ? ? ? ?offset ? ? ? ? ?mask_flags
> ?0: bootloader ? ? ? ? ?0x00100000 ? ? ?0x00000000 ? ? ?0
> ?1: rootfs ? ? ? ? ? ? ?0x01000000 ? ? ?0x00100000 ? ? ?0
> ?2: ubifs ? ? ? ? ? ? ? 0x02f00000 ? ? ?0x01100000 ? ? ?0
>
> active partition: nand0,0 - (bootloader) 0x00100000 @ 0x00000000
>
> defaults:
> mtdids ?: nand0=nand
> mtdparts: mtdparts=nand:1m(bootloader),16m(rootfs),-(ubifs)
> => nand erase 100000 1000000
>
> NAND erase: device 0 offset 0x100000, size 0x1000000
> Erasing at 0x10fc000 -- 100% complete.
> OK
> => ubi part rootfs
> UBI: mtd1 is detached from ubi0
> Creating 1 MTD partitions on "nand0":
> 0x000000100000-0x000001100000 : "mtd=1"
> UBI: attaching mtd1 to ubi0
> UBI: physical eraseblock size: ? 16384 bytes (16 KiB)
> UBI: logical eraseblock size: ? ?15872 bytes
> UBI: smallest flash I/O unit: ? ?512
> UBI: sub-page size: ? ? ? ? ? ? ?256
> UBI: VID header offset: ? ? ? ? ?256 (aligned 256)
> UBI: data offset: ? ? ? ? ? ? ? ?512
> UBI: empty MTD device detected
> UBI: create volume table (copy #1)
> UBI: create volume table (copy #2)
> UBI: attached mtd1 to ubi0
> UBI: MTD device name: ? ? ? ? ? ?"mtd=1"
> UBI: MTD device size: ? ? ? ? ? ?16 MiB
> UBI: number of good PEBs: ? ? ? ?1024
> UBI: number of bad PEBs: ? ? ? ? 0
> UBI: max. allowed volumes: ? ? ? 92
> UBI: wear-leveling threshold: ? ?4096
> UBI: number of internal volumes: 1
> UBI: number of user volumes: ? ? 0
> UBI: available PEBs: ? ? ? ? ? ? 1010
> UBI: total number of reserved PEBs: 14
> UBI: number of PEBs reserved for bad PEB handling: 10
> UBI: max/mean erase counter: 0/0
> =>
>
>
> Perhaps you should try the latest version as well. Could be that this is a bug
> already fixed now. Otherwise you need to debug this problem yourself, since I
> can't reproduce it here.
>
> Cheers,
> Stefan
>
> --
> DENX Software Engineering GmbH, ? ? ?MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, ?Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>

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

* [U-Boot] ubi part failing on NAND
  2009-12-18 12:35   ` hedwin
@ 2009-12-18 12:41     ` Stefan Roese
  2009-12-18 15:07       ` Jeff Angielski
  2009-12-18 14:47     ` Jeff Angielski
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan Roese @ 2009-12-18 12:41 UTC (permalink / raw)
  To: u-boot

On Friday 18 December 2009 13:35:26 hedwin wrote:
> Jeff, what is the size of your allocateble memory. Had to increase it to
>  4MB to get it working.

I've got 1MByte for my test on Kilauea. This should be enough. There
is already a compile-time check in the UBI code:


#if (CONFIG_SYS_MALLOC_LEN < (512 << 10))
#error Malloc area too small for UBI, increase CONFIG_SYS_MALLOC_LEN to >= 512k
#endif

Please let me know if this really is not enough. But for me, 1MB is working.
 
Cheers,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

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

* [U-Boot] ubi part failing on NAND
  2009-12-18 12:35   ` hedwin
  2009-12-18 12:41     ` Stefan Roese
@ 2009-12-18 14:47     ` Jeff Angielski
  1 sibling, 0 replies; 8+ messages in thread
From: Jeff Angielski @ 2009-12-18 14:47 UTC (permalink / raw)
  To: u-boot

hedwin wrote:
> Jeff, what is the size of your allocateble memory. Had to increase it to 4MB
> to get it working.

#define CONFIG_SYS_MALLOC_LEN		(1024 * 1024)

I'll try increasing it to see if that helps.

> 
> On Fri, Dec 18, 2009 at 9:16 AM, Stefan Roese <sr@denx.de> wrote:
>> Jeff,
>>
>> On Thursday 17 December 2009 22:09:03 Jeff Angielski wrote:
>>> The "ubi part" command is failing for me on my PowerPC 85xx board.  I am
>>> not trying to do anything special, just create the partitions and
>>> volumes so that I can try writing an ubi.img.  It spits out enough
>>> information that it looks like it did work but it prints out an error
>>> nonetheless.
>>>
>>> And of course there is the long standing issue of the reported MTD
>>> number not making any sense.  But previous posts have discounted this as
>>> an issue.
>> Patches to fix/change this are welcome. :)
>>
>>> Here is the snippet of the error:
>>>
>>> UBI error: ubi_init: cannot attach mtd2
>>> UBI: mtd2 is detached from ubi0
>>> UBI error: ubi_init: UBI error: cannot initialize UBI, error -17
>>> UBI init error -17
>> -17 == EEXIST. Looking at the code (build.c) shows that ubi_attach_mtd_dev()
>> is returning this error code in case the MTD device is already attached. Even
>> though the UBI implementation should handle this without any problems. I have
>> to admit that I'm a bit out of ideas what's going wrong in your case. I just
>> checked again and UBI works fine for me with the latest version:
>>
>>
>> => mtdparts
>>
>> device nand0 <nand>, # parts = 3
>>  #: name                size            offset          mask_flags
>>  0: bootloader          0x00100000      0x00000000      0
>>  1: rootfs              0x01000000      0x00100000      0
>>  2: ubifs               0x02f00000      0x01100000      0
>>
>> active partition: nand0,0 - (bootloader) 0x00100000 @ 0x00000000
>>
>> defaults:
>> mtdids  : nand0=nand
>> mtdparts: mtdparts=nand:1m(bootloader),16m(rootfs),-(ubifs)
>> => nand erase 1100000 2f00000
>>
>> NAND erase: device 0 offset 0x1100000, size 0x2f00000
>> Erasing at 0x3ffc000 -- 100% complete.
>> OK
>> => ubi part ubifs
>> Creating 1 MTD partitions on "nand0":
>> 0x000001100000-0x000004000000 : "mtd=2"
>> UBI: attaching mtd1 to ubi0
>> UBI: physical eraseblock size:   16384 bytes (16 KiB)
>> UBI: logical eraseblock size:    15872 bytes
>> UBI: smallest flash I/O unit:    512
>> UBI: sub-page size:              256
>> UBI: VID header offset:          256 (aligned 256)
>> UBI: data offset:                512
>> UBI: empty MTD device detected
>> UBI: create volume table (copy #1)
>> UBI: create volume table (copy #2)
>> UBI: attached mtd1 to ubi0
>> UBI: MTD device name:            "mtd=2"
>> UBI: MTD device size:            47 MiB
>> UBI: number of good PEBs:        3008
>> UBI: number of bad PEBs:         0
>> UBI: max. allowed volumes:       92
>> UBI: wear-leveling threshold:    4096
>> UBI: number of internal volumes: 1
>> UBI: number of user volumes:     0
>> UBI: available PEBs:             2974
>> UBI: total number of reserved PEBs: 34
>> UBI: number of PEBs reserved for bad PEB handling: 30
>> UBI: max/mean erase counter: 0/0
>> => mtdparts
>>
>> device nand0 <nand>, # parts = 3
>>  #: name                size            offset          mask_flags
>>  0: bootloader          0x00100000      0x00000000      0
>>  1: rootfs              0x01000000      0x00100000      0
>>  2: ubifs               0x02f00000      0x01100000      0
>>
>> active partition: nand0,0 - (bootloader) 0x00100000 @ 0x00000000
>>
>> defaults:
>> mtdids  : nand0=nand
>> mtdparts: mtdparts=nand:1m(bootloader),16m(rootfs),-(ubifs)
>> => nand erase 100000 1000000
>>
>> NAND erase: device 0 offset 0x100000, size 0x1000000
>> Erasing at 0x10fc000 -- 100% complete.
>> OK
>> => ubi part rootfs
>> UBI: mtd1 is detached from ubi0
>> Creating 1 MTD partitions on "nand0":
>> 0x000000100000-0x000001100000 : "mtd=1"
>> UBI: attaching mtd1 to ubi0
>> UBI: physical eraseblock size:   16384 bytes (16 KiB)
>> UBI: logical eraseblock size:    15872 bytes
>> UBI: smallest flash I/O unit:    512
>> UBI: sub-page size:              256
>> UBI: VID header offset:          256 (aligned 256)
>> UBI: data offset:                512
>> UBI: empty MTD device detected
>> UBI: create volume table (copy #1)
>> UBI: create volume table (copy #2)
>> UBI: attached mtd1 to ubi0
>> UBI: MTD device name:            "mtd=1"
>> UBI: MTD device size:            16 MiB
>> UBI: number of good PEBs:        1024
>> UBI: number of bad PEBs:         0
>> UBI: max. allowed volumes:       92
>> UBI: wear-leveling threshold:    4096
>> UBI: number of internal volumes: 1
>> UBI: number of user volumes:     0
>> UBI: available PEBs:             1010
>> UBI: total number of reserved PEBs: 14
>> UBI: number of PEBs reserved for bad PEB handling: 10
>> UBI: max/mean erase counter: 0/0
>> =>
>>
>>
>> Perhaps you should try the latest version as well. Could be that this is a bug
>> already fixed now. Otherwise you need to debug this problem yourself, since I
>> can't reproduce it here.
>>
>> Cheers,
>> Stefan
>>
>> --
>> DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
>> HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>> Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
>>
> 


-- 
Jeff Angielski
The PTR Group
www.theptrgroup.com

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

* [U-Boot] ubi part failing on NAND
  2009-12-18 12:41     ` Stefan Roese
@ 2009-12-18 15:07       ` Jeff Angielski
  2009-12-19 12:56         ` hedwin
  2009-12-21 10:02         ` Stefan Roese
  0 siblings, 2 replies; 8+ messages in thread
From: Jeff Angielski @ 2009-12-18 15:07 UTC (permalink / raw)
  To: u-boot

Stefan Roese wrote:
> On Friday 18 December 2009 13:35:26 hedwin wrote:
>> Jeff, what is the size of your allocateble memory. Had to increase it to
>>  4MB to get it working.
> 
> I've got 1MByte for my test on Kilauea. This should be enough. There
> is already a compile-time check in the UBI code:
> 
> 
> #if (CONFIG_SYS_MALLOC_LEN < (512 << 10))
> #error Malloc area too small for UBI, increase CONFIG_SYS_MALLOC_LEN to >= 512k
> #endif
> 
> Please let me know if this really is not enough. But for me, 1MB is working.

As per Hedwin's suggestion I increased my CONFIG_SYS_MALLOC_LEN to 4MB 
and the error disappeared.  Thanks Hedwin!  And now the UBI output 
matches my part (e.g. PEB size).


=> nand erase 0x0 0x40000000

=> ubi part fs1
Creating 1 MTD partitions on "nand0":
0x000000000000-0x000020000000 : "mtd=0"
UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size:   262144 bytes (256 KiB)
UBI: logical eraseblock size:    253952 bytes
UBI: smallest flash I/O unit:    4096
UBI: VID header offset:          4096 (aligned 4096)
UBI: data offset:                8192
UBI: empty MTD device detected
UBI: create volume table (copy #1)
UBI: create volume table (copy #2)
UBI: attached mtd2 to ubi0
UBI: MTD device name:            "mtd=0"
UBI: MTD device size:            512 MiB
UBI: number of good PEBs:        2045
UBI: number of bad PEBs:         3
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     0
UBI: available PEBs:             2021
UBI: total number of reserved PEBs: 24
UBI: number of PEBs reserved for bad PEB handling: 20
UBI: max/mean erase counter: 0/0
=>

-- 
Jeff Angielski
The PTR Group
www.theptrgroup.com

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

* [U-Boot] ubi part failing on NAND
  2009-12-18 15:07       ` Jeff Angielski
@ 2009-12-19 12:56         ` hedwin
  2009-12-21 10:02         ` Stefan Roese
  1 sibling, 0 replies; 8+ messages in thread
From: hedwin @ 2009-12-19 12:56 UTC (permalink / raw)
  To: u-boot

A bit on the reason why this amount of memory is needed.

I had the same problem jeff mentions. After tracing where dlmalloc
allocates its memory chunks I found out that it started allocating
memory in code space. Overwritting code space eventually resultated in
uboot crashing. Looking into dlmalloc I did not find any code that
checks whether it allocates memory outside its boundary.

Since I use a 2009.01 release I need to verify this against the latest release.

There is also another problem with ubi. If you repeat the following
statements more than once uboot also crashed.

nand erase /aPartition
ubi part nand /aPartition
ubi create aVolume

I did not check yet if this is also an allocation problem or something
totally different.

Hedwin


On Fri, Dec 18, 2009 at 4:07 PM, Jeff Angielski <jeff@theptrgroup.com> wrote:
> Stefan Roese wrote:
>>
>> On Friday 18 December 2009 13:35:26 hedwin wrote:
>>>
>>> Jeff, what is the size of your allocateble memory. Had to increase it to
>>> ?4MB to get it working.
>>
>> I've got 1MByte for my test on Kilauea. This should be enough. There
>> is already a compile-time check in the UBI code:
>>
>>
>> #if (CONFIG_SYS_MALLOC_LEN < (512 << 10))
>> #error Malloc area too small for UBI, increase CONFIG_SYS_MALLOC_LEN to >=
>> 512k
>> #endif
>>
>> Please let me know if this really is not enough. But for me, 1MB is
>> working.
>
> As per Hedwin's suggestion I increased my CONFIG_SYS_MALLOC_LEN to 4MB and
> the error disappeared. ?Thanks Hedwin! ?And now the UBI output matches my
> part (e.g. PEB size).
>
>
> => nand erase 0x0 0x40000000
>
> => ubi part fs1
> Creating 1 MTD partitions on "nand0":
> 0x000000000000-0x000020000000 : "mtd=0"
> UBI: attaching mtd2 to ubi0
> UBI: physical eraseblock size: ? 262144 bytes (256 KiB)
> UBI: logical eraseblock size: ? ?253952 bytes
> UBI: smallest flash I/O unit: ? ?4096
> UBI: VID header offset: ? ? ? ? ?4096 (aligned 4096)
> UBI: data offset: ? ? ? ? ? ? ? ?8192
> UBI: empty MTD device detected
> UBI: create volume table (copy #1)
> UBI: create volume table (copy #2)
> UBI: attached mtd2 to ubi0
> UBI: MTD device name: ? ? ? ? ? ?"mtd=0"
> UBI: MTD device size: ? ? ? ? ? ?512 MiB
> UBI: number of good PEBs: ? ? ? ?2045
> UBI: number of bad PEBs: ? ? ? ? 3
> UBI: max. allowed volumes: ? ? ? 128
> UBI: wear-leveling threshold: ? ?4096
> UBI: number of internal volumes: 1
> UBI: number of user volumes: ? ? 0
> UBI: available PEBs: ? ? ? ? ? ? 2021
> UBI: total number of reserved PEBs: 24
> UBI: number of PEBs reserved for bad PEB handling: 20
> UBI: max/mean erase counter: 0/0
> =>
>
> --
> Jeff Angielski
> The PTR Group
> www.theptrgroup.com
>

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

* [U-Boot] ubi part failing on NAND
  2009-12-18 15:07       ` Jeff Angielski
  2009-12-19 12:56         ` hedwin
@ 2009-12-21 10:02         ` Stefan Roese
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Roese @ 2009-12-21 10:02 UTC (permalink / raw)
  To: u-boot

On Friday 18 December 2009 16:07:40 Jeff Angielski wrote:
> Stefan Roese wrote:
> > On Friday 18 December 2009 13:35:26 hedwin wrote:
> >> Jeff, what is the size of your allocateble memory. Had to increase it to
> >>  4MB to get it working.
> >
> > I've got 1MByte for my test on Kilauea. This should be enough. There
> > is already a compile-time check in the UBI code:
> >
> >
> > #if (CONFIG_SYS_MALLOC_LEN < (512 << 10))
> > #error Malloc area too small for UBI, increase CONFIG_SYS_MALLOC_LEN to
> > >= 512k #endif
> >
> > Please let me know if this really is not enough. But for me, 1MB is
> > working.
> 
> As per Hedwin's suggestion I increased my CONFIG_SYS_MALLOC_LEN to 4MB
> and the error disappeared.  Thanks Hedwin!  And now the UBI output
> matches my part (e.g. PEB size).

Hmmm. Must be because my test platform used a small page NAND device. I'll 
give it a try on a large page NAND soon. The code must be lacking a check for 
malloc failure.

Cheers,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

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

end of thread, other threads:[~2009-12-21 10:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-17 21:09 [U-Boot] ubi part failing on NAND Jeff Angielski
2009-12-18  8:16 ` Stefan Roese
2009-12-18 12:35   ` hedwin
2009-12-18 12:41     ` Stefan Roese
2009-12-18 15:07       ` Jeff Angielski
2009-12-19 12:56         ` hedwin
2009-12-21 10:02         ` Stefan Roese
2009-12-18 14:47     ` Jeff Angielski

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