linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC] do_mounts: Allow mtd names for non-flash block filesystems
@ 2010-10-06 21:02 Karl Beldan
  2010-10-06 21:22 ` Karl Beldan
  2010-10-11 19:24 ` Artem Bityutskiy
  0 siblings, 2 replies; 10+ messages in thread
From: Karl Beldan @ 2010-10-06 21:02 UTC (permalink / raw)
  To: linux-mtd; +Cc: Karl Beldan, David Woodhouse, Artem Bityutskiy

Hi,

I have been using this tweak for some time now, and I am getting tired of 
having to resort to it so often.
It allows to pass such cmdline root as: 
 "root=mtdb:ubivolx rootfstype=squashfs"
I am pretty sure many people use squashfs/cramfs filesystems on top of nand, 
for example, and I thought that this might initiate discussion.

-- 
Karl

Signed-off-by: Karl Beldan <karl.beldan@gmail.com>
---
 init/do_mounts.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index 02e3ca4..20d9380 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -20,6 +20,7 @@
 #include <linux/nfs_fs.h>
 #include <linux/nfs_fs_sb.h>
 #include <linux/nfs_mount.h>
+#include <linux/mtd/mtd.h>
 
 #include "do_mounts.h"
 
@@ -386,8 +387,18 @@ void __init prepare_namespace(void)
 
 	if (saved_root_name[0]) {
 		root_device_name = saved_root_name;
-		if (!strncmp(root_device_name, "mtd", 3) ||
-		    !strncmp(root_device_name, "ubi", 3)) {
+		if (!strncmp(root_device_name, "mtdb:", 4)) {
+			struct mtd_info *mtd = get_mtd_device_nm(root_device_name + 4);
+			if (!IS_ERR(mtd))
+				sprintf(root_device_name, "/dev/mtdblock%d", mtd->index);
+			else {
+				printk(KERN_ERR "VFS: Unable to find mtd \"%s\"\n", root_device_name + 4);
+				printk("List of all partitions:\n");
+				printk_all_partitions();
+				panic("VFS: Unable to mount root fs");
+			}
+		} else if (!strncmp(root_device_name, "mtd", 3) ||
+			   !strncmp(root_device_name, "ubi", 3)) {
 			mount_block_root(root_device_name, root_mountflags);
 			goto out;
 		}
-- 
1.7.1.422.g049e9

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-10-13 11:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-06 21:02 [RFC] do_mounts: Allow mtd names for non-flash block filesystems Karl Beldan
2010-10-06 21:22 ` Karl Beldan
2010-10-11 19:24 ` Artem Bityutskiy
2010-10-12 13:16   ` Karl Beldan
2010-10-12 14:27     ` Artem Bityutskiy
2010-10-12 15:11       ` Karl Beldan
2010-10-12 15:27         ` Artem Bityutskiy
2010-10-12 15:51           ` Karl Beldan
2010-10-13 10:35     ` Peter Korsgaard
2010-10-13 11:16       ` Karl Beldan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).