Skip to contentSkip to conversation

issue with 'ubi part'

U-Boot Andre Schwarz 2 participants 5 messages Mar 2, 2011 – Mar 4, 2011

lore
Share & tools
lore
#0 lore raw

Stefan,

actually I have an issue with the "ubi part" command.

Situation:

MPC8377 based board with 64MiB Nor- (u-boot etc.) and 1GiB Nand-Flash (ubi volume).

MTD devices look like this :

=> mtdparts

device nor0 <NOR>, # parts = 2

  #: name                size            offset          mask_flags
  0: u-boot              0x00100000      0x00000000      0
  1: FPGA                0x00200000      0x00100000      0

device nand0 <NAND>, # parts = 1

  #: name                size            offset          mask_flags
  0: root                0x40000000      0x00000000      0

active partition: nor0,0 - (u-boot) 0x00100000 @ 0x00000000

defaults:
mtdids : nor0=NOR,nand0=NAND
mtdparts: mtdparts=NOR:1M(u-boot),2M(FPGA);NAND:-(root) =>

Setting the ubi partition to "root" fails :

=> ubi part root
Creating 1 MTD partitions on "nand0":
0x000000000000-0x000040000000 : "mtd=0"
UBI: attaching mtd2 to ubi0
UBI error: io_init: unaligned VID header shift 2
UBI error: ubi_init: cannot attach mtd2
UBI error: ubi_init: UBI error: cannot initialize UBI, error -22 UBI init error -22
exit not allowed from main input shell.
=>

######################

Did another test with a single NAND device :

=> mtdparts

device nand0 <NAND>, # parts = 1

  #: name                size            offset          mask_flags
  0: root                0x40000000      0x00000000      0

active partition: nand0,0 - (root) 0x40000000 @ 0x00000000

defaults:
mtdids : nand0=NAND
mtdparts: mtdparts=NAND:-(root)

