Related concepts and explanations of UBI

Source: Internet
Author: User
Tags reserved

Devices and volumes

The device is the concept of abstraction on MTD, which first needs to be formatted as a UBI device on the MTD partition

Uboot Cmd:ubi Part

Volumes are concepts on UBI devices, and multiple volumes can be created on UBI devices

Uboot Cmd:ubi Create

Mirrors made of mkfs.ubifs are UBI format.

Need to use UBI write or NAND write.ubifs burn write, specifically no test

Ubinize can convert a mirror of the UBI format to a raw mirror that can be burned by normal NAND write

Note that there are PMECC conditions that need to be removed because of ubinize interpolation 0xFF. Use

NAND write.trimffs burned to write.

U-boot> Set Mtdids Nand0=atmel_nand
U-boot> set Mtdparts mtdparts=atmel_nand:8m (Bootstrap), 125M (System),-(UserData)
U-boot> Mtdparts

Device nand0 <atmel_nand>, # parts = 3
#: Name Size offset mask_flags
0:bootstrap 0x00800000 0x00000000 0
1:system 0x07d00000 0x00800000 0
2:userdata 0x07b00000 0x08500000 0

Active partition:nand0,0-(Bootstrap) 0x00800000 @ 0x00000000

Defaults
Mtdids:none
Mtdparts:none
U-boot> NAND
Nand-nand sub-system

Usage:
NAND Info-show available NAND devices
NAND device [Dev]-show or set current device
NAND read-addr off|partition Size
NAND write-addr off|partition Size
Read/write ' size ' bytes starting at offset ' off '
To/from memory address ' addr ' and skipping bad blocks.
NAND read.raw-addr Off|partition [Count]
NAND write.raw-addr Off|partition [Count]
Use Read.raw/write.raw to avoid ECC and access the Flash as-is.
NAND write.trimffs-addr off|partition Size
Write ' size ' bytes starting at offset ' off ' to memory address
' addr ', skipping blocks and dropping any pages at the end
Of eraseblocks that contain only 0xFF
NAND erase[.spread] [clean] off size-erase ' size ' bytes to offset ' off '
With '. Spread ', erase enough for given file size, otherwise,
' Size ' includes skipped bad blocks.
NAND Erase.part [Clean] partition-erase entire MTD partition '
NAND erase.chip [Clean]-erase entire Chip '
NAND Bad-show Bad Blocks
NAND Dump[.oob] Off-dump page
NAND scrub [-y] off size | Scrub.part Partition | Scrub.chip
Really clean NAND erasing blocks (UNSAFE)
NAND Markbad off [...]-mark bad blocks (s) at offset (UNSAFE)
NAND Biterr off-make a bit error at offset (UNSAFE)
u-boot> Ubi Part System
Creating 1 MTD partitions on "nand0":
0x000000800000-0x000008500000: "Mtd=1"
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:125 MiB
Ubi:number of Good pebs:1000
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:123
Ubi:total number of reserved pebs:877
Ubi:number of PEBs reserved for bad PEB handling:10
Ubi:max/mean Erase counter:1/0
U-boot> Ubifsmount System
ubifs:mounted UBI device 0, Volume 0, name "System"
Ubifs:mounted read-only
Ubifs:file system size:108183552 Bytes (105648 KiB, MiB, 852 lebs)
Ubifs:journal size:9023488 bytes (8812 KiB, 8 MiB, Lebs)
Ubifs:media format:w4/r0 (Latest is w4/r0)
Ubifs:default Compressor:lzo
ubifs:reserved for root:0 bytes (0 KiB)
U-boot> Ubi
Ubi ubifsmount ubifsumount Ubifsls ubifsload
U-boot> Ubifsls
<DIR> 3872 Tue Aug 03:36:31 2013 app
<DIR> 11856 Tue Aug 03:30:01 2013 Bin
<DIR> 1752 Tue Aug 03:39:21 2013 etc
<DIR> 12840 Tue Aug 03:39:20 2013 Lib
<DIR> 496 Tue Aug 03:03:59 2013 usr
<DIR> 2296 Tue Aug 03:28:49 2013 XBin
<DIR> 2048 Tue Aug 03:33:58 2013 Framework
26340 Tue Aug 02:56:11 2013 Initlogo.rle
19044 Tue Aug 02:56:11 2013 Initlogo_pda.rle
<DIR> 2096 Tue Aug 03:18:02 2013 fonts
1352 Tue Aug 02:40:59 2013 Build.prop
<DIR> 224 Tue Aug 03:27:29 2013 Vendor
U-boot>

Attachment is an example given by Shenpo

You can also succeed using partitions:

Done
Bytes transferred = 113377280 (6c20000 hex)
U-boot> NAND
Nand-nand sub-system

Usage:
NAND Info-show available NAND devices
NAND device [Dev]-show or set current device
NAND read-addr off|partition Size
NAND write-addr off|partition Size
Read/write ' size ' bytes starting at offset ' off '
To/from memory address ' addr ' and skipping bad blocks.
NAND read.raw-addr Off|partition [Count]
NAND write.raw-addr Off|partition [Count]
Use Read.raw/write.raw to avoid ECC and access the Flash as-is.
NAND write.trimffs-addr off|partition Size
Write ' size ' bytes starting at offset ' off ' to memory address
' addr ', skipping blocks and dropping any pages at the end
Of eraseblocks that contain only 0xFF
NAND erase[.spread] [clean] off size-erase ' size ' bytes to offset ' off '
With '. Spread ', erase enough for given file size, otherwise,
' Size ' includes skipped bad blocks.
NAND Erase.part [Clean] partition-erase entire MTD partition '
NAND erase.chip [Clean]-erase entire Chip '
NAND Bad-show Bad Blocks
NAND Dump[.oob] Off-dump page
NAND scrub [-y] off size | Scrub.part Partition | Scrub.chip
Really clean NAND erasing blocks (UNSAFE)
NAND Markbad off [...]-mark bad blocks (s) at offset (UNSAFE)
NAND Biterr off-make a bit error at offset (UNSAFE)
u-boot> NAND write.trimffs 0x22000000 system 0x6c20000

NAND write:device 0 Offset 0x800000, size 0x6c20000
113377280 bytes Written:ok
u-boot> Ubi Part System
Creating 1 MTD partitions on "nand0":
0x000000800000-0x000008500000: "Mtd=1"
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:125 MiB
Ubi:number of Good pebs:1000
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:123
Ubi:total number of reserved pebs:877
Ubi:number of PEBs reserved for bad PEB handling:10
Ubi:max/mean Erase counter:1/0
U-boot> Ubifsmount System
ubifs:mounted UBI device 0, Volume 0, name "System"
Ubifs:mounted read-only
Ubifs:file system size:108183552 Bytes (105648 KiB, MiB, 852 lebs)
Ubifs:journal size:9023488 bytes (8812 KiB, 8 MiB, Lebs)
Ubifs:media format:w4/r0 (Latest is w4/r0)
Ubifs:default Compressor:lzo
ubifs:reserved for root:0 bytes (0 KiB)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.