Skip to content

Commit

Permalink
block: add uImage.FIT subimage block driver
Browse files Browse the repository at this point in the history
Add a small block driver which exposes filesystem sub-images contained
in U-Boot uImage.FIT images as block devices.

The uImage.FIT image has to be stored directly on a block device or
partition, MTD device or partition, or UBI volume.

The driver is intended for systems using the U-Boot bootloader and
uses the root device hint left by the bootloader (or the user) in
the 'chosen' section of the device-tree.

Example:
/dts-v1/;
/ {
        chosen {
                rootdisk = <&mmc1 6>;
        };
};

Here partition 6 is used on a block device which is a descendant of the
device node referenced by &mmc1.

For MTD devices the mtdblock driver needs to be present. Use argument
-1 to indicate using the mtdblock device as lower device, e.g.:
    rootdisk = <&fit_part (-1)>;

For UBI volume 3 if the ubiblock driver needs to be present and the
ubiblock volume needs to be created via cmdline. Then it can be
referenced by the MTD device or partition hosting the UBI device and
the UBI volume ID as argument, e.g.:
    rootdisk = <&ubi_part 3>;

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  • Loading branch information
dangowrt committed Mar 30, 2023
1 parent 5b449cf commit 8a70f52
Show file tree
Hide file tree
Showing 4 changed files with 609 additions and 0 deletions.
6 changes: 6 additions & 0 deletions MAINTAINERS
Expand Up @@ -21453,6 +21453,12 @@ F: Documentation/filesystems/ubifs-authentication.rst
F: Documentation/filesystems/ubifs.rst
F: fs/ubifs/

U-BOOT UIMAGE.FIT PARSER
M: Daniel Golle <daniel@makrotopia.org>
L: linux-block@vger.kernel.org
S: Maintained
F: drivers/block/fitblk.c

UBLK USERSPACE BLOCK DRIVER
M: Ming Lei <ming.lei@redhat.com>
L: linux-block@vger.kernel.org
Expand Down
12 changes: 12 additions & 0 deletions drivers/block/Kconfig
Expand Up @@ -354,6 +354,18 @@ config VIRTIO_BLK
This is the virtual block driver for virtio. It can be used with
QEMU based VMMs (like KVM or Xen). Say Y or M.

config UIMAGE_FIT_BLK
bool "uImage.FIT block driver"
help
This driver allows using filesystems contained in uImage.FIT images
by mapping them as block devices.

It can currently not be built as a module due to libfdt symbols not
being exported.

Say Y if you want to mount filesystems sub-images of a uImage.FIT
stored in a block device partition, mtdblock or ubiblock device.

config BLK_DEV_RBD
tristate "Rados block device (RBD)"
depends on INET && BLOCK
Expand Down
2 changes: 2 additions & 0 deletions drivers/block/Makefile
Expand Up @@ -39,4 +39,6 @@ obj-$(CONFIG_BLK_DEV_NULL_BLK) += null_blk/

obj-$(CONFIG_BLK_DEV_UBLK) += ublk_drv.o

obj-$(CONFIG_UIMAGE_FIT_BLK) += fitblk.o

swim_mod-y := swim.o swim_asm.o

0 comments on commit 8a70f52

Please sign in to comment.