T1040RDB UBI

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

T1040RDB UBI

Jump to solution
3,836 Views
piddy
Contributor II

Hello,

I am trying to boot a UBI filesystem on T1040RDB from nand flash,

using the Bitbake/Yocto

I used mtdinfo /dev/mtd4 to find the relevant information, which returned

mtd4

Name:                                          NAND RFS Image

Type:                                            nand

Eraseblock size:                          524288 bytes, 512.0 KiB

Amount of eraseblocks:              1000 (524288000 bytes, 500.0 MiB)

Minimum input/output unit size:   4096 bytes

Sub-page size:                             4096 bytes

OOB size:                                    224 bytes

Character device major/minor:    90:8

Bad blocks are allowed:               true

Device is writable:                        true

Based on this information i create an image using the command

ubinize -o ubi.img -s 4096 -m 4096 -p 512KiB ubinize.cfg

(- s = subpage size, - m = minimum i/o size, - p is physical erase block size)

and the ubinize.cfg contains:

[ubifs]

mode=ubi

image=/local/yocto/QorIQ-SDK-V1.7-20141218-yocto/poky/build_t1040rdb-64b_release/tmp/deploy/images/t1040rdb-64b/fsl-image-minimal-t1040rdb-64b-20160407074007.rootfs.ubifs

vol_id=0

vol_type=dynamic

vol_name=t1040rdb-64b-rootfs

vol_flags=autoresize

I transfered ubi.img to T1040RDB and used the following commands:

ubiformat /dev/mtd4

ubiformat /dev/mtd4 -f /tmp/ubi.img

ubiattach /dev/ubi_ctrl -m 4

mount -t ubifs ubi0_0 /mnt

Once i try to mount i get the error:

error: validate_sb: min. I/O unit mismatch: 512 in superblock, 4096 real

It seems the superblock is used to store general system information, not flash specific.

I never worked with flash memory before, i wonder if someone can help me figure out why this mismatch exists and what i can do to fix this problems.

ps.

I found this question: T1040RDB Failed to mount UBIFS

But it doesn't give any information on the ubinize command used to create the image, but it did help me confirm i had the right kernel settings.

psps.

Using -m 512 in the ubinize doesn't really make sense to me, it forces me to also use subpage size of the same size, and when i try ubiattach it responds with:

validate_ec_hdr: bad VID header offset 512, expected 4096

Thanks already !

Labels (1)
0 Kudos
1 Solution
2,664 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Piddy Piddy,

Probably there is problem with the parameters used to generate UBI rootfs, Yocto could generate the final UBI filesystem, already including ubinize command converting, please use the file <rootfs>.ubi created by Yocto directly.

You need to specify parameters to Yocto according to your target, I cannot reserve T1040RDB DDR3 board now, I use P1010RDB as an example to show you how to decide UBI related parameters.

root@p1010rdb-pb:~# ubinfo

UBI version:                    1

Count of UBI devices:          0

UBI control device major/minor: 10:59

root@p1010rdb-pb:~# ls -l /dev/mtd7

crw------- 1 root root 90, 14 Jan  1  1970 /dev/mtd7

root@p1010rdb-pb:~# flash_erase /dev/mtd7 0 0

Erasing 512 Kibyte @ 2480000 -- 65 % complete flash_erase: Skipping bad block at 02500000

flash_erase: Skipping bad block at 02580000

Erasing 512 Kibyte @ 3780000 -- 100 % complete

root@p1010rdb-pb:~# ubiattach /dev/ubi_ctrl -m 7

UBI: attaching mtd7 to ubi0

UBI: scanning is finished

UBI: empty MTD device detected

UBI: attached mtd7 (name "NAND Compressed RFS Image", size 56 MiB) to ubi0

UBI: PEB size: 524288 bytes (512 KiB), LEB size: 516096 bytes

UBI: min./max. I/O unit sizes: 4096/4096, sub-page size 4096

UBI: VID header offset: 4096 (aligned 4096), data offset: 8192

UBI: good PEBs: 110, bad PEBs: 2, corrupted PEBs: 0

UBI: user volume: 0, internal volumes: 1, max. volumes count: 128

UBI: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 3408886590

UBI: available PEBs: 28, total reserved PEBs: 82, PEBs reserved for bad PEB handling: 78

UBI: background thread "ubi_bgt0d" started, PID 2829

