diff -urN -X dontdiff linux/Documentation/kernel-parameters.txt 2329-p1-rd/Documentation/kernel-parameters.txt --- linux/Documentation/kernel-parameters.txt Mon Nov 1 18:31:34 1999 +++ 2329-p1-rd/Documentation/kernel-parameters.txt Fri Nov 19 11:31:42 1999 @@ -318,7 +318,9 @@ ro [KNL] Mount root device read-only on boot. - root= + root= [KNL] Mount root on specified (as hex or "/dev/XXX") device. + + rootfs= [KNL] Use filesystem type specified (e.g. rootfs=ext2) for root. rw [KNL] Mount root device read-write on boot. diff -urN -X dontdiff linux/fs/super.c 2329-p1-rd/fs/super.c --- linux/fs/super.c Fri Nov 19 09:00:39 1999 +++ 2329-p1-rd/fs/super.c Fri Nov 19 16:54:25 1999 @@ -15,6 +15,7 @@ * * Added kerneld support: Jacques Gelinas and Bjorn Ekwall * Added change_root: Werner Almesberger & Hans Lermen, Feb '96 + * Added rootfs boot param. used by mount_root(): Tigran Aivazian, Nov 99. */ #include @@ -54,6 +55,12 @@ /* this is initialized in init/main.c */ kdev_t ROOT_DEV; +/* this can be set at boot time, e.g. rootfs=ext2 + * if set to invalid value or if read_super() fails on the specified + * filesystem type then mount_root() will go through all registered filesystems. + */ +char rootfs[128] __initdata = "ext2"; + int nr_super_blocks = 0; int max_super_blocks = NR_SUPER; LIST_HEAD(super_blocks); @@ -1122,6 +1129,24 @@ goto dput_and_out; } + +#define TRY_MOUNT_ROOT(sb, vfsmnt) { \ + sb = read_super(ROOT_DEV,fs_type->name,root_mountflags,NULL,1); \ + if (sb) { \ + sb->s_flags = root_mountflags; \ + current->fs->root = dget(sb->s_root); \ + current->fs->pwd = dget(sb->s_root); \ + printk ("VFS: Mounted root (%s filesystem)%s.\n", \ + fs_type->name, \ + (sb->s_flags & MS_RDONLY) ? " readonly" : ""); \ + vfsmnt = add_vfsmnt(sb, "/dev/root", "/"); \ + if (vfsmnt) \ + return; \ + panic("VFS: add_vfsmnt failed for root fs"); \ + } \ +} + + void __init mount_root(void) { struct file_system_type * fs_type; @@ -1208,25 +1233,17 @@ */ printk("VFS: Cannot open root device %s\n", kdevname(ROOT_DEV)); - else for (fs_type = file_systems ; fs_type ; fs_type = fs_type->next) { - if (!(fs_type->fs_flags & FS_REQUIRES_DEV)) - continue; - sb = read_super(ROOT_DEV,fs_type->name,root_mountflags,NULL,1); - if (sb) { - sb->s_flags = root_mountflags; - current->fs->root = dget(sb->s_root); - current->fs->pwd = dget(sb->s_root); - printk ("VFS: Mounted root (%s filesystem)%s.\n", - fs_type->name, - (sb->s_flags & MS_RDONLY) ? " readonly" : ""); - vfsmnt = add_vfsmnt(sb, "/dev/root", "/"); - if (vfsmnt) - return; - panic("VFS: add_vfsmnt failed for root fs"); + else { + if ((fs_type = get_fs_type(rootfs)) != NULL && + (fs_type->fs_flags & FS_REQUIRES_DEV)) + TRY_MOUNT_ROOT(sb, vfsmnt); + for (fs_type = file_systems ; fs_type ; fs_type = fs_type->next) { + if (!(fs_type->fs_flags & FS_REQUIRES_DEV)) + continue; + TRY_MOUNT_ROOT(sb, vfsmnt); } } - panic("VFS: Unable to mount root fs on %s", - kdevname(ROOT_DEV)); + panic("VFS: Unable to mount root fs on %s", kdevname(ROOT_DEV)); } diff -urN -X dontdiff linux/init/main.c 2329-p1-rd/init/main.c --- linux/init/main.c Tue Oct 19 18:22:19 1999 +++ 2329-p1-rd/init/main.c Fri Nov 19 16:19:50 1999 @@ -269,6 +269,18 @@ __setup("root=", root_dev_setup); +static int __init rootfs_setup(char *line) +{ + int n = strlen(line) + 1; + extern char rootfs[128]; /* in fs/super.c */ + + if (n > 1 && n < 128) + strncpy(rootfs, line, n); + return 1; +} + +__setup("rootfs=", rootfs_setup); + static int __init checksetup(char *line) { struct kernel_param *p; .