1
0

493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From cd68d1b12b5ea4c01a664c064179ada42bf55d3d Mon Sep 17 00:00:00 2001
  2. From: Daniel Golle <daniel@makrotopia.org>
  3. Date: Thu, 15 May 2014 20:55:42 +0200
  4. Subject: [PATCH 5/5] ubi: set ROOT_DEV to ubiblock "rootfs" if unset
  5. To: openwrt-devel@lists.openwrt.org
  6. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  7. ---
  8. drivers/mtd/ubi/block.c | 10 ++++++++++
  9. 1 file changed, 10 insertions(+)
  10. --- a/drivers/mtd/ubi/block.c
  11. +++ b/drivers/mtd/ubi/block.c
  12. @@ -50,6 +50,7 @@
  13. #include <linux/scatterlist.h>
  14. #include <linux/idr.h>
  15. #include <asm/div64.h>
  16. +#include <linux/root_dev.h>
  17. #include "ubi-media.h"
  18. #include "ubi.h"
  19. @@ -447,6 +448,15 @@ int ubiblock_create(struct ubi_volume_in
  20. add_disk(dev->gd);
  21. dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)",
  22. dev->ubi_num, dev->vol_id, vi->name);
  23. +
  24. + if (!strcmp(vi->name, "rootfs") &&
  25. + config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) &&
  26. + ROOT_DEV == 0) {
  27. + pr_notice("ubiblock: device ubiblock%d_%d (%s) set to be root filesystem\n",
  28. + dev->ubi_num, dev->vol_id, vi->name);
  29. + ROOT_DEV = MKDEV(gd->major, gd->first_minor);
  30. + }
  31. +
  32. mutex_unlock(&devices_mutex);
  33. return 0;