[PATCH] mtdpart: Support MTDPART_SIZ_FULL in fixed-partitions
Mike Looijmans
mike.looijmans at topic.nl
Mon Apr 7 15:42:13 CEST 2025
ping?
Maybe I should have added to the description that the Linux kernel
allows MTD partitions to specify a size "0" in the device-tree to mean
"the remainder". This patch makes u-boot compatible with the kernel's
MTD partitions. U-boot MTDPARTS also supported this, but it's missing in
the device-tree parser.
M.
On 25-03-2025 16:52, Mike Looijmans wrote:
> Flash partitions may specify MTDPART_SIZ_FULL (=0) as the size of the
> partition to indicate "the remainder of the flash". Make this work with
> device-tree "fixed-partitions" as well.
>
> Signed-off-by: Mike Looijmans <mike.looijmans at topic.nl>
> ---
>
> drivers/mtd/mtdpart.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> index 88094b81e7a..5284890bd88 100644
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> @@ -910,11 +910,13 @@ int add_mtd_partitions_of(struct mtd_info *master)
> continue;
>
> offset = ofnode_get_addr_size_index_notrans(child, 0, &size);
> - if (offset == FDT_ADDR_T_NONE || !size) {
> - debug("Missing partition offset/size on \"%s\" partition\n",
> + if (offset == FDT_ADDR_T_NONE) {
> + debug("Missing partition offset on \"%s\" partition\n",
> master->name);
> continue;
> }
> + if (size == MTDPART_SIZ_FULL)
> + size = master->size - offset;
>
> part.name = ofnode_read_string(child, "label");
> if (!part.name)
--
Mike Looijmans
System Expert
TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands
T: +31 (0) 499 33 69 69
E: mike.looijmans at topic.nl
W: www.topic.nl
More information about the U-Boot
mailing list