493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch 982 B

12345678910111213141516171819202122232425262728293031323334
  1. From: Daniel Golle <[email protected]>
  2. Subject: ubi: set ROOT_DEV to ubiblock "rootfs" if unset
  3. Signed-off-by: Daniel Golle <[email protected]>
  4. ---
  5. drivers/mtd/ubi/block.c | 10 ++++++++++
  6. 1 file changed, 10 insertions(+)
  7. --- a/drivers/mtd/ubi/block.c
  8. +++ b/drivers/mtd/ubi/block.c
  9. @@ -43,6 +43,7 @@
  10. #include <linux/scatterlist.h>
  11. #include <linux/idr.h>
  12. #include <asm/div64.h>
  13. +#include <linux/root_dev.h>
  14. #include "ubi-media.h"
  15. #include "ubi.h"
  16. @@ -460,6 +461,15 @@ int ubiblock_create(struct ubi_volume_in
  17. dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)",
  18. dev->ubi_num, dev->vol_id, vi->name);
  19. mutex_unlock(&devices_mutex);
  20. +
  21. + if (!strcmp(vi->name, "rootfs") &&
  22. + IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) &&
  23. + ROOT_DEV == 0) {
  24. + pr_notice("ubiblock: device ubiblock%d_%d (%s) set to be root filesystem\n",
  25. + dev->ubi_num, dev->vol_id, vi->name);
  26. + ROOT_DEV = MKDEV(gd->major, gd->first_minor);
  27. + }
  28. +
  29. return 0;
  30. out_destroy_wq: