[PATCH 1/3][try 1] init: enable system-on-initramfs: enable root=rootfs

From: Bodo Eggert
Date: Fri Jul 13 2007 - 15:00:08 EST


Disable mounting a root filesystem if root=rootfs is supplied.

If you put a rescue system on an initramfs, you should be able to boot it
without using tricks like an additional /init script.

Signed-Off-By: Bodo Eggert <7eggert@xxxxxx>

diff -X dontdiff -pruN linux-2.6.22/Documentation/kernel-parameters.txt linux-2.6.22.tmpfsroot/Documentation/kernel-parameters.txt
--- linux-2.6.22/Documentation/kernel-parameters.txt 2007-07-11 23:14:59.000000000 +0200
+++ linux-2.6.22.tmpfsroot/Documentation/kernel-parameters.txt 2007-07-12 13:57:00.000000000 +0200
@@ -1528,6 +1528,7 @@ and is between 256 and 4096 characters.
ro [KNL] Mount root device read-only on boot

root= [KNL] Root filesystem
+ If set to "rootfs", the initramfs will be used

rootdelay= [KNL] Delay (in seconds) to pause before attempting to
mount the root filesystem
diff -X dontdiff -pruN linux-2.6.22/init/do_mounts.c linux-2.6.22.tmpfsroot/init/do_mounts.c
--- linux-2.6.22/init/do_mounts.c 2007-07-11 23:15:31.000000000 +0200
+++ linux-2.6.22.tmpfsroot/init/do_mounts.c 2007-07-12 13:57:00.000000000 +0200
@@ -433,6 +433,8 @@ void __init prepare_namespace(void)
mount_block_root(root_device_name, root_mountflags);
goto out;
}
+ if (!strcmp(root_device_name, "rootfs"))
+ goto out_nomount;
ROOT_DEV = name_to_dev_t(root_device_name);
if (strncmp(root_device_name, "/dev/", 5) == 0)
root_device_name += 5;
@@ -450,6 +452,7 @@ void __init prepare_namespace(void)
out:
sys_mount(".", "/", NULL, MS_MOVE, NULL);
sys_chroot(".");
+out_nomount:
security_sb_post_mountroot();
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/