summaryrefslogtreecommitdiff
path: root/target/linux/patches/4.1.23/mtd-rootfs.patch
blob: 5f6d82b5c6d1924021ea8d7b19b1294377eec0ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
diff -Nur linux-4.1.15.orig/drivers/mtd/mtdpart.c linux-4.1.15/drivers/mtd/mtdpart.c
--- linux-4.1.15.orig/drivers/mtd/mtdpart.c	2015-12-15 06:24:51.000000000 +0100
+++ linux-4.1.15/drivers/mtd/mtdpart.c	2015-12-26 21:02:02.766905805 +0100
@@ -30,6 +30,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/err.h>
+#include <linux/root_dev.h>
 #include <linux/kconfig.h>
 
 #include "mtdcore.h"
@@ -667,6 +668,14 @@
 		if (IS_ERR(slave))
 			return PTR_ERR(slave);
 
+		if (strcmp(parts[i].name, "rootfs") == 0) {
+			if (ROOT_DEV == 0) {
+				printk(KERN_NOTICE "mtd: partition \"rootfs\" "
+					"set to be root filesystem\n");
+					ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, i);
+			}
+		}
+
 		mutex_lock(&mtd_partitions_mutex);
 		list_add(&slave->list, &mtd_partitions);
 		mutex_unlock(&mtd_partitions_mutex);