UBI device number 0, total 110 LEBs (56770560 bytes, 54.1 MiB), available 28 LEBs (14450688 bytes, 13.8 MiB), LEB size 516096 bytes (504.0 KiB)

Just add the below lines to meta-fsl-ppc/images/fsl-image-minimal.bb:

MKUBIFS_ARGS = " -m 4096 -e 516096 -c 28 "

UBINIZE_ARGS = " -p 512KiB -m 4096 -s 4096 "

IMAGE_FSTYPES = "tar.gz ext2.gz ext2.gz.u-boot jffs2 ubi"

For the value of the parameters listed above can be got the Step1 display info:

-m smallest flash I/O unit

-e logical eraseblock size(  May be "logical erase block size + 1k (or 2k) = physical eraseblock size ")

-c available LEBs

-p physical eraseblock size

-s -sub-page-size=<bytes>  minimum input/output unit used for UBI headers,

                            e.g. sub-page size in case of NAND flash

                            (equivalent to the minimum input/output

                              unit size by default)


Have a great day,
Yiping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
3 Replies
2,663 Views
piddy
Contributor II

Hello Yiping,

Thanks for the reply ! I used jffs2 for now so i could continue my work.

Once i have finished my task i will try your advise with UBI and post the results

have a nice day

0 Kudos
2,664 Views
piddy
Contributor II

Ok, it worked ! thanks.

I did not know about this line

MKUBIFS_ARGS = " -m 4096 -e 516096 -c 28 "

I added it to a .bbappend in my own layer for neatness

Thanks again.

0 Kudos
2,665 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Piddy Piddy,

Probably there is problem with the parameters used to generate UBI rootfs, Yocto could generate the final UBI filesystem, already including ubinize command converting, please use the file <rootfs>.ubi created by Yocto directly.

You need to specify parameters to Yocto according to your target, I cannot reserve T1040RDB DDR3 board now, I use P1010RDB as an example to show you how to decide UBI related parameters.

root@p1010rdb-pb:~# ubinfo

UBI version:                    1

Count of UBI devices:          0

UBI control device major/minor: 10:59

root@p1010rdb-pb:~# ls -l /dev/mtd7

crw------- 1 root root 90, 14 Jan  1  1970 /dev/mtd7

root@p1010rdb-pb:~# flash_erase /dev/mtd7 0 0

Erasing 512 Kibyte @ 2480000 -- 65 % complete flash_erase: Skipping bad block at 02500000

flash_erase: Skipping bad block at 02580000

Erasing 512 Kibyte @ 3780000 -- 100 % complete

root@p1010rdb-pb:~# ubiattach /dev/ubi_ctrl -m 7

UBI: attaching mtd7 to ubi0

UBI: scanning is finished

UBI: empty MTD device detected

UBI: attached mtd7 (name "NAND Compressed RFS Image", size 56 MiB) to ubi0

UBI: PEB size: 524288 bytes (512 KiB), LEB size: 516096 bytes

UBI: min./max. I/O unit sizes: 4096/4096, sub-page size 4096

UBI: VID header offset: 4096 (aligned 4096), data offset: 8192

UBI: good PEBs: 110, bad PEBs: 2, corrupted PEBs: 0

UBI: user volume: 0, internal volumes: 1, max. volumes count: 128

UBI: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 3408886590

UBI: available PEBs: 28, total reserved PEBs: 82, PEBs reserved for bad PEB handling: 78

UBI: background thread "ubi_bgt0d" started, PID 2829

UBI device number 0, total 110 LEBs (56770560 bytes, 54.1 MiB), available 28 LEBs (14450688 bytes, 13.8 MiB), LEB size 516096 bytes (504.0 KiB)

Just add the below lines to meta-fsl-ppc/images/fsl-image-minimal.bb:

MKUBIFS_ARGS = " -m 4096 -e 516096 -c 28 "

UBINIZE_ARGS = " -p 512KiB -m 4096 -s 4096 "

IMAGE_FSTYPES = "tar.gz ext2.gz ext2.gz.u-boot jffs2 ubi"

For the value of the parameters listed above can be got the Step1 display info:

-m smallest flash I/O unit

-e logical eraseblock size(  May be "logical erase block size + 1k (or 2k) = physical eraseblock size ")

-c available LEBs

-p physical eraseblock size

-s -sub-page-size=<bytes>  minimum input/output unit used for UBI headers,

                            e.g. sub-page size in case of NAND flash

                            (equivalent to the minimum input/output

                              unit size by default)


Have a great day,
Yiping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos