All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 04/14] Pramfs: Mounting as root filesystem
@ 2009-06-13 13:21 Marco
  2009-06-13 23:04 ` Arnd Bergmann
  0 siblings, 1 reply; 6+ messages in thread
From: Marco @ 2009-06-13 13:21 UTC (permalink / raw)
  To: Linux FS Devel; +Cc: Linux Embedded, Linux Kernel, Daniel Walker

From: Marco Stornelli <marco.stornelli@gmail.com>

Pramfs can be used even as root filesystem.

Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
---

diff -uprN linux-2.6.30-orig/init/do_mounts.c linux-2.6.30/init/do_mounts.c
--- linux-2.6.30-orig/init/do_mounts.c	2009-06-10 05:05:27.000000000 +0200
+++ linux-2.6.30/init/do_mounts.c	2009-06-13 12:50:36.000000000 +0200
@@ -299,6 +299,17 @@ static int __init mount_nfs_root(void)
 }
 #endif
 
+#ifdef CONFIG_ROOT_PRAMFS
+static int __init mount_pramfs_root(void)
+{
+	create_dev("/dev/root", ROOT_DEV);
+	if (do_mount_root("/dev/root", "pramfs",
+				root_mountflags, root_mount_data) == 0)
+		return 1;
+        return 0;
+}
+#endif
+
 #if defined(CONFIG_BLK_DEV_RAM) || defined(CONFIG_BLK_DEV_FD)
 void __init change_floppy(char *fmt, ...)
 {
@@ -331,6 +342,15 @@ void __init change_floppy(char *fmt, ...
 
 void __init mount_root(void)
 {
+#ifdef CONFIG_ROOT_PRAMFS
+	if (MAJOR(ROOT_DEV) == MEM_MAJOR) {
+		if (mount_pramfs_root())
+			return;
+
+		printk(KERN_ERR "VFS: Unable to mount root fs via PRAMFS, trying floppy.\n");
+		ROOT_DEV = Root_FD0;
+	}
+#endif
 #ifdef CONFIG_ROOT_NFS
 	if (MAJOR(ROOT_DEV) == UNNAMED_MAJOR) {
 		if (mount_nfs_root())




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

* Re: [PATCH 04/14] Pramfs: Mounting as root filesystem
  2009-06-13 13:21 [PATCH 04/14] Pramfs: Mounting as root filesystem Marco
@ 2009-06-13 23:04 ` Arnd Bergmann
  2009-06-14  8:21   ` Marco
  0 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2009-06-13 23:04 UTC (permalink / raw)
  To: Marco; +Cc: Linux FS Devel, Linux Embedded, Linux Kernel, Daniel Walker

On Saturday 13 June 2009, Marco wrote:
>  void __init mount_root(void)
>  {
> +#ifdef CONFIG_ROOT_PRAMFS
> +       if (MAJOR(ROOT_DEV) == MEM_MAJOR) {
> +               if (mount_pramfs_root())
> +                       return;
> +
> +               printk(KERN_ERR "VFS: Unable to mount root fs via PRAMFS, trying floppy.\n");
> +               ROOT_DEV = Root_FD0;
> +       }
> +#endif

AFAICT, this will prevent booting from /dev/ram0 with a regular file system,
because that also uses MAJOR(ROOT_DEV) == 1.

	Arnd <><

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

* Re: [PATCH 04/14] Pramfs: Mounting as root filesystem
  2009-06-13 23:04 ` Arnd Bergmann
@ 2009-06-14  8:21   ` Marco
  2009-06-14  9:07     ` David Woodhouse
  0 siblings, 1 reply; 6+ messages in thread
From: Marco @ 2009-06-14  8:21 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Linux FS Devel, Linux Embedded, Linux Kernel, Daniel Walker

