1
0

492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch 1019 B

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