Block maps are a way of looking at various sources of data through the lens of a regular block device. It lets you treat devices that are not block devices, like RAM, as if they were. It also lets you export a slice of an existing block device, which does not have to correspond to a partition boundary, as a new block device.
This is primarily useful because U-Boot's filesystem drivers only operate on block devices, so a block map lets you access filesystems wherever they might be located. The implementation is loosely modeled on Linux's "Device Mapper" subsystem, see the kernel documentation [1] for more information. The primary use-cases are to access filesystem images stored in RAM, and within FIT images stored on disk. See doc/usage/blkmap.rst for more details. The architecture is pluggable, so adding other types of mappings should be quite easy. [1]: https://docs.kernel.org/admin-guide/device-mapper/index.html Tobias Waldekranz (8): image: Fix script execution from FIT images with external data cmd: blk: Allow generic read/write operations to work in sandbox blk: blkmap: Add basic infrastructure blk: blkmap: Add memory mapping support blk: blkmap: Add linear device mapping support cmd: blkmap: Add blkmap command test: blkmap: Add test suite doc: blkmap: Add introduction and examples MAINTAINERS | 9 + boot/image-board.c | 3 +- cmd/Kconfig | 19 ++ cmd/Makefile | 1 + cmd/blk_common.c | 15 +- cmd/blkmap.c | 181 +++++++++++++ configs/sandbox_defconfig | 1 + disk/part.c | 1 + doc/usage/blkmap.rst | 109 ++++++++ doc/usage/index.rst | 1 + drivers/block/Kconfig | 18 ++ drivers/block/Makefile | 1 + drivers/block/blk-uclass.c | 1 + drivers/block/blkmap.c | 452 +++++++++++++++++++++++++++++++ include/blkmap.h | 21 ++ include/dm/uclass-id.h | 1 + include/efi_loader.h | 4 + lib/efi_loader/efi_device_path.c | 30 ++ test/py/tests/test_blkmap.py | 164 +++++++++++ 19 files changed, 1027 insertions(+), 5 deletions(-) create mode 100644 cmd/blkmap.c create mode 100644 doc/usage/blkmap.rst create mode 100644 drivers/block/blkmap.c create mode 100644 include/blkmap.h create mode 100644 test/py/tests/test_blkmap.py -- 2.34.1

