blob: e0102c7568971d7af8c37d012eeb3e19f208a80e [file] [log] [blame]
developer6d3cdc72022-06-10 10:55:30 +08001--- a/drivers/mtd/ubi/block.c
2+++ b/drivers/mtd/ubi/block.c
3@@ -97,6 +97,12 @@ static DEFINE_IDR(ubiblock_minor_idr);
4 static DEFINE_MUTEX(devices_mutex);
5 static int ubiblock_major;
6
7+static char rootfs_volume[256] = "rootfs";
8+module_param_string(rootfs_volume, rootfs_volume, sizeof(rootfs_volume), 0444);
9+
10+static bool no_default_rootdev;
11+module_param(no_default_rootdev, bool, 0444);
12+
13 static int __init ubiblock_set_param(const char *val,
14 const struct kernel_param *kp)
15 {
16@@ -460,8 +466,9 @@ int ubiblock_create(struct ubi_volume_in
17 dev->ubi_num, dev->vol_id, vi->name);
18 mutex_unlock(&devices_mutex);
19
20- if (!strcmp(vi->name, "rootfs") &&
21+ if (!strcmp(vi->name, rootfs_volume) &&
22 IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) &&
23+ !no_default_rootdev &&
24 ROOT_DEV == 0) {
25 pr_notice("ubiblock: device ubiblock%d_%d (%s) set to be root filesystem\n",
26 dev->ubi_num, dev->vol_id, vi->name);
27@@ -681,7 +688,7 @@ static void __init ubiblock_create_auto_
28 struct ubi_volume_info vi;
29
30 for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++) {
31- desc = ubi_open_volume_nm(ubi_num, "rootfs", UBI_READONLY);
32+ desc = ubi_open_volume_nm(ubi_num, rootfs_volume, UBI_READONLY);
33 if (IS_ERR(desc))
34 continue;
35