[U-Boot] u-boot UBI support

I'm trying to get u-boot to read from a ubifs volume on an mx28evk board, and failing :(.
I've got the nand partitioned:
MX28EVK U-Boot > mtdparts
device nand0 <gpmi-nand>, # parts = 3 #: name size offset mask_flags 0: bootloader 0x00300000 0x00000000 0 1: recovery 0x03200000 0x00300000 0 2: rootfs_config 0x04b00000 0x03500000 0
and u-boot attaches the partition fine:
MX28EVK U-Boot > ubi part recovery
UBI: attaching mtd1 to ubi0 UBI: physical eraseblock size: 131072 bytes (128 KiB) UBI: logical eraseblock size: 126976 bytes UBI: smallest flash I/O unit: 2048 UBI: VID header offset: 2048 (aligned 2048) UBI: data offset: 4096 UBI: attached mtd1 to ubi0 UBI: MTD device name: "mtd=1" UBI: MTD device size: 50 MiB UBI: number of good PEBs: 400 UBI: number of bad PEBs: 0 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: 16 UBI: total number of reserved PEBs: 384 UBI: number of PEBs reserved for bad PEB handling: 4 UBI: max/mean erase counter: 5/2
but it fails to mount the filesystem:
MX28EVK U-Boot > ubifsmount recovery
UBIFS error (pid 0): ubifs_get_sb: cannot open "recovery", error -22 UBIFS error (pid 0): ubifs_mount: Error reading superblock on volume 'recovery' errno=-22!
It looks like it sees the volume:
MX28EVK U-Boot > ubi info l UBI: volume information dump: UBI: vol_id 0 UBI: reserved_pebs 376 UBI: alignment 1 UBI: data_pad 0 UBI: vol_type 3 UBI: name_len 8 UBI: usable_leb_size 126976 UBI: used_ebs 376 UBI: used_bytes 47742976 UBI: last_eb_bytes 126976 UBI: corrupted 0 UBI: upd_marker 0 UBI: name recovery
UBI: volume information dump: UBI: vol_id 2147479551 UBI: reserved_pebs 2 UBI: alignment 1 UBI: data_pad 0 UBI: vol_type 3 UBI: name_len 13 UBI: usable_leb_size 126976 UBI: used_ebs 2 UBI: used_bytes 253952 UBI: last_eb_bytes 2 UBI: corrupted 0 UBI: upd_marker 0 UBI: name layout volume
but just won't mount it. The same volume mounts from linux fine:
/ # ubiattach -m 1 /dev/ubi_ctrl [ 15.837687] UBI: attaching mtd1 to ubi0 [ 16.704968] UBI: scanning is finished [ 16.750187] UBI: attached mtd1 (name "recovery", size 50 MiB) to ubi0 [ 16.756906] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes [ 16.763968] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048 [ 16.770718] UBI: VID header offset: 2048 (aligned 2048), data offset: 4096 [ 16.777781] UBI: good PEBs: 400, bad PEBs: 0, corrupted PEBs: 0 [ 16.783875] UBI: user volume: 1, internal volumes: 1, max. volumes count: 128 [ 16.791062] UBI: max/mean erase counter: 5/2, WL threshold: 4096, image sequence number: 2129180187 [ 16.800281] UBI: available PEBs: 0, total reserved PEBs: 400, PEBs reserved for bad PEB handling: 20 [ 16.810031] UBI: background thread "ubi_bgt0d" started, PID 32
/ # mount -t ubifs ubi0:recovery /mnt [ 29.049343] UBIFS: background thread "ubifs_bgt0_0" started, PID 34 [ 29.359312] UBIFS: mounted UBI device 0, volume 0, name "recovery"(null) [ 29.366343] UBIFS: LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes [ 29.375687] UBIFS: FS size: 46473216 bytes (44 MiB, 366 LEBs), journal size 6348800 bytes (6 MiB, 50 LEBs) [ 29.385531] UBIFS: reserved for root: 0 bytes (0 KiB) [ 29.390625] UBIFS: media format: w4/r0 (latest is w4/r0), UUID 4058B2E3-BA45-4D0D-8A7E-B95D4DCF7E72, small LPT model
/ # ls /mnt emdebian-rootfs.tar.gz recovery_dtb.itb zImage imx28-evk.dtb recovery_initramfs.itb libmodules.tgz recovery_kernel.itb
Am I missing something here? u-boot is from the git arm branch as of a few days ago. The ubi stuff was created using linux 3.8.4. Is it too new for the ubi code in u-boot?
Thanks for any pointers...

"Paul B. Henson" henson@acm.org writes:
I'm trying to get u-boot to read from a ubifs volume on an mx28evk board, and failing :(.
[...]
MX28EVK U-Boot > ubifsmount recovery
UBIFS error (pid 0): ubifs_get_sb: cannot open "recovery", error -22 UBIFS error (pid 0): ubifs_mount: Error reading superblock on volume 'recovery' errno=-22!
Try increasing CONFIG_SYS_MALLOC_LEN, e.g. to 4MiB. That fixed it for me on a different board.
Sascha

