[PATCH v1] fs: dispatch null_dev_desc_ok filesystems before block lookup

Vincent Jardin vjardin at free.fr
Mon May 11 13:53:35 CEST 2026


Filesystems that are null_dev_desc_ok (semihosting, ubifs) have
no UCLASS_BLK device under their ifname, so on real hardware
fs_set_blk_dev() always fails at the partition lookup.
The workaround was to add a per-filesystem
command (example cmd/ubifs.c), which duplicates thue plumbing of
fstype_info.

Honour the opt-in directly: probe such entries with block_desc=NULL up
front, so "load semihosting <addr> <file>" works without a new
command.

Sandbox boards that exercise the existing fallback through "host
bind" stay unchanged.

Signed-off-by: Vincent Jardin <vjardin at free.fr>

---

 fs/fs.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/fs/fs.c b/fs/fs.c
index 8ea50a6c13c..09295e95892 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -464,6 +464,24 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)
 	struct fstype_info *info;
 	int part, i;
 
+	for (i = 0, info = fstypes; i < ARRAY_SIZE(fstypes); i++, info++) {
+		if (fstype != FS_TYPE_ANY && info->fstype != FS_TYPE_ANY &&
+		    fstype != info->fstype)
+			continue;
+		if (!info->null_dev_desc_ok || !info->name)
+			continue;
+		if (strcmp(info->name, ifname) != 0)
+			continue;
+
+		fs_dev_desc = NULL;
+		memset(&fs_partition, 0, sizeof(fs_partition));
+		if (!info->probe(NULL, &fs_partition)) {
+			fs_type = info->fstype;
+			fs_dev_part = 0;
+			return 0;
+		}
+	}
+
 	part = part_get_info_by_dev_and_name_or_num(ifname, dev_part_str, &fs_dev_desc,
 						    &fs_partition, 1);
 	if (part < 0)
-- 
2.43.0

base-commit: bfe90a308a94caa9d855440683521ff04122ae2a
branch: for-upstream/fs-null-dev-desc-dispatch


More information about the U-Boot mailing list