OpenWrt – Blame information for rev 2
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | From: Daniel Golle <daniel@makrotopia.org> |
2 | Subject: try auto-mounting ubi0:rootfs in init/do_mounts.c |
||
3 | |||
4 | Signed-off-by: Daniel Golle <daniel@makrotopia.org> |
||
5 | --- |
||
6 | init/do_mounts.c | 26 +++++++++++++++++++++++++- |
||
7 | 1 file changed, 25 insertions(+), 1 deletion(-) |
||
8 | |||
9 | --- a/init/do_mounts.c |
||
10 | +++ b/init/do_mounts.c |
||
11 | @@ -438,7 +438,28 @@ retry: |
||
12 | out: |
||
13 | put_page(page); |
||
14 | } |
||
15 | - |
||
16 | + |
||
17 | +static int __init mount_ubi_rootfs(void) |
||
18 | +{ |
||
19 | + int flags = MS_SILENT; |
||
20 | + int err, tried = 0; |
||
21 | + |
||
22 | + while (tried < 2) { |
||
23 | + err = do_mount_root("ubi0:rootfs", "ubifs", flags, \ |
||
24 | + root_mount_data); |
||
25 | + switch (err) { |
||
26 | + case -EACCES: |
||
27 | + flags |= MS_RDONLY; |
||
28 | + tried++; |
||
29 | + break; |
||
30 | + default: |
||
31 | + return err; |
||
32 | + } |
||
33 | + } |
||
34 | + |
||
35 | + return -EINVAL; |
||
36 | +} |
||
37 | + |
||
38 | #ifdef CONFIG_ROOT_NFS |
||
39 | |||
40 | #define NFSROOT_TIMEOUT_MIN 5 |
||
41 | @@ -532,6 +553,10 @@ void __init mount_root(void) |
||
42 | change_floppy("root floppy"); |
||
43 | } |
||
44 | #endif |
||
45 | +#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV |
||
46 | + if (!mount_ubi_rootfs()) |
||
47 | + return; |
||
48 | +#endif |
||
49 | #ifdef CONFIG_BLOCK |
||
50 | { |
||
51 | int err = create_dev("/dev/root", ROOT_DEV); |