How to mount the ubi File System
Address: http://blog.sina.com.cn/s/blog_5d9051c00100ejvj.html
Mtd and ubi interfaces in Linux:
(1) cat/proc/mtd: You can see the mtd of the current system,
(2) cat/proc/partitions: partition information, similar to the preceding
(3) cat/sys/class/ubi/ubi0/*: ubi of the current system
(4) ls/dev/* to view device nodes
Suppose we want to load the ubifs File System on mtdblock1, the steps are as follows:
(1)./ubiformat/dev/mtd1 ----- format mtdblock1
(2)./ubiattach/dev/ubi_ctrl-m 1 ----- connect mtdblock1 to ubi. The command output is as follows:
[2, 977.342492] UBI: attaching mtd1 to ubi2
[977.346417] UBI: physical eraseblock size: 131072 bytes (128 KiB)
[977.352631] UBI: logical eraseblock size: 126976 bytes
[977.357948] UBI: smallest flash I/O unit: 2048
UBI device number 2, total 2000 LEBs (253952000 bytes, 242.2 MiB), available 1976 LEBs (250904576 bytes, 239.3 MiB), LEB size 126976 bytes (124.0 KiB)
The system automatically associates mtd1 with ubi2. Assume that ubi0 and ubi1 already exist in the system.
(3) ls/sys/class/ubi/----- You Can See That a ubi2 subdirectory is added to this directory.
(4) cat/sys/class/ubi/ubi2/dev ----- You can obtain the Primary and Secondary device numbers of the ubi2 device, such as 249: 0.
(5) cat/sys/class/ubi/ubi2/volumes_count ----- the result is 0, indicating that there is no volume on the ubi.
(6) ls/dev/ubi * ----- create "mknod/dev/ubi2 c 249 0" manually if/dev does not contain ubi2"
(7)./ubimkvol/dev/ubi2-s 100MiB-N my_ubi_vol ----- create a volume on ubi2
(8) ls/sys/class/ubi/----- You Can See That a directory named ubi2_0 is added under this directory, which indicates the first volume on ubi2, if "cat/sys/class/ubi/ubi2_0/name" is used, you can get "my_ubi_vol", which is the name in (7.
(9) cat/sys/class/ubi/ubi2_0/dev ----- obtain the Primary and Secondary device numbers of the volume, such as 249: 1
(10) mknod/dev/ubi2_0 c 249 1 ----- if/dev does not contain ubi2_0, You need to manually create
(11) mount-t ubifs ubi2_0/mnt ----- mount ubi2_0 to the local directory/mnt,
(12) mount ----- You Can See That ubi2_0 is successfully mounted on/mnt.
Now ubifs is successfully loaded.