2
0

480-mtd-set-rootfs-to-be-root-dev.patch 704 B

1234567891011121314151617181920212223242526
  1. --- a/drivers/mtd/mtdcore.c
  2. +++ b/drivers/mtd/mtdcore.c
  3. @@ -37,6 +37,7 @@
  4. #include <linux/backing-dev.h>
  5. #include <linux/gfp.h>
  6. #include <linux/slab.h>
  7. +#include <linux/root_dev.h>
  8. #include <linux/mtd/mtd.h>
  9. #include <linux/mtd/partitions.h>
  10. @@ -456,6 +457,15 @@ int add_mtd_device(struct mtd_info *mtd)
  11. of this try_ nonsense, and no bitching about it
  12. either. :) */
  13. __module_get(THIS_MODULE);
  14. +
  15. + if (!strcmp(mtd->name, "rootfs") &&
  16. + config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) &&
  17. + ROOT_DEV == 0) {
  18. + pr_notice("mtd: device %d (%s) set to be root filesystem\n",
  19. + mtd->index, mtd->name);
  20. + ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index);
  21. + }
  22. +
  23. return 0;
  24. fail_added: