[U-Boot] Problems with creating an UBIFS partition with uboot

2010-06-18 Thread Karl Krach
Hello all,

I ve googled a lot and read many mailing list entries, but got stuck now with 
the following problem:

=>  ubifsmount rootfs
UBIFS error (pid 0): ubifs_read_node: bad node type (0 but expected 6)
UBIFS error (pid 0): ubifs_read_node: bad node at LEB 0:0
Error reading superblock on volume 'ubi:rootfs'!

1) I ve erased my nand-partition with 'nand erase'
2) I ve created a UBI partition with 'ubi part'
3) I ve uploaded my UBI image with 'tftp'
4) I ve created an volume with 'ubi create'
5) I ve written the image to the volume with 'ubi write'
6) I wanted to mount the volume
 -->  and failed

INFO: I was able to mount a UBI image, which I ve created on the device, when 
booting from NFS. So I guess that the UBI image is OK.

Was did I wrong?

Thanks a lot,
Charly





Here is the complete history:

I ve created an UBI image from an UBIFS file with the following cmd:

 ubinize -orootfs.ubi.img -m2048 -O512 -p128KiB ubinize.cfg

and this ubinize.cfg

 [ubifs]
 mode=ubi
 image=rootfs.ubifs
 vol_id=0
 vol_size=512MiB
 vol_type=dynamic
 vol_name=rootfs
 vol_flags=autoresize


=>  setenv mtdids nor0=fc00.flash,nand0=mpc5121.nand


=>  setenv mtdparts 
'mtdparts=fc00.flash:256k(protected),60m(filesystem),2560k(kernel),256k(device-tree),1024k(u-boot);mpc5121.nand:-(ubi-data)'


=>  mtdparts

device nor0, # parts = 5
  #: namesizeoffset  mask_flags
  0: protected   0x0004  0x  0
  1: filesystem  0x03c0  0x0004  0
  2: kernel  0x0028  0x03c4  0
  3: device-tree 0x0004  0x03ec  0
  4: u-boot  0x0010  0x03f0  0

device nand0, # parts = 1
  #: namesizeoffset  mask_flags
  0: ubi-data0x2000  0x  0

active partition: nor0,0 - (protected) 0x0004 @ 0x

defaults:
mtdids  : nor0=fc00.flash,nand0=mpc5121.nand
mtdparts:
mtdparts=fc00.flash:43776k(user),16m(rootfs),4m(kernel),256k(dtb),1m(u-boot);mpc5121.nand:-(data)


=>  nand erase ${start of ubi-data} ${size of ubi-data}
Skipping bad block at  0x1ffc
Skipping bad block at  0x1ffe

OK


