This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM335X - Problems with UBIFS from U-Boot

Hello,

I am running some experiments with UBIFS support in U-BOOT. Here is my setup:

----------------------------------------------------------------------------------------------------------------------------

AM335X Custom hardware based on BeagleBoneBlack, but with NAND instead of eMMC.

Spansion SCL NAND S34ML01G2

u-boot-2013.10-ti2013.12.01 taken from TI SDK ti-sdk-am335x-evm-07.00.00.00

-----------------------------------------------------------------------------------------------------------------------------

Following instructions found on:

http://processors.wiki.ti.com/index.php/UBIFS_Support#How_to_enable_UBI.2FUBIFS_support_in_u-boot_.3F

I have added the following to u-boot-2013.10-ti2013.12.01/include/configs/am335x_evm.h

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

After running U-Boot, I followed the examples in u-boot-2013.10-ti2013.12.01/doc/README.ubi. I am unable to mount the ubi partition with ubifsmount. I suspect it may have something to do with the pagesize/subpagesize/vid-header-offset not matching, but not sure how to get these all to match. Please see the following output, and help or ideas will be greatly appreciated thank you! - Anthony

U-Boot# nand erase.chip

NAND erase.chip: device 0 whole chip
Erasing at 0x7fe0000 -- 100% complete.
OK

U-Boot# mtdparts

device nand0 <nand.0>, # parts = 10
 #: 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-spl-os       0x00040000      0x00080000      0
 5: u-boot              0x00100000      0x000c0000      0
 6: u-boot-env          0x00020000      0x001c0000      0
 7: u-boot-env.backup1  0x00020000      0x001e0000      0
 8: kernel              0x00800000      0x00200000      0
 9: rootfs              0x07600000      0x00a00000      0

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

defaults:
mtdids  : nand0=nand.0
mtdparts: mtdparts=nand.0:128k(SPL),128k(SPL.backup1),128k(SPL.backup2),128k(SPL.backup3),256k(u-boot-spl-os),1m(u-boot),128k(u-boot-env),128k(u-boot-env.backup1),8m(kernel),-(rootfs)


U-Boot# ubi part rootfs
UBI: mtd1 is detached from ubi0
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=9"
UBI: MTD device size:            118 MiB
UBI: number of good PEBs:        944
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:             931
UBI: total number of reserved PEBs: 13
UBI: number of PEBs reserved for bad PEB handling: 9
UBI: max/mean erase counter: 1/0


U-Boot# ubi create testvol
No size specified -> Using max size (120121344)
Creating dynamic volume testvol of size 120121344


U-Boot# ubi info l
UBI: volume information dump:
UBI: vol_id          0
UBI: reserved_pebs   931
UBI: alignment       1
UBI: data_pad        0
UBI: vol_type        3
UBI: name_len        7
UBI: usable_leb_size 129024
UBI: used_ebs        931
UBI: used_bytes      120121344
UBI: last_eb_bytes   129024
UBI: corrupted       0
UBI: upd_marker      0
UBI: name            testvol

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 129024
UBI: used_ebs        2
UBI: used_bytes      258048
UBI: last_eb_bytes   2
UBI: corrupted       0
UBI: upd_marker      0
UBI: name            layout volume


U-Boot# ubi info  
UBI: MTD device name:            "mtd=9"
UBI: MTD device size:            118 MiB
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    129024 bytes
UBI: number of good PEBs:        944
UBI: number of bad PEBs:         0
UBI: smallest flash I/O unit:    2048
UBI: VID header offset:          512 (aligned 512)
UBI: data offset:                2048
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: 944
UBI: number of PEBs reserved for bad PEB handling: 9
UBI: max/mean erase counter: 2/0


U-Boot# ubi write 90000000 testvol 80000
524288 bytes written to volume testvol


U-Boot# ubi read A0000000 testvol 80000
Read 524288 bytes from volume testvol to a0000000


U-Boot# cmp.b 90000000 A0000000 80000
Total of 524288 byte(s) were the same


U-Boot# ubifsmount ubi0:testvol
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
UBIFS error (pid 0): ubifs_mount: Error reading superblock on volume 'ubi0:testvol' errno=-22!

ubifsmount - mount UBIFS volume

Usage:
ubifsmount <volume-name>
    - mount 'volume-name' volume


U-Boot# ubifsmount ubi0:rootfs
UBIFS error (pid 0): ubifs_get_sb: cannot open "ubi0:rootfs", error -19
UBIFS error (pid 0): ubifs_mount: Error reading superblock on volume 'ubi0:rootfs' errno=-19!

ubifsmount - mount UBIFS volume

Usage:
ubifsmount <volume-name>
    - mount 'volume-name' volume


U-Boot# ubifsmount rootfs     
UBIFS error (pid 0): ubifs_get_sb: cannot open "rootfs", error -22
UBIFS error (pid 0): ubifs_mount: Error reading superblock on volume 'rootfs' errno=-22!

ubifsmount - mount UBIFS volume

Usage:
ubifsmount <volume-name>
    - mount 'volume-name' volume

  • Hi Anthony,

    I will ask someone from the SW team to look at this.

  • Biser,

    Thanks for you attention to this issue, looking forward to hearing back with any information. - Anthony

  • Hi Anthony,

    Could you try adding the following line:
    #define CONFIG_SYS_MALLOC_LEN        (CONFIG_ENV_SIZE + (1024 << 10))

    I see that the MALLOC_LEN definition has been removed from SDK7.0 u-boot.

    As for you assumptions about pagesize/subpagesize/vid-header-offset not matching, you can check what has been done in the latest mainline u-boot from http://git.denx.de/  to get some ideas for debugging the issue on your side.

    Best Regards,

    Yordan

  • Assume you mean to add this define in "u-boot-2013.10-ti2013.12.01/include/configs/am335x_evm.h", gave it a try and unfortunately made no difference in the results. Will keep experimenting, thanks - Anthony

  • Hi Antony

    I am working on Am335x evm board using ti sdk 8.0 . I am facing issue similar issue for ubifsmount command for SPI- NOR winbound flash "W25Q64CV with page size 256 Bytes, erase size 4 KiB, total 8 MiB".

    Have you solved this issue.
    Attaching the logs obtained

    U-Boot# ubi part rootfs
    UBI: attaching mtd1 to ubi0
    UBI: physical eraseblock size: 65536 bytes (64 KiB)
    UBI: logical eraseblock size: 65534 bytes
    UBI: smallest flash I/O unit: 1
    UBI: VID header offset: 64 (aligned 64)
    UBI: data offset: 128
    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=5"
    UBI: MTD device size: 4 MiB
    UBI: number of good PEBs: 66
    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: 62
    UBI: total number of reserved PEBs: 4
    UBI: number of PEBs reserved for bad PEB handling: 0
    UBI: max/mean erase counter: 1/0
    U-Boot# ubi create rootfs
    No size specified -> Using max size (4063108)
    Creating dynamic volume rootfs of size 4063108
    U-Boot# fatload mmc 0 ${loadaddr} ubi.img
    reading ubi.img
    2949120 bytes read in 277 ms (10.2 MiB/s)
    U-Boot# ubi write ${loadaddr} rootfs 0x2e0000
    3014656 bytes written to volume rootfs
    U-Boot# ubi info l
    UBI: volume information dump:
    UBI: vol_id 0
    UBI: reserved_pebs 62
    UBI: alignment 1
    UBI: data_pad 0
    UBI: vol_type 3
    UBI: name_len 6
    UBI: usable_leb_size 65534
    UBI: used_ebs 62
    UBI: used_bytes 4063108
    UBI: last_eb_bytes 65534
    UBI: corrupted 0
    UBI: upd_marker 0
    UBI: name rootfs

    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 65534
    UBI: used_ebs 2
    UBI: used_bytes 131068
    UBI: last_eb_bytes 2
    UBI: corrupted 0
    UBI: upd_marker 0
    UBI: name layout volume

    U-Boot# ubifsmount ubi0: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
    UBIFS error (pid 0): ubifs_mount: Error reading superblock on volume 'ubi0:rootfs' errno=-22!

    ubifsmount - mount UBIFS volume


    Could you please help us to rectify the problem.
    Any one having any input please let us know.

    Regards
    Jeffin