From: Daniel Golle <daniel@makrotopia.org>
To: Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,
Daniel Golle <daniel@makrotopia.org>,
Dario Binacchi <dario.binacchi@amarulasolutions.com>,
Michael Trimarchi <michael@amarulasolutions.com>,
Frieder Schrempf <frieder.schrempf@kontron.de>,
Quentin Schulz <quentin.schulz@cherry.de>,
Marek Vasut <marek.vasut+renesas@mailbox.org>,
"Lucien.Jheng" <lucienzx159@gmail.com>,
Casey Connolly <casey.connolly@linaro.org>,
Michal Simek <michal.simek@amd.com>,
Johan Jonker <jbx6244@gmail.com>,
Aristo Chen <aristo.chen@canonical.com>,
Nora Schiffer <nora.schiffer@ew.tq-group.com>,
Rasmus Villemoes <rv@rasmusvillemoes.dk>,
Weijie Gao <weijie.gao@mediatek.com>, Peng Fan <peng.fan@nxp.com>,
Vincent Jardin <vjardin@free.fr>,
Neil Armstrong <neil.armstrong@linaro.org>,
Randolph Sapp <rs@ti.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Genoud <richard.genoud@bootlin.com>,
u-boot@lists.u-boot-project.org, openwrt-devel@lists.openwrt.org
Subject: [PATCH 0/9] boot: add imagemap on-demand image loading from storage
Date: Sun, 23 Aug 2026 20:12:43 +0100 [thread overview]
Message-ID: <cover.1787272661.git.daniel@makrotopia.org> (raw)
This series adds "imagemap", a small layer for reading FIT images
directly from storage on demand instead of copying the whole image
into RAM first. It keeps a translation table of the byte ranges
already loaded, so a header probe, signature verification and the
final load can reuse a single read, and it hooks transparently into
fit_image_load() so all existing verification and decompression paths
run unchanged for both RAM- and storage-backed images.
An imagemap device is created over a partition of a block device. That
covers more than raw disks: an MTD partition is reached through
mtdblock and a UBI volume through ubiblock, each exposed as a named
block-device partition, so imagemap carries no storage-specific code
of its own. NAND bad-block handling and wear-levelling stay with UBI,
as they do elsewhere in U-Boot; on NOR a partition is read linearly
with end-to-end integrity guaranteed by the FIT hash or signature.
To make those two paths reachable and testable, the first patches fill
in the missing block devices: a non-NAND MTD master now gets an
mtd_blk device automatically (patch 1), and attaching UBI now binds a
ubi_blk device on any flash (patch 3, which makes the SPI-NAND-only
eager binding redundant, dropped in patch 4).
The read path is built on the SPL struct spl_load_info abstraction and
a new spl_load_region() helper. imagemap is full-U-Boot only; the SPL
FIT loader is unaffected.
Testing (sandbox): "ut imagemap" (13 tests) covers the
translation-table core plus real end-to-end reads of a NOR partition
through mtd_blk and a UBI volume through ubiblock; a CONFIG_IMAGEMAP=n
build is unaffected.
On hardware it has been tested end-to-end on a BananaPi R3 (mt7986),
booting a dm-verity-protected rootfs from every storage path the board
exposes: eMMC and SD (block partition), SPI-NAND (UBI volume via
ubiblock) and SPI-NOR (raw MTD partition via mtdblock). The first
in-tree consumer, a bootmeth for OpenWrt-style FIT firmware, will
follow as a separate series.
This series began as part of a combined RFC that also carried the
OpenWrt boot method and its bootdevs [1]. Following the review there
it has been reworked substantially:
- Build on U-Boot's existing SPL external-data loading path rather
than a new abstraction: imagemap now uses struct spl_load_info and
a new spl_load_region() helper (suggested by Marek Vasut).
- Do not extend the bootm command with a storage source; on-demand
loading hooks into fit_image_load() transparently, and the in-tree
consumer is a bootstd boot method reached through
bootflow/bootdev/bootmeth rather than new bootm syntax (per Tom
Rini).
- Move the storage-backed path out of the long fit_image_load() into
its own helper, gated with if()/tools_build() instead of an inline
#if (per Simon Glass).
- Collapse the three storage-specific backends (block, MTD and UBI)
into a single block backend: NOR is read through mtd_blk and
SPI-NAND through UBI/ubiblock, so imagemap holds no
storage-specific code.
- Send the on-demand loading core on its own; the OpenWrt boot
method, the MTD/UBI bootdevs and board enablement follow as
separate series once this lands.
In order to test imagemap end-to-end with the intended bootmeth user
I'm still relying on the downstream install-uuid mechanism of [2],
which [3] could supersede. Both have stalled right now.
[1] https://lore.kernel.org/u-boot/cover.1771275704.git.daniel@makrotopia.org/
[2] https://github.com/open-source-firmware/flat-image-tree/pull/40
[3] https://github.com/open-source-firmware/flat-image-tree/pull/44
Based on u-boot/next.
Daniel Golle (9):
mtd: bind an mtd_blk device for non-NAND MTD masters
mtd: nand: sandbox: forbid sub-page writes
cmd: ubi: create a ubi_blk device when attaching UBI
mtd: nand: spi: drop the eager ubi_blk binding
boot: add imagemap on-demand loading from storage
boot: fit: support on-demand loading in fit_image_load()
configs: sandbox: enable imagemap and its storage backends
test: boot: add imagemap unit tests
doc: imagemap: document on-demand loading framework
MAINTAINERS | 9 +
arch/sandbox/dts/test.dts | 29 ++
boot/Kconfig | 16 +
boot/Makefile | 2 +
boot/bootm.c | 70 +++-
boot/image-fit.c | 109 +++++-
boot/imagemap.c | 451 +++++++++++++++++++++
cmd/ubi.c | 27 ++
configs/sandbox_defconfig | 6 +
doc/develop/imagemap.rst | 100 +++++
doc/develop/index.rst | 1 +
drivers/mtd/mtdcore.c | 24 ++
drivers/mtd/nand/raw/sand_nand.c | 2 +
drivers/mtd/nand/spi/core.c | 3 -
include/bootm.h | 2 +
include/dm/uclass-id.h | 1 +
include/image.h | 2 +
include/imagemap.h | 136 +++++++
include/spl.h | 47 ++-
test/boot/Makefile | 2 +
test/boot/imagemap.c | 645 +++++++++++++++++++++++++++++++
test/cmd_ut.c | 2 +
22 files changed, 1671 insertions(+), 15 deletions(-)
create mode 100644 boot/imagemap.c
create mode 100644 doc/develop/imagemap.rst
create mode 100644 include/imagemap.h
create mode 100644 test/boot/imagemap.c
base-commit: 8841b7b292c74864acf4ed0bd8ce05839252c1f2
--
2.55.0
next reply other threads:[~2026-08-23 19:13 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-23 19:12 Daniel Golle [this message]
2026-08-23 19:13 ` [PATCH 1/9] mtd: bind an mtd_blk device for non-NAND MTD masters Daniel Golle
2026-09-28 15:12 ` Simon Glass
2026-08-23 19:13 ` [PATCH 2/9] mtd: nand: sandbox: forbid sub-page writes Daniel Golle
2026-09-28 15:12 ` Simon Glass
2026-08-23 19:13 ` [PATCH 3/9] cmd: ubi: create a ubi_blk device when attaching UBI Daniel Golle
2026-09-28 15:12 ` Simon Glass
2026-08-23 19:13 ` [PATCH 4/9] mtd: nand: spi: drop the eager ubi_blk binding Daniel Golle
2026-08-23 19:13 ` [PATCH 5/9] boot: add imagemap on-demand loading from storage Daniel Golle
2026-08-24 22:55 ` Tom Rini
2026-09-28 15:12 ` Simon Glass
2026-08-23 19:14 ` [PATCH 6/9] boot: fit: support on-demand loading in fit_image_load() Daniel Golle
2026-09-28 15:12 ` Simon Glass
2026-08-23 19:14 ` [PATCH 7/9] configs: sandbox: enable imagemap and its storage backends Daniel Golle
2026-09-28 15:12 ` Simon Glass
2026-08-23 19:16 ` [PATCH 8/9] test: boot: add imagemap unit tests Daniel Golle
2026-09-28 15:12 ` Simon Glass
2026-08-23 19:16 ` [PATCH 9/9] doc: imagemap: document on-demand loading framework Daniel Golle
2026-09-28 15:17 ` Simon Glass
2026-08-24 22:59 ` [PATCH 0/9] boot: add imagemap on-demand image loading from storage Tom Rini
2026-09-28 15:13 ` [0/9] " Simon Glass
2026-09-29 0:32 ` Daniel Golle
2026-10-01 17:23 ` Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1787272661.git.daniel@makrotopia.org \
--to=daniel@makrotopia.org \
--cc=aristo.chen@canonical.com \
--cc=casey.connolly@linaro.org \
--cc=dario.binacchi@amarulasolutions.com \
--cc=frieder.schrempf@kontron.de \
--cc=jbx6244@gmail.com \
--cc=lucienzx159@gmail.com \
--cc=marek.vasut+renesas@mailbox.org \
--cc=michael@amarulasolutions.com \
--cc=michal.simek@amd.com \
--cc=miquel.raynal@bootlin.com \
--cc=neil.armstrong@linaro.org \
--cc=nora.schiffer@ew.tq-group.com \
--cc=openwrt-devel@lists.openwrt.org \
--cc=peng.fan@nxp.com \
--cc=quentin.schulz@cherry.de \
--cc=richard.genoud@bootlin.com \
--cc=rs@ti.com \
--cc=rv@rasmusvillemoes.dk \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
--cc=vjardin@free.fr \
--cc=weijie.gao@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox