[U-Boot] ubi part failing on NAND

Stefan Roese sr at denx.de
Fri Dec 18 09:16:07 CET 2009


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


More information about the U-Boot mailing list