2003-08-24 01:58:59

by Garrett Kajmowicz

[permalink] [raw]
Subject: [PATCH] initramfs + sysfs as root fix

This is my first real patch, so please vet thoroughly

This patch allows a person to not require mounting a root device at startup.
This works idealy for people trying to use the initramfs/sysfs as the only
filesystem.

What happens is that when the root device is set to 0,0 mount_root is not
called. I have tested in VMWare extensively, and the patch is quite minimal.

Please let me know if I should send this somewhere else as well.

Also, please be adviased that I did not dream up the goto - I am just keeping
in line with the existing file structure.


Garrett Kajmowicz
[email protected]

--- linux-2.6.0-test3/init/do_mounts.c 2003-08-09 00:34:47.000000000 -0400
+++ linux/init/do_mounts.c 2003-08-23 17:22:59.000000000 -0400
@@ -380,6 +380,12 @@
if (is_floppy && rd_doload && rd_load_disk(0))
ROOT_DEV = Root_RAM0;

+#ifndef CONFIG_ROOT_NFS
+ if (MAJOR(ROOT_DEV) == UNNAMED_MAJOR && MINOR(ROOT_DEV) == 0) {
+ goto out;
+ }
+#endif
+
mount_root();
out:
umount_devfs("/dev");


2003-08-28 00:40:46

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] initramfs + sysfs as root fix

Followup to: <[email protected]>
By author: Garrett Kajmowicz <[email protected]>
In newsgroup: linux.dev.kernel
>
> This is my first real patch, so please vet thoroughly
>
> This patch allows a person to not require mounting a root device at startup.
> This works idealy for people trying to use the initramfs/sysfs as the only
> filesystem.
>
> What happens is that when the root device is set to 0,0 mount_root is not
> called. I have tested in VMWare extensively, and the patch is quite minimal.
>
> +++ linux/init/do_mounts.c 2003-08-23 17:22:59.000000000 -0400
> @@ -380,6 +380,12 @@
> if (is_floppy && rd_doload && rd_load_disk(0))
> ROOT_DEV = Root_RAM0;
>
> +#ifndef CONFIG_ROOT_NFS
> + if (MAJOR(ROOT_DEV) == UNNAMED_MAJOR && MINOR(ROOT_DEV) == 0) {
> + goto out;
> + }
> +#endif
> +
> mount_root();

It seems ugly, to say the least, to conditionalize this on
CONFIG_ROOT_NFS. If anything it should be conditionalized on no NFS
root actually configured, which is a very different thing.

(Of course, then nfsroot should be done via initramfs...)

-hpa
--
<[email protected]> at work, <[email protected]> in private!
If you send me mail in HTML format I will assume it's spam.
"Unix gives you enough rope to shoot yourself in the foot."
Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64