--- zzzz-none-000/linux-4.4.60/init/do_mounts.c 2017-04-08 07:53:53.000000000 +0000 +++ wasp-540e-714/linux-4.4.60/init/do_mounts.c 2019-07-03 09:21:34.000000000 +0000 @@ -290,7 +290,9 @@ } EXPORT_SYMBOL_GPL(name_to_dev_t); -static int __init root_dev_setup(char *line) +/* this isn't static anymore, as we need to have this function available for + * mtdram1= param parsing in our mtd code -PHU*/ +int __init root_dev_setup(char *line) { strlcpy(saved_root_name, line, sizeof(saved_root_name)); return 1; @@ -438,7 +440,7 @@ out: put_page(page); } - + #ifdef CONFIG_ROOT_NFS #define NFSROOT_TIMEOUT_MIN 5 @@ -583,12 +585,31 @@ goto out; /* wait for any asynchronous scanning to complete */ - if ((ROOT_DEV == 0) && root_wait) { + if ((ROOT_DEV == 0) && root_wait && saved_root_name[0]) { printk(KERN_INFO "Waiting for root device %s...\n", saved_root_name); while (driver_probe_done() != 0 || (ROOT_DEV = name_to_dev_t(saved_root_name)) == 0) msleep(100); + + async_synchronize_full(); + } else if (config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) && + (ROOT_DEV == 0) && root_wait) { + pr_info(KERN_INFO "Waiting for root device ...\n"); + /* + * Though MMC devices get detected before kernel + * reaches here, GPT partition table parsing happens + * later. Since we assume the GPT partition "rootfs", + * as the device to mount the Root FS from, the + * "root=xxx" command line option might not be + * present resulting in 'saved_root_name' being NULL. + * Hence, don't try to do 'name_to_dev_t' on it. + * Eventually, ROOT_DEV will get updated by the GPT + * parsing code and we will break out of this loop. + */ + while (driver_probe_done() != 0 || ROOT_DEV == 0) + msleep(100); + async_synchronize_full(); } @@ -633,6 +654,7 @@ if (err) return err; +#if 0 if (IS_ENABLED(CONFIG_TMPFS) && !saved_root_name[0] && (!root_fs_names || strstr(root_fs_names, "tmpfs"))) { err = shmem_init(); @@ -640,6 +662,9 @@ } else { err = init_ramfs_fs(); } +#else + err = init_ramfs_fs(); +#endif if (err) unregister_filesystem(&rootfs_fs_type);