[RFC PATCH 17/20] boot: bootdev: add UBI boot device
Simon Glass
sjg at chromium.org
Mon Feb 23 18:51:10 CET 2026
Hi Daniel,
On Thu, 19 Feb 2026 at 09:57, Daniel Golle <daniel at makrotopia.org> wrote:
>
> On Thu, Feb 19, 2026 at 06:09:31AM -0700, Simon Glass wrote:
> > On Mon, 16 Feb 2026 at 14:24, Daniel Golle <daniel at makrotopia.org> wrote:
> > > [...]
> > > +/**
> > > + * ubi_bootdev_hunt() - attach UBI and bind a bootdev for it
> > > + *
> > > + * Walk the DT for the first partition with compatible = "linux,ubi",
> > > + * find its MTD device, attach UBI via ubi_part_from_mtd(), then bind
> > > + * a ubi_bootdev as a child of the top-level MTD DM device.
> > > + */
> > > +static int ubi_bootdev_hunt(struct bootdev_hunter *info, bool show)
> > > +{
> > > + struct udevice *bdev;
> > > + struct mtd_info *mtd;
> > > + ofnode node;
> > > + int ret;
> > > +
> > > + mtd_probe_devices();
> > > +
> > > + if (!ubi_devices[0]) {
> > > + ofnode_for_each_compatible_node(node, "linux,ubi") {
> > > + mtd_for_each_device(mtd) {
> > > + if (ofnode_equal(mtd->flash_node, node))
> > > + goto found;
> > > + }
> > > + }
> > > + return -ENOENT;
> >
> > Eek no we need to find the device, not the node. There must surely be
> > a link between the UBI and MTD in the data structures somewhere.
>
> Yes, but only once UBI is already attached. We can move the responsibiltiy
> to auto-attach the first suitable UBI volume having the 'linux, ubi'
> compatible to the moment the MTD partition devices are created, so UBI
> will always already be attached. However, that will then waste time to
> do the UBI scanning even on devices not using UBI to boot from (but eg.
> only as auxilary storage while booting from NOR flash). Hence I kinda
> liked taking care of the UBI attachment in the hunter...
OK...well from your other email it seems that UBI is pretty old code.
So I suppose we do need this sort of conversion.
I could perhaps take a look at converting UBI to driver model, but
that would be separate from this series and would have to come
afterwards.
Regards,
Simon
More information about the U-Boot
mailing list