8 #warning "Sparse checking disabled for this file"
11 #include <linux/module.h>
12 #include <linux/sched.h>
13 #include <linux/ctype.h>
15 #include <linux/tty.h>
22 #include <linux/device.h>
28 #include <linux/slab.h>
30 #include <linux/nfs_fs.h>
50 __setup(
"load_ramdisk=", load_ramdisk);
60 static int __init readwrite(
char *str)
82 struct hd_struct *
part = dev_to_part(dev);
87 if (
memcmp(uuid, part->info->uuid,
sizeof(part->info->uuid)))
109 static dev_t devt_from_partuuid(
char *uuid_str)
114 struct gendisk *disk;
115 struct hd_struct *
part;
118 if (
strlen(uuid_str) < 36)
126 "/PARTNROFF=%d%c", &offset, &c) != 1) {
128 "Expected PARTUUID=<valid-uuid-id>[/PARTNROFF=%%d]\n");
131 "Disabling rootwait; root= is invalid.\n");
138 part_pack_uuid(uuid_str, uuid);
151 disk = part_to_disk(dev_to_part(dev));
152 part =
disk_get_part(disk, dev_to_part(dev)->partno + offset);
154 res = part_devt(part);
194 if (
strncmp(name,
"PARTUUID=", 9) == 0) {
196 res = devt_from_partuuid(name);
203 if (
strncmp(name,
"/dev/", 5) != 0) {
206 if (
sscanf(name,
"%u:%u", &maj, &min) == 2) {
207 res =
MKDEV(maj, min);
220 if (
strcmp(name,
"nfs") == 0)
223 if (
strcmp(name,
"ram") == 0)
240 while (p > s &&
isdigit(p[-1]))
242 if (p == s || !*p || *p ==
'0')
253 if (p < s + 2 || !
isdigit(p[-2]) || p[-1] !=
'p')
268 strlcpy(saved_root_name, line,
sizeof(saved_root_name));
272 __setup(
"root=", root_dev_setup);
274 static int __init rootwait_setup(
char *str)
282 __setup(
"rootwait", rootwait_setup);
285 static int __init root_data_setup(
char *str)
287 root_mount_data =
str;
292 static int __init fs_names_setup(
char *str)
299 static int __init root_delay_setup(
char *str)
305 __setup(
"rootflags=", root_data_setup);
306 __setup(
"rootfstype=", fs_names_setup);
307 __setup(
"rootdelay=", root_delay_setup);
314 strcpy(page, root_fs_names);
324 for (p = page-1;
p; p =
next) {
328 while ((*s++ = *p++) !=
'\n')
344 s =
current->fs->pwd.dentry->d_sb;
347 "VFS: Mounted root (%s filesystem)%s on device %u:%u.\n",
363 const char *b =
name;
366 get_fs_names(fs_names);
368 for (p = fs_names; *
p; p +=
strlen(p)+1) {
369 int err = do_mount_root(name, p, flags, root_mount_data);
387 printk(
"VFS: Cannot open root device \"%s\" or %s: error %d\n",
388 root_device_name, b, err);
389 printk(
"Please append a correct \"root=\" boot option; here are the available partitions:\n");
392 #ifdef CONFIG_DEBUG_BLOCK_EXT_DEVT
393 printk(
"DEBUG_BLOCK_EXT_DEVT is enabled, you need to specify "
394 "explicit textual name for \"root=\" boot option.\n");
396 panic(
"VFS: Unable to mount root fs on %s", b);
399 printk(
"List of all partitions:\n");
401 printk(
"No filesystem could mount root, tried: ");
402 for (p = fs_names; *
p; p +=
strlen(p)+1)
408 panic(
"VFS: Unable to mount root fs on %s", b);
413 #ifdef CONFIG_ROOT_NFS
415 #define NFSROOT_TIMEOUT_MIN 5
416 #define NFSROOT_TIMEOUT_MAX 30
417 #define NFSROOT_RETRY_MAX 5
419 static int __init mount_nfs_root(
void)
434 timeout = NFSROOT_TIMEOUT_MIN;
435 for (
try = 1; ;
try++) {
436 err = do_mount_root(root_dev,
"nfs",
440 if (
try > NFSROOT_RETRY_MAX)
446 if (timeout > NFSROOT_TIMEOUT_MAX)
447 timeout = NFSROOT_TIMEOUT_MAX;
453 #if defined(CONFIG_BLK_DEV_RAM) || defined(CONFIG_BLK_DEV_FD)
485 #ifdef CONFIG_ROOT_NFS
487 if (mount_nfs_root())
490 printk(
KERN_ERR "VFS: Unable to mount root fs via NFS, trying floppy.\n");
494 #ifdef CONFIG_BLK_DEV_FD
500 root_device_name =
NULL;
536 if (saved_root_name[0]) {
537 root_device_name = saved_root_name;
538 if (!
strncmp(root_device_name,
"mtd", 3) ||
539 !
strncmp(root_device_name,
"ubi", 3)) {
544 if (
strncmp(root_device_name,
"/dev/", 5) == 0)
545 root_device_name += 5;