Skip to content

Commit

Permalink
UBI: R/O block driver on top of UBI volumes
Browse files Browse the repository at this point in the history
This commit introduces read-only block device emulation on top of UBI volumes.

Given UBI takes care of wear leveling and bad block management it's possible
to add a thin layer to enable block device access to UBI volumes.
This allows to use a block-oriented filesystem on a flash device.

The UBI block devices are meant to be used in conjunction with any
regular, block-oriented file system (e.g. ext4), although it's primarily
targeted at read-only file systems, such as squashfs.

Block devices are created upon user request through new ioctls:
UBI_IOCVOLATTBLK to attach and UBI_IOCVOLDETBLK to detach.
Also, a new UBI module parameter is added 'ubi.block'. This parameter is
needed in order to attach a block device on boot-up time, allowing to
mount the rootfs on a ubiblock device.
For instance, you could have these kernel parameters:

  ubi.mtd=5 ubi.block=0,0 root=/dev/ubiblock0_0

Or, if you compile ubi as a module:

  $ modprobe ubi mtd=/dev/mtd5 block=/dev/ubi0_0

Artem: amend commentaries and massage the patch a little bit.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
  • Loading branch information
Ezequiel Garcia authored and Artem Bityutskiy committed Feb 28, 2014
1 parent 5547fec commit 9d54c8a
Show file tree
Hide file tree
Showing 7 changed files with 718 additions and 0 deletions.
15 changes: 15 additions & 0 deletions drivers/mtd/ubi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,19 @@ config MTD_UBI_GLUEBI
work on top of UBI. Do not enable this unless you use legacy
software.

config MTD_UBI_BLOCK
bool "Read-only block devices on top of UBI volumes"
default n
help
This option enables read-only UBI block devices support. UBI block
devices will be layered on top of UBI volumes, which means that the
UBI driver will transparently handle things like bad eraseblocks and
bit-flips. You can put any block-oriented file system on top of UBI
volumes in read-only mode (e.g., ext4), but it is probably most
practical for read-only file systems, like squashfs.

When selected, this feature will be built in the UBI driver.

If in doubt, say "N".

endif # MTD_UBI
1 change: 1 addition & 0 deletions drivers/mtd/ubi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ obj-$(CONFIG_MTD_UBI) += ubi.o
ubi-y += vtbl.o vmt.o upd.o build.o cdev.o kapi.o eba.o io.o wl.o attach.o
ubi-y += misc.o debug.o
ubi-$(CONFIG_MTD_UBI_FASTMAP) += fastmap.o
ubi-$(CONFIG_MTD_UBI_BLOCK) += block.o

obj-$(CONFIG_MTD_UBI_GLUEBI) += gluebi.o
Loading

0 comments on commit 9d54c8a

Please sign in to comment.