public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Daniel Golle <daniel@makrotopia.org>
To: Simon Glass <sjg@chromium.org>
Cc: "Tom Rini" <trini@konsulko.com>,
	"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>,
	"Marek Vasut" <marek.vasut+renesas@mailbox.org>,
	"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 13/20] boot: bootmeth: add OpenWrt boot method skeleton
Date: Thu, 19 Feb 2026 16:52:02 +0000	[thread overview]
Message-ID: <aZc_sh55r2m0QDHS@makrotopia.org> (raw)
In-Reply-To: <CAFLszTiE82Bo1PbvK7Lx7P4Gq=-z+hhgLcgXORtSrYha4R7sBg@mail.gmail.com>

On Thu, Feb 19, 2026 at 06:09:28AM -0700, Simon Glass wrote:
> On Mon, 16 Feb 2026 at 14:23, Daniel Golle <daniel@makrotopia.org> wrote:
> >
> > Add the initial bootmeth_openwrt driver with:
> >
> > - UCLASS_BOOTMETH driver, compatible "u-boot,openwrt"
> > - check(): accept block devices via bootflow_iter_check_blk()
> > - bind(): set BOOTMETHF_ANY_PART so bootstd iterates all partitions
> >   without requiring a filesystem
> > - read_bootflow(): stub returning -ENOENT
> > - boot(): stub returning -ENOSYS
> > - Kconfig: CONFIG_BOOTMETH_OPENWRT depending on FIT, BOOTSTD,
> >   BOOTM_STORAGE
> 
> We don't normally write out this much detail in the code

Yeah, that's Claude does, I'll drop the code description and only keep
the part below.

> 
> >
> > This is the foundation for booting OpenWrt-style uImage.FIT firmware
> > images stored directly on raw storage partitions. The bootmeth will
> > delegate actual image loading to the existing bootm storage path via
> > image_loader.
> >
> > Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> > ---
> >  boot/Kconfig            | 13 +++++++++
> >  boot/Makefile           |  1 +
> >  boot/bootmeth_openwrt.c | 65 +++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 79 insertions(+)
> >  create mode 100644 boot/bootmeth_openwrt.c
> 
> Reviewed-by: Simon Glass <simon.glass@canonical.com>
> 
> 
> >
> > diff --git a/boot/Kconfig b/boot/Kconfig
> > index efc06f3cd1a..d8c7b8360ac 100644
> > --- a/boot/Kconfig
> > +++ b/boot/Kconfig
> > @@ -585,6 +585,19 @@ config BOOTMETH_CROS
> >
> >           Note that only x86 devices are supported at present.
> >
> > +config BOOTMETH_OPENWRT
> > +       bool "Bootdev support for OpenWrt"
> > +       depends on FIT
> > +       depends on BOOTSTD
> > +       depends on BOOTM_STORAGE
> > +       help
> > +         Enables support for booting OpenWrt-style uImage.FIT firmware
> > +         images stored directly on raw storage (block device partitions,
> > +         MTD partitions, or UBI volumes). The boot method loads the FIT
> > +         metadata, selectively reads only the kernel and FDT sub-images
> > +         from storage, and skips filesystem sub-images that Linux maps
> > +         directly from flash.
> > +
> >  config BOOTMETH_EXTLINUX
> >         bool "Bootdev support for extlinux boot"
> >         select PXE_UTILS
> > diff --git a/boot/Makefile b/boot/Makefile
> > index 7d1d4a28106..7b42358eb0c 100644
> > --- a/boot/Makefile
> > +++ b/boot/Makefile
> > @@ -72,6 +72,7 @@ obj-$(CONFIG_$(PHASE_)BOOTMETH_VBE_SIMPLE_FW) += vbe_simple_fw.o
> >  obj-$(CONFIG_$(PHASE_)BOOTMETH_VBE_SIMPLE_OS) += vbe_simple_os.o
> >
> >  obj-$(CONFIG_$(PHASE_)BOOTMETH_ANDROID) += bootmeth_android.o
> > +obj-$(CONFIG_$(PHASE_)BOOTMETH_OPENWRT) += bootmeth_openwrt.o
> >
> >  obj-$(CONFIG_IMAGE_LOADER) += image-loader.o
> >  obj-$(CONFIG_IMAGE_LOADER_BLK) += image-loader-blk.o
> > diff --git a/boot/bootmeth_openwrt.c b/boot/bootmeth_openwrt.c
> > new file mode 100644
> > index 00000000000..02bf543031b
> > --- /dev/null
> > +++ b/boot/bootmeth_openwrt.c
> > @@ -0,0 +1,65 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Bootmethod for OpenWrt
> > + *
> > + * Copyright (C) 2026 Daniel Golle <daniel@makrotopia.org>
> > + */
> > +
> > +#define LOG_CATEGORY UCLASS_BOOTSTD
> > +
> > +#include <blk.h>
> > +#include <bootdev.h>
> > +#include <bootflow.h>
> > +#include <bootm.h>
> > +#include <bootmeth.h>
> > +#include <dm.h>
> > +#include <image-loader.h>
> > +#include <malloc.h>
> > +#include <mapmem.h>
> > +
> > +static int openwrt_check(struct udevice *dev, struct bootflow_iter *iter)
> > +{
> > +       if (bootflow_iter_check_blk(iter))
> > +               return log_msg_ret("blk", -EOPNOTSUPP);
> > +
> > +       return 0;
> > +}
> > +
> > +static int openwrt_read_bootflow(struct udevice *dev, struct bootflow *bflow)
> > +{
> > +       return log_msg_ret("nyi", -ENOENT);
> > +}
> > +
> > +static int openwrt_boot(struct udevice *dev, struct bootflow *bflow)
> > +{
> > +       return log_msg_ret("nyi", -ENOSYS);
> > +}
> > +
> > +static int openwrt_bootmeth_bind(struct udevice *dev)
> > +{
> > +       struct bootmeth_uc_plat *plat = dev_get_uclass_plat(dev);
> > +
> > +       plat->desc = "OpenWrt";
> > +       plat->flags = BOOTMETHF_ANY_PART;
> > +
> > +       return 0;
> > +}
> > +
> > +static struct bootmeth_ops openwrt_bootmeth_ops = {
> > +       .check          = openwrt_check,
> > +       .read_bootflow  = openwrt_read_bootflow,
> > +       .boot           = openwrt_boot,
> > +};
> > +
> > +static const struct udevice_id openwrt_bootmeth_ids[] = {
> > +       { .compatible = "u-boot,openwrt" },
> > +       { }
> > +};
> > +
> > +U_BOOT_DRIVER(bootmeth_openwrt) = {
> > +       .name           = "bootmeth_openwrt",
> > +       .id             = UCLASS_BOOTMETH,
> > +       .of_match       = openwrt_bootmeth_ids,
> > +       .ops            = &openwrt_bootmeth_ops,
> > +       .bind           = openwrt_bootmeth_bind,
> > +};
> > --
> > 2.53.0

  parent reply	other threads:[~2026-02-19 16:52 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 [this message]
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
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=aZc_sh55r2m0QDHS@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+renesas@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