[PATCH] startup: add semihosting filesystem automount

Ahmad Fatoum a.fatoum at barebox.org
Tue May 27 14:03:00 PDT 2025


From: Ahmad Fatoum <ahmad at a3f.at>

For more convenient use of the semihosting file system, let's add an
automount when the file system is enabled.

Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
 common/startup.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/common/startup.c b/common/startup.c
index bbe905141efc..c9e99d47fbd7 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -57,6 +57,7 @@ static int mount_root(void)
 	mount("none", "ramfs", "/", NULL);
 	mkdir("/dev", 0);
 	mkdir("/tmp", 0);
+	mkdir("/mnt", 0);
 	mount("none", "devfs", "/dev", NULL);
 
 	if (IS_ENABLED(CONFIG_FS_EFIVARFS) && efi_is_payload()) {
@@ -69,6 +70,11 @@ static int mount_root(void)
 		mount("none", "pstore", "/pstore", NULL);
 	}
 
+	if (IS_ENABLED(CONFIG_FS_SMHFS)) {
+		mkdir("/mnt/smhfs", 0);
+		automount_add("/mnt/smhfs", "mount -t smhfs /dev/null /mnt/smhfs");
+	}
+
 	return 0;
 }
 fs_initcall(mount_root);
-- 
2.39.5




More information about the barebox mailing list