public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sam Edwards <cfsworks@gmail.com>
To: Heiko Schocher <hs@denx.de>, Kyungmin Park <kmpark@infradead.org>
Cc: u-boot@lists.denx.de, Sam Edwards <CFSworks@gmail.com>
Subject: [RFC PATCH 0/4] mtd: ubi: Enable accessing RO filesystems in UBI vols
Date: Fri, 11 Aug 2023 18:06:02 -0600	[thread overview]
Message-ID: <20230812000606.72319-1-CFSworks@gmail.com> (raw)

Hi UBI maintainers,

My target's rootfs is a read-only filesystem stored in a static UBI volume,
mounted via a "ubiblock" device after boot. I'd also like to keep the boot
files in the same filesystem, so that it's all coupled together. To that end,
I'm working on a patchset so that U-Boot can read static UBI volumes as
read-only block devices (paralleling Linux's ubiblock mechanism).

I'm very happy with how the first 3 patches in this series turned out (so I'm
not asking about them per se, though feedback is certainly welcome). The fourth
is where I got stuck: while the code definitely works, it requires bringing DM
headers into disk/part.c, which certainly will not fly in mainline. I need to
plumb this through drivers/block/blk-uclass.c to do it "properly."

Part of the problem here is that these are *volumes,* but they are (optionally)
*named.* In U-Boot's current view of block devices, it is only a partition, and
not a volume, that may have a name. These aren't "partitions" in U-Boot's view,
since a partition is a contiguous slice of a bigger block device, while these
are (logically) separate block devices.

So, I would need to invent a new function that can look up a named (sub)volume.
I also probably need to invent new syntax, so that I'm not overloading the 0:1
syntax for partitions. I'm not especially beholden to the ':', but I do want to
use the same syntax for volume numbers and volume names, to mirror Linux's
`ubi.block=x,y` syntax.

I'm also trying to reclaim the name "ubi" to refer to a UBI volume, while
U-Boot currently thinks it should refer to the presently-mounted UBIFS. In my
current series, the meaning of "ubi" depends on whether ubifs is mounted, for
backwards-compatibility. If this isn't palpable, I could consider other options
like "ubivol"/"ubiblock"/"ubiblk"/"ubistatic"/...

So, the feedback I'm hoping for would be:
1) What is a good syntax for referring to a logical volume by name or ID?
   Keeping in mind this may affect more than just UBI, if e.g. U-Boot learns to
   peer inside LVM2s in the future.
2) What should I call the block functions for looking up a block device's
   subvolume by type+parentidx+{name,ID}?
3) Is my strategy of reclaiming "ubi" sound, or should I be conceding that to
   UBIFS and using a new type name for static UBI volumes?
4) Does my choose_blksz_for_volume() function make sense, or should I always be
   using a preferred block size (like 512) if possible?

Cheers,
Sam

Sam Edwards (4):
  mtd: ubi: register UBI attachments as DM devices
  mtd: ubi: bind block device driver for static volumes
  disk: part: fall-through if "ubi" requested but ubifs not mounted
  HACK: enable access to `ubi 0:volname` block devices

 cmd/ubi.c                    |  11 +++
 disk/part.c                  |  70 +++++++++++--
 drivers/mtd/ubi/Makefile     |   1 +
 drivers/mtd/ubi/ubi-uclass.c | 184 +++++++++++++++++++++++++++++++++++
 include/dm/uclass-id.h       |   1 +
 include/ubi_uboot.h          |   5 +
 6 files changed, 264 insertions(+), 8 deletions(-)
 create mode 100644 drivers/mtd/ubi/ubi-uclass.c

-- 
2.41.0


             reply	other threads:[~2023-08-12  0:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-12  0:06 Sam Edwards [this message]
2023-08-12  0:06 ` [RFC PATCH 1/4] mtd: ubi: register UBI attachments as DM devices Sam Edwards
2023-08-12  0:06 ` [RFC PATCH 2/4] mtd: ubi: bind block device driver for static volumes Sam Edwards
2023-08-12  0:06 ` [RFC PATCH 3/4] disk: part: fall-through if "ubi" requested but ubifs not mounted Sam Edwards
2023-08-12  0:06 ` [RFC PATCH 4/4] HACK: enable access to `ubi 0:volname` block devices Sam Edwards
2023-08-14  6:45 ` [RFC PATCH 0/4] mtd: ubi: Enable accessing RO filesystems in UBI vols Heiko Schocher
2023-09-07 21:46   ` Sam Edwards
2023-09-21  6:44     ` Heiko Schocher

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=20230812000606.72319-1-CFSworks@gmail.com \
    --to=cfsworks@gmail.com \
    --cc=hs@denx.de \
    --cc=kmpark@infradead.org \
    --cc=u-boot@lists.denx.de \
    /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