public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Daniel Golle <daniel@makrotopia.org>
To: Marek Vasut <marek.vasut@mailbox.org>
Cc: "Tom Rini" <trini@konsulko.com>, "Simon Glass" <sjg@chromium.org>,
	"Quentin Schulz" <quentin.schulz@cherry.de>,
	"Kory Maincent" <kory.maincent@bootlin.com>,
	"Mattijs Korpershoek" <mkorpershoek@kernel.org>,
	"Martin Schwan" <m.schwan@phytec.de>,
	"Anshul Dalal" <anshuld@ti.com>,
	"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
	"Sughosh Ganu" <sughosh.ganu@arm.com>,
	"Aristo Chen" <jj251510319013@gmail.com>,
	"牛 志宏" <Zone.Niuzh@hotmail.com>,
	"Heinrich Schuchardt" <xypron.glpk@gmx.de>,
	"Wolfgang Wallner" <wolfgang.wallner@at.abb.com>,
	"Frank Wunderlich" <frank-w@public-files.de>,
	"David Lechner" <dlechner@baylibre.com>,
	"Osama Abdelkader" <osama.abdelkader@gmail.com>,
	"Mikhail Kshevetskiy" <mikhail.kshevetskiy@iopsys.eu>,
	"Michael Trimarchi" <michael@amarulasolutions.com>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Andrew Goodbody" <andrew.goodbody@linaro.org>,
	"Yegor Yefremov" <yegorslists@googlemail.com>,
	"Mike Looijmans" <mike.looijmans@topic.nl>,
	"Weijie Gao" <weijie.gao@mediatek.com>,
	"Alexander Stein" <alexander.stein@ew.tq-group.com>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Mayuresh Chitale" <mchitale@ventanamicro.com>,
	"Paul HENRYS" <paul.henrys_ext@softathome.com>,
	u-boot@lists.denx.de, "John Crispin" <john@phrozen.org>,
	"Paul Spooren" <mail@aparcar.org>
Subject: Re: [RFC PATCH 00/20] boot: add OpenWrt boot method and on-demand FIT loading
Date: Tue, 17 Feb 2026 13:02:12 +0000	[thread overview]
Message-ID: <aZRm1DVkEgUtInqt@makrotopia.org> (raw)
In-Reply-To: <dd636864-2e3e-4701-9e42-fd32353afe92@mailbox.org>

On Tue, Feb 17, 2026 at 03:04:09AM +0100, Marek Vasut wrote:
> On 2/17/26 2:18 AM, Daniel Golle wrote:
> > Hi Marek,
> > 
> > thanks for taking a look at the series!
> > 
> > Let me reply inline below:
> > 
> > On Mon, Feb 16, 2026 at 11:16:24PM +0100, Marek Vasut wrote:
> > > On 2/16/26 10:21 PM, Daniel Golle wrote:
> > > 
> > > Hi,
> > > 
> > > > This RFC series adds a new boot method for OpenWrt's "uImage.FIT with
> > > > embedded rootfs" firmware model, along with the underlying infrastructure
> > > > to load FIT images on-demand directly from storage devices without copying
> > > > them entirely to RAM first.
> > > > 
> > > > I would like to discuss the design with U-Boot maintainers and fellow
> > > > OpenWrt developers before submitting a formal patch series.
> > > 
> > > [...]
> > > 
> > > > 4. On-demand loading: None of the existing methods support loading FIT
> > > >      subimages directly from storage. OpenWrt's FIT images typically
> > > >      contain a 5-20 MB squashfs that does NOT need to be copied to RAM —
> > > >      the kernel maps it directly from flash. The bootloader only needs
> > > >      to load the kernel and DTB (~5-10 MB), not the entire 20-50 MB
> > > >      container. This requires a new loading abstraction.
> > > 
> > > Isn't this partial loading exactly what SPL does when the fitImage is
> > > generated with external data (mkimage -E) ? SPL loads and traverses the
> > > tree, and then loads the remaining chunks (files) only when needed if I
> > > recall it right ?
> > 
> > Yes, the image_loader abstraction in this series is essentially the
> > main-U-Boot equivalent of SPL's spl_load_info.read(), adapted for the
> > richer set of storage backends, byte-addressed, providing an interface
> > for both "load this to where ever" and "load this to a specific target
> > address" (image_loader_map() vs. image_loader_map_to()), and the full
> > fit_image_load() verification pipeline. The integration point in
> > fit_image_load() (patch 09/20) is ~50 lines of new code gated by if
> > (images->loader && external_data) - it reuses all existing FIT property
> > parsing, load address negotiation, and hash verification unchanged.
> > 
> > That said, the image_loader abstraction itself is format-agnostic - it
> > only deals with byte offsets, lengths, and RAM destinations. The same
> > three storage backends could be wired into other executable formats with
> > minimal effort, such as ELF, legacy uImage or UEFI PE.
> > 
> > Likewise, adding a backend based on fs_read() would be trivial,
> > extending U-Boot's wget to support range requests and using it as
> > image_loader backend would not be hard either.
> > 
> > > Can that SPL code be reused instead ?
> > 
> > I considered factoring out a shared "FIT external data reader" between
> > SPL and U-Boot proper, but the two callers want fundamentally different
> > things: SPL wants minimal code size and populates spl_image_info; U-Boot
> > proper wants full verification and populates bootm_headers.
> 
> I suspect the feature set of each loading stage can be configured e.g. using
> "if (IS_ENABLED(...))" to keep the size under control ?
> 
> I would be very happy if we could have ONE consistent code base used for
> loading in all of TPL/SPL/U-Boot . Custom special loader in U-Boot and
> different special loader in SPL and so on, will only lead to inconsistency
> and increased maintenance burden. Worse, it will lead to obscure bugs which
> will differ between U-Boot and SPL, or bugs being fixed in one and not the
> other.

