Quantcast
Channel: Processors
Viewing all articles
Browse latest Browse all 149881

Forum Post: AM335x UBIFS Problem (u-boot-2013.01.01-psp06.00.00.00)

$
0
0

Hello,

I've spent a lot of time searching through the answer and finally decided to post it here because I'm pretty sure my that I haven't found the solution to my problem in any previous post in the forum.

So, I'm trying to make an UBIFS partition on a custom board that uses the AM335x processor and the latest version of the AM335x EVM SDK (ti-sdk-am335x-evm-06.00.00.00-Linux-x86).

I already compiled the mtd-utils so that I could use the -F option when I call the mkfs.ubifs command. I also checked that every step I'm posting below but so far my Kernel fails to mount the UBI partition.

First things first, in the u-boot I enable the following:

#define CONFIG_CMD_UBI
#define CONFIG_CMD_UBIFS
#define CONFIG_RBTREE
#define CONFIG_MTD_PARTITIONS
#define CONFIG_CMD_MTDPARTS
#define CONFIG_LZO
#define CONFIG_MTD_DEVICE
#define CONFIG_CMD_NAND_TRIMFFS

And I set bootargs=console=ttyO0,115200n8 root=ubi0:rootfs rw ubi.mtd=7 rootfstype=ubifs noinitrd

For further reference, here is what the mtdparts prints:

 

U-Boot# mtdparts

device nand0 <omap2-nand.0>, # parts = 8
#: name size offset mask_flags
0: SPL 0x00020000 0x00000000 0
1: SPL.backup1 0x00020000 0x00020000 0
2: SPL.backup2 0x00020000 0x00040000 0
3: SPL.backup3 0x00020000 0x00060000 0
4: u-boot 0x001e0000 0x00080000 0
5: u-boot-env 0x00020000 0x00260000 0
6: kernel 0x00500000 0x00280000 0
7: rootfs 0x07880000 0x00780000 0

active partition: nand0,0 - (SPL) 0x00020000 @ 0x00000000

defaults:
mtdids : nand0=omap2-nand.0
mtdparts: mtdparts=omap2-nand.0:128k(SPL),128k(SPL.backup1),128k(SPL.backup2),128k(SPL.backup3),1920k(u-boot),128k(u-boot-env),5m(kernel),-(rootfs)

 

Then I create the images I try to flash into the NAND:

 

$ cat filesystem/ubinize.cfg
[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=120MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize

$ ~/mtd/install/sbin/mkfs.ubifs -F -r rootfs/ -o ubifs.img -m 2048 -e 129024 -c 951

$ ~/mtd/install/sbin/ubinize -o rootfs.img -m 2048 -p 128KiB -O 2048 ubinize.cfg

 

This way I have found two ways to flash the file system (both inside the u-boot):

1) using ubifs.img with the command ubi write;

2) using rootfs.img with the command nand write (or nand write.trimffs).

 

Now things starts to get a little messy. None of the options works.

When I try writing the file ubinize generates, here is what I get:

U-Boot console:

usb reset
fatload usb 0 0x81000000 rootfs.img
nand erase 0x00780000 0x7880000
nand write 0x81000000 0x00780000 ${filesize}
run nand_boot

Kernel log:

[ 1.255527] UBI: attaching mtd7 to ubi0
[ 1.259688] UBI: physical eraseblock size: 131072 bytes (128 KiB)
[ 1.266330] UBI: logical eraseblock size: 126976 bytes
[ 1.272078] UBI: smallest flash I/O unit: 2048
[ 1.277082] UBI: VID header offset: 2048 (aligned 2048)
[ 1.283472] UBI: data offset: 4096
[ 2.340558] UBI: max. sequence number: 0
[ 2.364127] UBI error: vtbl_check: volume table check failed: record 0, error 9
[ 2.372605] UBI error: ubi_init: cannot attach mtd7

Now, if I try to flash the raw image:

usb reset
fatload usb 0 0x81000000 ubifs.img
nand erase 0x00780000 0x7880000
ubi part rootfs && ubi create rootfs
ubi write 0x81000000 rootfs ${filesize}
run nand_boot

Kernel log:

[ 1.255442] UBI: attaching mtd7 to ubi0
[ 1.259601] UBI: physical eraseblock size: 131072 bytes (128 KiB)
[ 1.266250] UBI: logical eraseblock size: 126976 bytes
[ 1.272005] UBI: smallest flash I/O unit: 2048
[ 1.277001] UBI: VID header offset: 2048 (aligned 2048)
[ 1.283388] UBI: data offset: 4096
[ 1.293766] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 0:0, read 64 bytes
[ 1.304260] UBI error: validate_ec_hdr: bad VID header offset 512, expected 2048
[ 1.312131] UBI error: validate_ec_hdr: bad EC header
[ 1.317496] UBI error: ubi_io_read_ec_hdr: validation failed for PEB 0
[ 1.324586] UBI error: ubi_init: cannot attach mtd7

 

Besides that, if I use there is another problem I observe: if I reset the u-boot, I'm not able to use ubi part to access the rootfs anymore (from u-boot). Here is what heppens:

usb reset
fatload usb 0 0x81000000 ubifs.img
nand erase 0x00780000 0x7880000
ubi part rootfs && ubi create rootfs
ubi write 0x81000000 rootfs ${filesize}

Output:

(Re)start USB...
USB0: scanning bus 0 for devices... 1 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found
reading ubifs.img
22321152 bytes read in 18731 ms (1.1 MiB/s)

NAND erase: device 0 offset 0x780000, size 0x7880000
Erasing at 0x7fe0000 -- 100% complete.
OK
Creating 1 MTD partitions on "nand0":
0x000000780000-0x000008000000 : "mtd=7"
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: create volume table (copy #2)
UBI: attached mtd1 to ubi0
UBI: MTD device name: "mtd=7"
UBI: MTD device size: 120 MiB
UBI: number of good PEBs: 964
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: 0
UBI: available PEBs: 951
UBI: total number of reserved PEBs: 13
UBI: number of PEBs reserved for bad PEB handling: 9
UBI: max/mean erase counter: 1/0
No size specified -> Using max size (122701824)
Creating dynamic volume rootfs of size 122701824
22321152 bytes written to volume rootfs

Now I try

U-Boot@UCC3# ubifsmount rootfs
UBIFS: mounted UBI device 0, volume 0, name "rootfs"
UBIFS: mounted read-only
UBIFS: file system size: 121282560 bytes (118440 KiB, 115 MiB, 940 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)

U-Boot# reset

U-Boot@UCC3# ubi part rootfs
Creating 1 MTD partitions on "nand0":
0x000000780000-0x000008000000 : "mtd=7"
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
ECC: uncorrectable.
ECC: uncorrectable.
UBI error: ubi_io_read: error -74 while reading 64 bytes from PEB 0:0, read 64 bytes
ECC: uncorrectable.
ECC: uncorrectable.
UBI error: ubi_io_read: error -74 while reading 512 bytes from PEB 0:512, read 512 bytes

So, I'm still trying to understand what I did wrong. There is a comment in the wiki that says "On flashing UBIFS image from U-Boot, make sure that ECC selected is in sync with Linux" but this u-boot does NOT have the nandecc command anymore...

I could go on a little more, but I think it enough to get a picture of what is going on.

Anyone has any thoughts?

Thanks in advance!

DAVI

 


Viewing all articles
Browse latest Browse all 149881

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>