[PATCH] mci: only count partitions from partition table

Michael Tretter m.tretter at pengutronix.de
Wed Apr 30 05:10:47 PDT 2025


Linux is only aware of partitions in the partition table, but the list
of partitions in barebox may contain additional partitions, e.g., for
state or the environment.

Ignore partitions that are not in the partition table when calculating
the index of the partition in Linux.

Signed-off-by: Michael Tretter <m.tretter at pengutronix.de>
---
 drivers/mci/mci-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index c4830a47a5f4..592543faa7b8 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -2550,7 +2550,8 @@ static char *mci_get_linux_mmcblkdev(struct block_device *blk,
 		 */
 		if (cdev_partname_equal(partcdev, cdev))
 			return basprintf("root=/dev/mmcblk%dp%d", id, partnum);
-		partnum++;
+		if (cdev->flags & DEVFS_PARTITION_FROM_TABLE)
+			partnum++;
 	}
 
 	return NULL;
-- 
2.39.5




More information about the barebox mailing list