On 4/29/2013 1:57 AM, Sascha Silbe wrote:
UBIFS error (pid 0): ubifs_get_sb: cannot open "recovery", error -22 UBIFS error (pid 0): ubifs_mount: Error reading superblock on volume 'recovery' errno=-22!
Try increasing CONFIG_SYS_MALLOC_LEN, e.g. to 4MiB. That fixed it for me on a different board.
I saw a couple of threads about that, but they looked like different problems. Couldn't hurt to try though and see what happens, thanks for the suggestion…

On 4/29/2013 1:57 AM, Sascha Silbe wrote:
MX28EVK U-Boot > ubifsmount recovery
UBIFS error (pid 0): ubifs_get_sb: cannot open "recovery", error -22 UBIFS error (pid 0): ubifs_mount: Error reading superblock on volume 'recovery' errno=-22!
Try increasing CONFIG_SYS_MALLOC_LEN, e.g. to 4MiB. That fixed it for me on a different board.
It actually turned out to be something a lot simpler. Unlike Linux, u-boot only allows one active ubi partition. However, because it uses the code from Linux, when trying to access a file system you still need to specify which ubi partition it's on, which was neither intuitive nor obvious until I dug through the code.
When I specified "ubifsmount ubi0:recovery", it worked perfectly.
Thanks…

On Tue, Apr 30, 2013 at 01:54:41PM -0700, Paul B. Henson wrote:
On 4/29/2013 1:57 AM, Sascha Silbe wrote:
MX28EVK U-Boot > ubifsmount recovery
UBIFS error (pid 0): ubifs_get_sb: cannot open "recovery", error -22 UBIFS error (pid 0): ubifs_mount: Error reading superblock on volume 'recovery' errno=-22!
Try increasing CONFIG_SYS_MALLOC_LEN, e.g. to 4MiB. That fixed it for me on a different board.
It actually turned out to be something a lot simpler. Unlike Linux, u-boot only allows one active ubi partition. However, because it uses the code from Linux, when trying to access a file system you still need to specify which ubi partition it's on, which was neither intuitive nor obvious until I dug through the code.
When I specified "ubifsmount ubi0:recovery", it worked perfectly.
Thanks?
Would you mind patching doc/README.ubi ? Thanks!

On 5/1/2013 6:31 AM, Tom Rini wrote:
When I specified "ubifsmount ubi0:recovery", it worked perfectly.
Would you mind patching doc/README.ubi ?
Hmm, looks like that currently does not document the ubifsmount command at all. I'll take a look at it over the weekend and see if I can freshen it up.

On Sat, May 04, 2013 at 05:49:12PM -0700, Paul B. Henson wrote:
On Wed, May 01, 2013 at 09:31:29AM -0400, Tom Rini wrote:
Would you mind patching doc/README.ubi ?
Attached. Would you rather I send it to the list as a separate message?
As a rule, yes. But patchwork picked this one up, and things look good so:
Reviewed-by: Tom Rini trini@ti.com
And I'll apply it to master soon. Thanks!

On Sat, May 4, 2013 at 9:49 PM, Paul B. Henson henson@acm.org wrote:
On Wed, May 01, 2013 at 09:31:29AM -0400, Tom Rini wrote:
Would you mind patching doc/README.ubi ?
Attached. Would you rather I send it to the list as a separate message?
You missed your Signed-off-by in this patch.
Regards,
Fabio Estevam

On Mon, May 06, 2013 at 10:07:07AM -0300, Fabio Estevam wrote:
You missed your Signed-off-by in this patch.
Oops; sorry, not that familiar with your development conventions and didn't think to review them before sending in such a simple change. I can resubmit it with that tag if you'd like.

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 05/07/2013 09:09 PM, Paul B. Henson wrote:
On Mon, May 06, 2013 at 10:07:07AM -0300, Fabio Estevam wrote:
You missed your Signed-off-by in this patch.
Oops; sorry, not that familiar with your development conventions and didn't think to review them before sending in such a simple change. I can resubmit it with that tag if you'd like.
All changes do, but you can just reply to this thread.
- -- Tom

On Wed, May 08, 2013 at 05:08:10PM -0000, Paul B. Henson wrote:
On Tue, May 07, 2013 at 11:01:35PM -0400, Tom Rini wrote:
All changes do, but you can just reply to this thread.
Ok, here it is again, with the tag.
From 532cc340712c0542526be601c3f9f886e7054e5c Mon Sep 17 00:00:00 2001
From: "Paul B. Henson" henson@acm.org Date: Sat, 4 May 2013 17:44:43 -0700 Subject: [PATCH] Update doc/README.ubi to add description of accessing ubi filesystems.
Signed-off-by: "Paul B. Henson" henson@acm.org
Reworded such that the commit message is: doc/README.ubi: Add description of accessing ubi filesystems
and applied to u-boot/master, thanks!
participants (4)
-
Fabio Estevam
-
Paul B. Henson
-
Sascha Silbe
-
Tom Rini