=>  ubi part ubi-data
Creating 1 MTD partitions on "nand0":
0x-0x2000 : "mtd=0"
UBI: attaching mtd3 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: create volume table (copy #2)
UBI: attached mtd3 to ubi0
UBI: MTD device name:"mtd=0"
UBI: MTD device size:512 MiB
UBI: number of good PEBs:4064
UBI: number of bad PEBs: 32
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: 4020
UBI: total number of reserved PEBs: 44
UBI: number of PEBs reserved for bad PEB handling: 40
UBI: max/mean erase counter: 0/0


=>  ubifsmount ubi-data
UBIFS error (pid 0): ubifs_get_sb: cannot open "ubi:ubi-data", error -19
Error reading superblock on volume 'ubi:ubi-data'!


=>  ubifsmount rootfs
UBIFS error (pid 0): mount_ubifs: can't format empty UBI volume: read-only mount
Error reading superblock on volume 'ubi:rootfs'!


=>  tftp rootfs.ubi.img
Using FEC ETHERNET device
TFTP from server 10.1.1.83; our IP address is 10.1.1.84
Filename 'rootfs.ubi.img'.
Load address: 0x40
Loading:
 #
 #
 #
 #
done
Bytes transferred = 18219008 (116 hex)


=>  printenv
[...]
filesize=116
fileaddr=40
[...]


=>  ubi create rootfs
Creating dynamic volume rootfs of size 518676480


=>  ubi write ${fileaddr} rootfs ${filesize}
Volume "rootfs" found at volume id 0


=>  ubifsmount rootfs
UBIFS error (pid 0): ubifs_read_node: bad node type (0 but expected 6)
UBIFS error (pid 0): ubifs_read_node: bad node at LEB 0:0
Error reading superblock on volume 'ubi:rootfs'!


=>  nand write ${fileaddr} ubi-data ${filesize}

NAND write: device 0 offset 0x0, size 0x116
Skip bad block 0x0004
Skip bad block 0x0058
Skip bad block 0x005a
Skip bad block 0x0064
Skip bad block 0x0074
  18219008 bytes written: OK


=>  ubifsmount rootfs
UBIFS error (pid 0): ubifs_read_node: bad node type (0 but expected 6)
UBIFS error (pid 0): ubifs_read_node: bad node at LEB 0:0
Error reading superblock on volume 'ubi:rootfs'!

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx

Re: [U-Boot] Problems with creating an UBIFS partition with uboot

2010-06-19 Thread Karl Krach
Hello Matthew,

thanks a lot, I will try this approach on Monday, when I'm back at work.

 > At a glance, one problem is the use of ubinize, which is intended to
 > work when doing "bare NAND" flashing with no awareness of UBI.  I.e.
 > if you tried these steps with "rootfs.ubifs" rather than
 > "rootfs.ubi.img", they'd probably work.  However, that doesn't explain
 > why the last attempt (doing a straight "nand write") also fails, since
 > that should work with the ubinized image.

I like this apprach, since buildroot creates an ubifs file for me, so I 
don't need the extra step to create the image with ubinize.


Best regards,

Charly
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] ubifsmount fails after booting linux

2010-07-09 Thread Karl Krach
Hello,

the idea is, to give the user a possibility to update its system without tftp
or a second partition. First, the user saves the update file (rootfs.ubifs) to
its rootfs, and on the next reboot the uboot loads the update file to the RAM
and flashes the update file.

Problem: After booting linux once, I cannot mount my ubifs from uboot any
more. (But: On linux it is still working fine...)

I receive once again:
   UBIFS error (pid 0): ubifs_read_node: bad node type
(255 but expected 6)
   UBIFS error (pid 0): ubifs_read_node: bad node at LEB 0:0
   Error reading superblock on volume 'ubi:rootfs'!

Best regards,

Charly







U-Boot 2010.03 (Jun 17 2010 - 14:18:23) MPC512X

CPU:   MPC5121e rev. 2.0, Core e300c4 at 400 MHz, CSB at 200 MHz (RSR=0x1003)
Board: ADS5121 rev. 0x0400 (CPLD rev. 0x06)
I2C:   ready
DRAM:  512 MB
FLASH: 64 MB
NAND:  1024 MiB
 [...]


=> mtdparts

device nor0 , # parts = 5
 [...]
device nand0 , # parts = 1
 #: namesizeoffset  mask_flags
 0: ubi-data0x2000  0x  0
 [...]


=> ubi part ubi-data

Creating 1 MTD partitions on "nand0":
0x-0x2000 : "mtd=0"
Bad block table found at page 261952, version 0x01
Bad block table found at page 261888, version 0x01
nand_read_bbt: Bad block at 0x0004
 [...]
nand_read_bbt: Bad block at 0x1ffe
UBI: attaching mtd3 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: attached mtd3 to ubi0
UBI: MTD device name:"mtd=0"
UBI: MTD device size:512 MiB
UBI: number of good PEBs:4064
UBI: number of bad PEBs: 32
UBI: max. allowed volumes:   128
UBI: wear-leveling threshold:4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 1
UBI: available PEBs: 0
UBI: total number of reserved PEBs: 4064
UBI: number of PEBs reserved for bad PEB handling: 40
UBI: max/mean erase counter: 6/1