This implies changing the parameter "ulong sector" to a byte offset,
which means all existing readers and users will have to be changed as
well, and also code to deal with unaligned start offsets will have to be
added. Other than that it's mostly a matter of adding some #ifdef-ery,
conditionally extending struct spl_load_info with
 - a cleanup callback function pointer
 - alloc_ptr for bump allocator
 - the array of already mapped regions

None of that is used by the readers, so the low-level spl_mmc reader
could be reused and extended -- but it's already very messy with many
hacks and special cases, it's own device and partition hunters, ...
and would basically need adding almost all of the code which is currently
in image-loader-blk.c (to handle the unaligned start offset, ...)

The other SPL readers are even more unsuitable:

 - The SPI-NOR and NOR readers lack support for MTD partitions, instead
   they are using a downstream DT property to specify *one* static offset
   ('u-boot,spl-payload-offset')

 - The UBI reader deals only with static UBI volumes, and support for UBI
   in SPL is a light-weight minimal thing incompatible with the full UBI
   implementation in U-Boot proper.

 - The FIT reader in SPL uses a very different approach from the
   image_loader approach I suggested. It is basically a minimal
   implementation of a FIT parser, while I'm suggesting to glue
   support for the image_loader into boot/image-fit.c of U-Boot proper,
   hence keeping and reusing all of its features.
   See patch "boot: fit: support on-demand loading in fit_image_load()".

So there really isn't much overlap other than the fact that there is a
struct with a priv pointer and a .read callback, and even that uses a
different addressing parameter (sectors vs. bytes).