=> ubi part root
Creating 1 MTD partitions on "nand0":
0x000000000000-0x000040000000 : "mtd=0"
Bad block table not found for chip 0
Bad block table not found for chip 0
No space left to write bad block table
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 129024 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI: empty MTD device detected
UBI: create volume table (copy #1)
UBI error: ubi_scan_get_free_peb: no eraseblocks found UBI error: ubi_init: cannot attach mtd1
UBI error: ubi_init: UBI error: cannot initialize UBI, error -28 UBI init error -28
exit not allowed from main input shell.
=>

To me the mtd numbering looks wrong in both cases - specififally:
"ubi_init: can't attach mtdX"

Any hints ? Have I missed something ?

Signature · 8 lines
Regards,
Andre



MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner
#1 lore raw

Hi Andre,

Quoted 30 lines · On Wednesday 02 March 2011 16:35:09 Andre Schwarz wrote:

actually I have an issue with the "ubi part" command.

Situation:

MPC8377 based board with 64MiB Nor- (u-boot etc.) and 1GiB Nand-Flash (ubi volume).

MTD devices look like this :

=> mtdparts

device nor0 <NOR>, # parts = 2

  #: name                size            offset          mask_flags
  0: u-boot              0x00100000      0x00000000      0
  1: FPGA                0x00200000      0x00100000      0

device nand0 <NAND>, # parts = 1

  #: name                size            offset          mask_flags
  0: root                0x40000000      0x00000000      0

active partition: nor0,0 - (u-boot) 0x00100000 @ 0x00000000

defaults:
mtdids : nor0=NOR,nand0=NAND
mtdparts: mtdparts=NOR:1M(u-boot),2M(FPGA);NAND:-(root) =>

Setting the ubi partition to "root" fails :

Quoted 10 lines

=> ubi part root
Creating 1 MTD partitions on "nand0":
0x000000000000-0x000040000000 : "mtd=0"
UBI: attaching mtd2 to ubi0
UBI error: io_init: unaligned VID header shift 2
UBI error: ubi_init: cannot attach mtd2
UBI error: ubi_init: UBI error: cannot initialize UBI, error -22 UBI init error -22
exit not allowed from main input shell.
=>

Did you erase the flash partition before trying to attach UBI on it?

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

#2 lore raw

Stefan,

Quoted 43 lines

Hi Andre,

Quoted 30 lines · On Wednesday 02 March 2011 16:35:09 Andre Schwarz wrote:

actually I have an issue with the "ubi part" command.

Situation:

MPC8377 based board with 64MiB Nor- (u-boot etc.) and 1GiB Nand-Flash (ubi volume).

MTD devices look like this :

=> mtdparts

device nor0<NOR>, # parts = 2

   #: name                size            offset          mask_flags
   0: u-boot              0x00100000      0x00000000      0
   1: FPGA                0x00200000      0x00100000      0

device nand0<NAND>, # parts = 1

   #: name                size            offset          mask_flags
   0: root                0x40000000      0x00000000      0

active partition: nor0,0 - (u-boot) 0x00100000 @ 0x00000000

defaults:
mtdids : nor0=NOR,nand0=NAND
mtdparts: mtdparts=NOR:1M(u-boot),2M(FPGA);NAND:-(root) =>

Setting the ubi partition to "root" fails :

Quoted 10 lines

=> ubi part root
Creating 1 MTD partitions on "nand0":
0x000000000000-0x000040000000 : "mtd=0"
UBI: attaching mtd2 to ubi0
UBI error: io_init: unaligned VID header shift 2
UBI error: ubi_init: cannot attach mtd2
UBI error: ubi_init: UBI error: cannot initialize UBI, error -22 UBI init error -22
exit not allowed from main input shell.
=>

Quoted 1 line

Did you erase the flash partition before trying to attach UBI on it?

yes - the ubi volume has been created by linux and is working fine :

ubiformat /dev/NAND -y
ubiattach /dev/ubi_ctrl -m 9
ubimkvol /dev/ubi0 -N rootfs -m
mount -t ubifs ubi0:rootfs /mnt/nand

Actually I'm running Linux with rootfs on this very ubi volume.

All I wanna do is get the kernel + dtb from this volume for stand-alone boot.
Meanwhile I'm getting both files using tftp from the server - but that's no long term solution.

I'm still curious why we get

0x000000000000-0x000040000000 : "mtd=0" -> 0 !
and
UBI error: ubi_init: cannot attach mtd2 -> 2 !

Is this the expected behaviour ?

Regards,
Andr?

MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner

#3 lore raw

Andre,

Quoted 20 lines · On Friday 04 March 2011 11:16:50 Andre Schwarz wrote:
Quoted 11 lines
Quoted 10 lines

=> ubi part root
Creating 1 MTD partitions on "nand0":
0x000000000000-0x000040000000 : "mtd=0"
UBI: attaching mtd2 to ubi0
UBI error: io_init: unaligned VID header shift 2
UBI error: ubi_init: cannot attach mtd2
UBI error: ubi_init: UBI error: cannot initialize UBI, error -22 UBI init error -22
exit not allowed from main input shell.
=>

Quoted 1 line

Did you erase the flash partition before trying to attach UBI on it?

yes - the ubi volume has been created by linux and is working fine :

ubiformat /dev/NAND -y
ubiattach /dev/ubi_ctrl -m 9
ubimkvol /dev/ubi0 -N rootfs -m
mount -t ubifs ubi0:rootfs /mnt/nand

Quoted 6 lines

Actually I'm running Linux with rootfs on this very ubi volume.

All I wanna do is get the kernel + dtb from this volume for stand-alone boot.
Meanwhile I'm getting both files using tftp from the server - but that's no long term solution.

I have no real idea then why this fails in U-Boot, sorry. What versions of U- Boot and Linux are you using?

I suggest you debug a bit, to see where this error results from.

Quoted 8 lines

I'm still curious why we get

0x000000000000-0x000040000000 : "mtd=0" -> 0 !
and
UBI error: ubi_init: cannot attach mtd2 -> 2 !

Is this the expected behaviour ?

IIRC, it's because the NOR flash partitions are enumerated first. So 2 NOR partitions (0...1) makes the first NAND partition #2.

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

#4 lore raw

Stefan,

Quoted 21 lines

Andre,

Quoted 18 lines · On Friday 04 March 2011 11:16:50 Andre Schwarz wrote:
Quoted 11 lines
Quoted 10 lines

=> ubi part root
Creating 1 MTD partitions on "nand0":
0x000000000000-0x000040000000 : "mtd=0"
UBI: attaching mtd2 to ubi0
UBI error: io_init: unaligned VID header shift 2
UBI error: ubi_init: cannot attach mtd2
UBI error: ubi_init: UBI error: cannot initialize UBI, error -22 UBI init error -22
exit not allowed from main input shell.
=>

Did you erase the flash partition before trying to attach UBI on it?

yes - the ubi volume has been created by linux and is working fine :

ubiformat /dev/NAND -y
ubiattach /dev/ubi_ctrl -m 9
ubimkvol /dev/ubi0 -N rootfs -m
mount -t ubifs ubi0:rootfs /mnt/nand

Quoted 8 lines
Quoted 6 lines

Actually I'm running Linux with rootfs on this very ubi volume.

All I wanna do is get the kernel + dtb from this volume for stand-alone boot.
Meanwhile I'm getting both files using tftp from the server - but that's no long term solution.

I have no real idea then why this fails in U-Boot, sorry. What versions of U- Boot and Linux are you using?

I'm running TOT with kernel 2.6.34.7

Quoted 1 line

I suggest you debug a bit, to see where this error results from.

ok - so no obvious mistakes.

Will try a bisect because it has been working back in November 2010.

Quoted 11 lines
Quoted 9 lines

I'm still curious why we get

0x000000000000-0x000040000000 : "mtd=0" -> 0 !
and
UBI error: ubi_init: cannot attach mtd2 -> 2 !

Is this the expected behaviour ?

IIRC, it's because the NOR flash partitions are enumerated first. So 2 NOR partitions (0...1) makes the first NAND partition #2.

ok - will have a look.

Signature · 8 lines
Regards,
Andre



MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner