]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
init/do_mounts.c: create /root if it does not exist
authorYanHong <tempname2@hotmail.com>
Tue, 20 Mar 2012 23:57:27 +0000 (10:57 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 3 Apr 2012 03:10:15 +0000 (13:10 +1000)
If someone supplies an initramfs without /root in it, and we fail to
execute rdinit, we will try to mount root device and fail, for the mount
point does not exits.

But we get error message "VFS: Cannot open root device".  It's confusing.

We can give a more detailed error message, or we can go further: if /root
does not exit, create it.

Signed-off-by: YanHong <tempname2@hotmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Woody Suwalski <terraluna977@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
init/do_mounts.c

index 0e93f92a0345a09a2aa84608a3bca34153a2eabb..386358b0de61d57901c136cbd3c2f73691c669bf 100644 (file)
@@ -352,6 +352,9 @@ void __init mount_block_root(char *name, int flags)
        const char *b = name;
 #endif
 
+       if (sys_access((const char __user *) "/root", 0) != 0)
+               sys_mkdir((const char __user *) "/root", 0700);
+
        get_fs_names(fs_names);
 retry:
        for (p = fs_names; *p; p += strlen(p)+1) {