Questions about MTD subpartitioning

Miquel Raynal miquel.raynal at bootlin.com
Fri Apr 18 00:16:37 PDT 2025


Hi Roland,

On 17/04/2025 at 12:08:42 GMT, Roland Kovács <roland.kovacs at est.tech> wrote:

> Hi, 
>
> I'd like to ask some questions regarding mtdchar device driver.
> We'd like to add subpartitions to the PDR region of a NOR-flash device from userspace, but we hit a check in the BLKPG
> ioctl call which prevents subpartitioning.
> As far as I can tell, this check predates the support for subpartitions in mtdpart.c and I couldn't find information on
> why this is the case.
>
> Is there a particular reason why subpartitions through BLKPG is not allowed? 
> Or do you have any other recommended way of doing subpartitions from
> userspace?

In general I do not use subpartitioning from userspace, so I must admit
this is going to be a blind advise.

Looking at the code I see that partitioning is only allowed on master
devices, not partitions. But if you have partitions in you DT, the
master device is not kept (for historical reasons). But if you need it
you may select CONFIG_MTD_PARTITIONED_MASTER.

If that does not help, please give more details about the command
attempted, the device identification and geometry as well as the errors
you get.

Thanks,
Miquèl



More information about the linux-mtd mailing list