Arnd Bergmann wrote:
> On Saturday 13 June 2009, Marco wrote:
>>  void __init mount_root(void)
>>  {
>> +#ifdef CONFIG_ROOT_PRAMFS
>> +       if (MAJOR(ROOT_DEV) == MEM_MAJOR) {
>> +               if (mount_pramfs_root())
>> +                       return;
>> +
>> +               printk(KERN_ERR "VFS: Unable to mount root fs via PRAMFS, trying floppy.\n");
>> +               ROOT_DEV = Root_FD0;
>> +       }
>> +#endif
> 
> AFAICT, this will prevent booting from /dev/ram0 with a regular file system,
> because that also uses MAJOR(ROOT_DEV) == 1.
> 
> 	Arnd <><
> 

Mmm...MEM_MAJOR and RAMDISK_MAJOR have the same value and pramfs works
in memory. We could simply use /dev/null (there was an error in the
submitted kconfig description, my intention was to use /dev/mem). In
that case I can use UNNAMED_MAJOR. PRAMFS root option is not enabled if
it's already enabled the NFS one. What do you think?

Marco

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

* Re: [PATCH 04/14] Pramfs: Mounting as root filesystem
  2009-06-14  8:21   ` Marco
@ 2009-06-14  9:07     ` David Woodhouse
  2009-06-14 16:05       ` Marco
  0 siblings, 1 reply; 6+ messages in thread
From: David Woodhouse @ 2009-06-14  9:07 UTC (permalink / raw)
  To: Marco
  Cc: Arnd Bergmann, Linux FS Devel, Linux Embedded, Linux Kernel,
	Daniel Walker

On Sun, 2009-06-14 at 10:21 +0200, Marco wrote:
> 
> Mmm...MEM_MAJOR and RAMDISK_MAJOR have the same value and pramfs works
> in memory. We could simply use /dev/null (there was an error in the
> submitted kconfig description, my intention was to use /dev/mem). In
> that case I can use UNNAMED_MAJOR. PRAMFS root option is not enabled
> if it's already enabled the NFS one. What do you think?

Why use a major number at all? See how we handle mtd and ubi devices in
prepare_namespace() -- can't you do something similar?

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


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

* Re: [PATCH 04/14] Pramfs: Mounting as root filesystem
  2009-06-14  9:07     ` David Woodhouse
@ 2009-06-14 16:05       ` Marco
  2009-06-14 16:29         ` Marco
  0 siblings, 1 reply; 6+ messages in thread
From: Marco @ 2009-06-14 16:05 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Arnd Bergmann, Linux FS Devel, Linux Embedded, Linux Kernel,
	Daniel Walker

David Woodhouse wrote:
> On Sun, 2009-06-14 at 10:21 +0200, Marco wrote:
>> Mmm...MEM_MAJOR and RAMDISK_MAJOR have the same value and pramfs works
>> in memory. We could simply use /dev/null (there was an error in the
>> submitted kconfig description, my intention was to use /dev/mem). In
>> that case I can use UNNAMED_MAJOR. PRAMFS root option is not enabled
>> if it's already enabled the NFS one. What do you think?
> 
> Why use a major number at all? See how we handle mtd and ubi devices in
> prepare_namespace() -- can't you do something similar?
> 

I can look at it.

Marco

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

* Re: [PATCH 04/14] Pramfs: Mounting as root filesystem
  2009-06-14 16:05       ` Marco
@ 2009-06-14 16:29         ` Marco
  0 siblings, 0 replies; 6+ messages in thread
From: Marco @ 2009-06-14 16:29 UTC (permalink / raw)
  To: Marco
  Cc: David Woodhouse, Arnd Bergmann, Linux FS Devel, Linux Embedded,
	Linux Kernel, Daniel Walker

David Woodhouse wrote:
> On Sun, 2009-06-14 at 10:21 +0200, Marco wrote:
>> Mmm...MEM_MAJOR and RAMDISK_MAJOR have the same value and pramfs works
>> in memory. We could simply use /dev/null (there was an error in the
>> submitted kconfig description, my intention was to use /dev/mem). In
>> that case I can use UNNAMED_MAJOR. PRAMFS root option is not enabled
>> if it's already enabled the NFS one. What do you think?
>
> Why use a major number at all? See how we handle mtd and ubi devices in
> prepare_namespace() -- can't you do something similar?
>
 
Do you suggest me something similar? Why not. I though that mtd and ubi 
were only special cases.

if (saved_root_name[0]) {
		root_device_name = saved_root_name;
		if (!strncmp(root_device_name, "mtd", 3) ||
		    !strncmp(root_device_name, "ubi", 3) ||
  -------->         !strncmp(root_device_name, "pram", 4)) {
			mount_block_root(root_device_name, root_mountflags);
			goto out;
		}
		ROOT_DEV = name_to_dev_t(root_device_name);
		if (strncmp(root_device_name, "/dev/", 5) == 0)
			root_device_name += 5;
	}

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

end of thread, other threads:[~2009-06-14 16:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-13 13:21 [PATCH 04/14] Pramfs: Mounting as root filesystem Marco
2009-06-13 23:04 ` Arnd Bergmann
2009-06-14  8:21   ` Marco
2009-06-14  9:07     ` David Woodhouse
2009-06-14 16:05       ` Marco
2009-06-14 16:29         ` Marco

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.