[RFC] do_mounts: Allow mtd names for non-flash block filesystems
Karl Beldan
karl.beldan at gmail.com
Wed Oct 6 17:22:27 EDT 2010
Edit for my off-by-one typo:
On Wed, Oct 6, 2010 at 11:02 PM, Karl Beldan <karl.beldan at gmail.com> wrote:
> 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 at 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)) {
Here, it is 5 not 4
> + struct mtd_info *mtd = get_mtd_device_nm(root_device_name + 4);
same here
> + 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);
and here
> + 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
>
--
Karl
More information about the linux-mtd
mailing list