Imho, trying to unite the two "with a hammer" will do more harm than good.

  reply	other threads:[~2026-02-17 13:03 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-16 21:21 [RFC PATCH 00/20] boot: add OpenWrt boot method and on-demand FIT loading Daniel Golle
2026-02-16 21:21 ` [RFC PATCH 01/20] boot: add image_loader on-demand loading abstraction Daniel Golle
2026-02-19 13:09   ` Simon Glass
2026-02-16 21:21 ` [RFC PATCH 02/20] boot: image-loader: add block device backend Daniel Golle
2026-02-19 13:09   ` Simon Glass
2026-02-16 21:21 ` [RFC PATCH 03/20] mtd: add mtd_read_skip_bad() helper Daniel Golle
2026-02-16 21:21 ` [RFC PATCH 04/20] boot: image-loader: add MTD backend Daniel Golle
2026-02-16 21:21 ` [RFC PATCH 05/20] cmd: ubi: export ubi_find_volume() Daniel Golle
2026-02-19 13:09   ` Simon Glass
2026-02-16 21:22 ` [RFC PATCH 06/20] mtd: set flash_node on DT-created partitions Daniel Golle
2026-02-16 21:22 ` [RFC PATCH 07/20] cmd: ubi: add ubi_part_from_mtd() Daniel Golle
2026-02-16 21:22 ` [RFC PATCH 08/20] boot: image-loader: add UBI volume backend Daniel Golle
2026-02-19 13:09   ` Simon Glass
2026-02-19 16:51     ` Daniel Golle
2026-02-23 17:51       ` Simon Glass
2026-02-23 19:24         ` Daniel Golle
2026-02-23 19:30           ` Mikhail Kshevetskiy
2026-02-23 19:32             ` Mikhail Kshevetskiy
2026-02-24  0:12               ` Daniel Golle
2026-02-24  0:40                 ` Mikhail Kshevetskiy
2026-02-24  1:06                   ` Daniel Golle
2026-02-23 20:06             ` Daniel Golle
2026-02-16 21:22 ` [RFC PATCH 09/20] boot: fit: support on-demand loading in fit_image_load() Daniel Golle
2026-02-19 13:09   ` Simon Glass
2026-02-19 16:47     ` Daniel Golle
2026-02-23 17:51       ` Simon Glass
2026-02-24 12:41         ` Daniel Golle
2026-02-16 21:22 ` [RFC PATCH 10/20] cmd: bootm: accept storage device as image source Daniel Golle
2026-02-19 13:09   ` Simon Glass
2026-02-16 21:22 ` [RFC PATCH 11/20] test: boot: add image_loader unit tests Daniel Golle
2026-02-17 19:05   ` Tom Rini
2026-02-19 13:10   ` Simon Glass
2026-02-19 14:04     ` Tom Rini
2026-02-19 14:34       ` Simon Glass
2026-02-19 15:41         ` Tom Rini
2026-02-16 21:23 ` [RFC PATCH 12/20] doc: bootm: document direct storage boot Daniel Golle
2026-02-16 21:23 ` [RFC PATCH 13/20] boot: bootmeth: add OpenWrt boot method skeleton Daniel Golle
2026-02-19 13:09   ` Simon Glass
2026-02-19 14:00     ` Tom Rini
2026-02-19 14:31       ` Simon Glass
2026-02-19 15:31         ` Tom Rini
2026-02-19 16:52     ` Daniel Golle
2026-02-16 21:23 ` [RFC PATCH 14/20] boot: bootmeth: openwrt: implement read_bootflow for block devices Daniel Golle
2026-02-19 13:09   ` Simon Glass
2026-02-16 21:23 ` [RFC PATCH 15/20] boot: bootmeth: openwrt: implement boot via bootm storage path Daniel Golle
2026-02-19 13:09   ` Simon Glass
2026-02-16 21:23 ` [RFC PATCH 16/20] boot: bootdev: add MTD boot device Daniel Golle
2026-02-19 13:09   ` Simon Glass
2026-02-16 21:24 ` [RFC PATCH 17/20] boot: bootdev: add UBI " Daniel Golle
2026-02-19 13:09   ` Simon Glass
2026-02-19 16:56     ` Daniel Golle
2026-02-23 17:51       ` Simon Glass
2026-02-16 21:24 ` [RFC PATCH 18/20] boot: bootmeth: openwrt: support MTD and UBI bootdevs Daniel Golle
2026-02-19 13:09   ` Simon Glass
2026-02-16 21:24 ` [RFC PATCH 19/20] boot: bootmeth: openwrt: add openwrt_boot_script hook for bootconf Daniel Golle
2026-02-19 13:11   ` Simon Glass
2026-02-16 21:24 ` [RFC PATCH 20/20] boot: bootmeth: openwrt: add slot configuration from environment Daniel Golle
2026-02-19 13:11   ` Simon Glass
2026-02-16 22:16 ` [RFC PATCH 00/20] boot: add OpenWrt boot method and on-demand FIT loading Marek Vasut
2026-02-17  1:18   ` Daniel Golle
2026-02-17  2:04     ` Marek Vasut
2026-02-17 13:02       ` Daniel Golle [this message]
2026-02-17 19:15         ` Tom Rini
2026-02-17 13:32 ` Simon Glass
2026-02-17 15:08 ` Tom Rini
2026-02-17 17:46 ` Tom Rini
2026-02-23 19:32   ` Tom Rini
2026-02-24 11:57     ` Daniel Golle
2026-02-24 17:24       ` Tom Rini
2026-02-25 14:34         ` Daniel Golle
2026-02-25 22:16           ` Tom Rini
2026-02-25 23:49             ` Daniel Golle
2026-02-26 18:45               ` Tom Rini
2026-02-26 23:44                 ` Simon Glass
2026-02-17 18:13 ` Tom Rini
2026-02-17 19:28   ` Daniel Golle
2026-02-17 19:35     ` Tom Rini
2026-02-17 21:07       ` Daniel Golle
2026-02-17 21:18         ` Tom Rini
     [not found]           ` <aZTqyRfqYe1iJ9EY@makrotopia.org>
2026-02-18 15:58             ` Tom Rini
2026-02-18 17:25               ` Daniel Golle
2026-02-18 20:33                 ` Tom Rini
2026-02-24  0:37                   ` Daniel Golle
2026-02-24 14:24                     ` Tom Rini
2026-02-24 14:36                       ` Daniel Golle
2026-02-18 23:08                 ` Daniel Golle
2026-02-19 15:29                   ` Tom Rini
2026-02-17 19:20 ` Tom Rini

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=aZRm1DVkEgUtInqt@makrotopia.org \
    --to=daniel@makrotopia.org \
    --cc=Zone.Niuzh@hotmail.com \
    --cc=alexander.stein@ew.tq-group.com \
    --cc=andrew.goodbody@linaro.org \
    --cc=anshuld@ti.com \
    --cc=dlechner@baylibre.com \
    --cc=frank-w@public-files.de \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jj251510319013@gmail.com \
    --cc=john@phrozen.org \
    --cc=kory.maincent@bootlin.com \
    --cc=m.schwan@phytec.de \
    --cc=mail@aparcar.org \
    --cc=marek.vasut@mailbox.org \
    --cc=mchitale@ventanamicro.com \
    --cc=michael@amarulasolutions.com \
    --cc=mike.looijmans@topic.nl \
    --cc=mikhail.kshevetskiy@iopsys.eu \
    --cc=miquel.raynal@bootlin.com \
    --cc=mkorpershoek@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=osama.abdelkader@gmail.com \
    --cc=paul.henrys_ext@softathome.com \
    --cc=quentin.schulz@cherry.de \
    --cc=sjg@chromium.org \
    --cc=sughosh.ganu@arm.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=weijie.gao@mediatek.com \
    --cc=wolfgang.wallner@at.abb.com \
    --cc=xypron.glpk@gmx.de \
    --cc=yegorslists@googlemail.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