=> tftp rootfs.ubifs

Using FEC ETHERNET device
TFTP from server 10.1.1.83; our IP address is 10.1.1.84
Filename 'rootfs.ubifs'.
Load address: 0x40
Loading: *
 ##
 [...]
 ##
done
Bytes transferred = 22966272 (15e7000 hex)


=> ubi write ${fileaddr} rootfs ${filesize}

Volume "rootfs" found at volume id 0


=> ubifsmount rootfs

UBIFS: mounted UBI device 0, volume 0, name "rootfs"
UBIFS: mounted read-only
UBIFS: file system size:   262821888 bytes (256662 KiB, 250 MiB, 2037 LEBs)
UBIFS: journal size:   9033728 bytes (8822 KiB, 8 MiB, 71 LEBs)
UBIFS: media format:   w4/r0 (latest is w4/r0)
UBIFS: default compressor: LZO
UBIFS: reserved for root:  0 bytes (0 KiB)


=> ubifsls

5232  Fri Jul 09 11:54:31 2010  bin
   11344  Fri Jun 25 11:51:19 2010  dev
1840  Fri Jul 09 11:54:33 2010  etc
1864  Fri Jul 09 11:54:33 2010  lib
 160  Fri Jun 25 09:42:48 2010  mnt
 [...]
 440  Fri Jun 25 09:42:48 2010  root
  11  Fri Jun 25 10:21:56 2010  linuxrc


=> run flash_ubi

## Booting kernel from Legacy Image at ff90 ...
 [...]
brd: module loaded
fc00.flash: Found 2 x16 devices at 0x0 in 32-bit bank
 Amd/Fujitsu Extended Query Table at 0x0040
fc00.flash: CFI does not contain boot bank location. Assuming top.
number of CFI chips: 1
RedBoot partition parsing not available
Creating 5 MTD partitions on "fc00.flash":
0x-0x0004 : "protected"
0x0004-0x03c4 : "filesystem"
0x03c4-0x03ec : "kernel"
0x03ec-0x03f0 : "device-tree"
0x03f0-0x0400 : "u-boot"
mpc5121_nfc 4000.nfc: Configured for 8-bit NAND, page size 2048 with 64
spare.
NAND device: Manufacturer ID: 0xad, Chip ID: 0xdc (Hynix NAND 512MiB 3,3V
8-bit)
2 NAND chips detected
Creating 1 MTD partitions on "MPC5121 NAND":
0x-0x4000 : "nand"
UBI: attaching mtd5 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: attached mtd5 to ubi0
UBI: MTD device name:"nand"
UBI: MTD device size:1024 MiB
UBI: number of good PEBs:8140
UBI: number of bad PEBs: 52
UBI: max. allowed volumes:   128
UBI: wear-leveling threshold:4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 1
UBI: available PEBs: 4035
UBI: total number of reserved PEBs: 4105
UBI: number of PEBs reserved for bad PEB handling: 81
UBI: max/mean erase counter: 7/1
UBI: image sequence 

Re: [U-Boot] ubifsmount fails after booting linux

2010-07-15 Thread Karl Krach
On 07/09/2010 05:21 PM, Karl Krach wrote:
> Hello,
>

Just for documentation:

U-boot/mtdparts detected only the first 512Mb of the dual component 
flash chip while Linux (through the device tree) used the full 1024Mb. 
It seems that mounting a 1024Mb mtd device, which was created as 512Mb 
partition works better, than mounting a 512Mb mtd device which was 
mounted as 1024Mb before.

Charly

>
> Problem: After booting linux once, I cannot mount my ubifs from uboot any
> more. (But: On linux it is still working fine...)
>
> I receive once again:
> UBIFS error (pid 0): ubifs_read_node: bad node type
>  (255 but expected 6)
> UBIFS error (pid 0): ubifs_read_node: bad node at LEB 0:0
> Error reading superblock on volume 'ubi:rootfs'!
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot