Specifications
device nand0 <gpmi-nand>, # parts = 5
#: name size offset mask_flags
0: bootloader 0x00300000 0x00000000 1
1: environment 0x00080000 0x00300000 0
2: redundant-environment0x00080000 0x00380000 0
3: kernel 0x00400000 0x00400000 0
4: filesystem 0x0f800000 0x00800000 0
active partition: nand0,0 - (bootloader) 0x00300000 @ 0x00000000
defaults:
mtdids : nand0=gpmi-nand
mtdparts: mtdparts=gpmi-nand:3m(bootloader)ro,512k(environment),512k(redundant-environment),4m(kernel),-(filesystem)
=>
U-Boot provides the following command line interface to UBI:
=> help ubi
ubi - ubi commands
Usage:
ubi part [part] [offset]
- Show or set current partition (with optional VID header offset)
ubi info [l[ayout]] - Display volume and ubi layout information
ubi create[vol] volume [size] [type] - create volume name with size
ubi write[vol] address volume size - Write volume from address with size
ubi read[vol] address volume [size] - Read volume to address with size
ubi remove[vol] volume - Remove volume
[Legends]
volume: character name
size: specified in bytes
type: s[tatic] or d[ynamic] (default=dynamic)
=>
To make a UBI device available to U-Boot it needs to be attached. This is done using the "ubi part" command.
If an UBI device exists on the specified MTD partition it will be attached, otherwise a new UBI device will be
created.
* WARNING * "ubi part" will, without any warning, overwrite any existing data and create a new UBI
device if you run it on a partition that does not contain an UBI device yet.
Let's attach the "userfs" partition to UBI:
=> ubi part filesystem 2048
Creating 1 MTD partitions on "nand0":
0x000000800000-0x000010000000 : "mtd=4"
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: 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=4"
UBI: MTD device size: 248 MiB
UBI: number of good PEBs: 1984
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
5.9.3.6. UBI Usage in U-Boot 55