xburst: Remove unmaintained target
[openwrt/staging/mkresin.git] / target / linux / generic / pending-3.18 / 492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch
1 From eea9e1785e4c05c2a3444506aabafa0ae958538f Mon Sep 17 00:00:00 2001
2 From: Daniel Golle <daniel@makrotopia.org>
3 Date: Sat, 17 May 2014 03:35:02 +0200
4 Subject: [PATCH 4/5] try auto-mounting ubi0:rootfs in init/do_mounts.c
5 To: openwrt-devel@lists.openwrt.org
6
7 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
8 ---
9 init/do_mounts.c | 26 +++++++++++++++++++++++++-
10 1 file changed, 25 insertions(+), 1 deletion(-)
11
12 --- a/init/do_mounts.c
13 +++ b/init/do_mounts.c
14 @@ -433,7 +433,28 @@ retry:
15 out:
16 put_page(page);
17 }
18 -
19 +
20 +static int __init mount_ubi_rootfs(void)
21 +{
22 + int flags = MS_SILENT;
23 + int err, tried = 0;
24 +
25 + while (tried < 2) {
26 + err = do_mount_root("ubi0:rootfs", "ubifs", flags, \
27 + root_mount_data);
28 + switch (err) {
29 + case -EACCES:
30 + flags |= MS_RDONLY;
31 + tried++;
32 + break;
33 + default:
34 + return err;
35 + }
36 + }
37 +
38 + return -EINVAL;
39 +}
40 +
41 #ifdef CONFIG_ROOT_NFS
42
43 #define NFSROOT_TIMEOUT_MIN 5
44 @@ -527,6 +548,10 @@ void __init mount_root(void)
45 change_floppy("root floppy");
46 }
47 #endif
48 +#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV
49 + if (!mount_ubi_rootfs())
50 + return;
51 +#endif
52 #ifdef CONFIG_BLOCK
53 create_dev("/dev/root", ROOT_DEV);
54 mount_block_root("/dev/root", root_mountflags);