From patchwork Sun Feb 16 20:04:01 2014
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Ezequiel Garcia mtdblock
unless you
know exactly what you are doing.
Instead, you may find the block interface provided by UBI
+useful. Please refer to the UBI section for more
+details.
There is also a read-only version of this driver which doesn't have the capacity to do the caching and erase/writeback, mainly for use with uCLinux where the extra RAM requirement was considered too large.
diff --git a/doc/ubi.xml b/doc/ubi.xml index f55c04a..dd06927 100644 --- a/doc/ubi.xml +++ b/doc/ubi.xml @@ -47,6 +47,7 @@UBI also provides a block interface that allows regular, block-oriented +filesystems to be mounted on top of an UBI volume. This is possible because UBI +handles bad-blocks transparently. This block interface does not peform any +wear-leveling, and therefore write support hasn't been implemented.
+There is an additional driver called gluebi
which emulates MTD
devices on top of UBI volumes. This looks a little strange, because UBI works
on top of an MTD device, then gluebi
emulates other MTD devices
@@ -236,6 +242,8 @@ sub-directory.
ubiattach
does);
ubimkvol
- creates UBI volumes on UBI devices;ubirmvol
- removes UBI volumes from UBI devices;ubiblkvol
- manages block interfaces for UBI volumes.
+ See here for more information;ubiupdatevol
- updates UBI volumes; this tool uses the
UBI volume update feature which
leaves the volume in "corrupted" state if the update was interrupted;
@@ -1261,6 +1269,65 @@ second. Therefore, fastmap makes only sense on fast and large flash devices
where a full scan takes too long. E.g. On 4GiB NAND chips a full scan takes
several seconds whereas a fast attach needs less than one second.
+UBI allows to create a block device on top of each UBI volume. The block +interface implementation currently has the following limitations: + +
Write-support is still under discussion and might be implemented in a +near future.
+ +Regarding the serialized, uncached operation, keep in mind the NAND driver core +already serializes all I/O anyway. In addition, filesystems usually provides +a much better caching. For these reasons, it's expected that these limitations +won't impact performance heavily.
+ +Despite these limitations, a block interface is still very useful to mount +read-only, regular filesystems on top of UBI volumes. This is the case +of squashfs, which can be used as a lightweigth read-only rootfs on a NAND +device.
+ +Attaching and detaching a block interface on a UBI volume is fairly easy.
+You can do this either by using the block
UBI module parameter
+or with the ubiblkvol
user-space tool.
In order to attach a block device on bootup time (e.g. to mount the rootfs
+on such a block device) you can specify the block
parameter as
+a kernel boot arguments:
ubi.mtd=5 ubi.block=0,0 root=/dev/ubiblock0_0
There are several ways if specifying a volume:
+Using the UBI volume path:
+ubi.block=/dev/ubi0_0
Using the UBI device, and the volume name:
+ubi.block=0,rootfs
Using both UBI device number and UBI volume number:
+ubi.block=0,0
If you've built UBI as a module you can use this parameter at module insertion +time:
+ +$ modprobe ubi mtd=/dev/mtd5 block=/dev/ubi0_0
+
+A block interface can also be attached/detached dynamically at runtime, using
+the ubiblkvol
user-space tool:
$ ubiblkvol --attach /dev/ubi0_0
$ ubiblkvol --detach /dev/ubi0_0
Unfortunately, there are no thorough and strict UBI documents. But there is diff --git a/faq/ubi.xml b/faq/ubi.xml index 2832928..69f5495 100644 --- a/faq/ubi.xml +++ b/faq/ubi.xml @@ -18,6 +18,7 @@
But it is much easier to implement FTL on top of UBI than on top of MTD, -because UBI takes care about many flash complexities and makes it -possible to concentrate on on upper-level issues rather then solving flash -media problems like wear-leveling, bit-flips, bad eraseblocks, etc.
- --This e-mail describes an idea of a simple FTL layer on top of UBI.
+However, given UBI takes care of many flash complexities, it provides a +bad-block-free block interface on top of UBI volumes. This feature is useful to +mount read-only filesystems.
+Yes. UBI allows to create a read-only block interface on top of a UBI volume +which is suitable for read-only block-oriented filesystems, such as squashfs. +See the UBI block interface section for more details.