You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2026/03/24 07:39:21 UTC
(nuttx) 07/09: imx95-a55-evk: add MBR/GPT partition table parsing on eMMC
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 0f3590fd19d1305d579542b85cbf5d89b4d91d38
Author: buxiasen <bu...@xiaomi.com>
AuthorDate: Fri Mar 6 15:51:49 2026 +0800
imx95-a55-evk: add MBR/GPT partition table parsing on eMMC
Parse the partition table on /dev/mmcsd0 during board bringup and
register each partition as /dev/mmcsd0pN. MBR partitions have no
name field so a custom handler is needed instead of the default
register_partition which skips unnamed entries.
Verify by i.mx95 FRDM
'mount -t vfat /dev/mmcsd0p0 /data'
Signed-off-by: buxiasen <bu...@xiaomi.com>
---
boards/arm64/imx9/imx95-a55-evk/src/imx9_bringup.c | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/boards/arm64/imx9/imx95-a55-evk/src/imx9_bringup.c b/boards/arm64/imx9/imx95-a55-evk/src/imx9_bringup.c
index b009e87ef87..daa00e64cde 100644
--- a/boards/arm64/imx9/imx95-a55-evk/src/imx9_bringup.c
+++ b/boards/arm64/imx9/imx95-a55-evk/src/imx9_bringup.c
@@ -27,14 +27,31 @@
#include <nuttx/config.h>
#include <sys/types.h>
+#include <stdio.h>
#include <syslog.h>
#include <nuttx/fs/fs.h>
+#include <nuttx/fs/partition.h>
#include "imx9_dma_alloc.h"
#include "imx95-evk.h"
+#if defined(CONFIG_GPT_PARTITION) || defined(CONFIG_MBR_PARTITION)
+static void mmcsd_partition_handler(FAR struct partition_s *part,
+ FAR void *arg)
+{
+ char devname[32];
+
+ snprintf(devname, sizeof(devname), "/dev/mmcsd0p%zu", part->index);
+ register_blockpartition(devname, 0660, "/dev/mmcsd0",
+ part->firstblock, part->nblocks);
+ syslog(LOG_INFO, "Registered partition %s (start=%lu nblocks=%lu)\n",
+ devname, (unsigned long)part->firstblock,
+ (unsigned long)part->nblocks);
+}
+#endif
+
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -78,6 +95,18 @@ int imx9_bringup(void)
{
syslog(LOG_ERR, "Failed to init MMCSD driver: %d\n", ret);
}
+
+#if defined(CONFIG_GPT_PARTITION) || defined(CONFIG_MBR_PARTITION)
+ else
+ {
+ ret = parse_block_partition("/dev/mmcsd0",
+ mmcsd_partition_handler, NULL);
+ if (ret < 0)
+ {
+ syslog(LOG_ERR, "Failed to parse partition table: %d\n", ret);
+ }
+ }
+#endif
#endif
UNUSED(ret);