blob: 1ee614240869ec9f7735098ff7b3bac12094d61a [file] [log] [blame]
developer5d148cb2023-06-02 13:08:11 +08001From 27ae9a1b684cd183ccf6881d32710b8890113d20 Mon Sep 17 00:00:00 2001
2From: Sam Shih <sam.shih@mediatek.com>
3Date: Fri, 2 Jun 2023 13:06:14 +0800
4Subject: [PATCH]
5 [spi-and-storage][999-2329-ubi-add-configurable-rootdev.patch]
6
7---
8 drivers/mtd/ubi/block.c | 11 +++++++++--
9 1 file changed, 9 insertions(+), 2 deletions(-)
10
11diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
12index 873f9cb24..33e969fd3 100644
developer6d3cdc72022-06-10 10:55:30 +080013--- a/drivers/mtd/ubi/block.c
14+++ b/drivers/mtd/ubi/block.c
15@@ -97,6 +97,12 @@ static DEFINE_IDR(ubiblock_minor_idr);
16 static DEFINE_MUTEX(devices_mutex);
17 static int ubiblock_major;
18
19+static char rootfs_volume[256] = "rootfs";
20+module_param_string(rootfs_volume, rootfs_volume, sizeof(rootfs_volume), 0444);
21+
22+static bool no_default_rootdev;
23+module_param(no_default_rootdev, bool, 0444);
24+
25 static int __init ubiblock_set_param(const char *val,
26 const struct kernel_param *kp)
27 {
developer5d148cb2023-06-02 13:08:11 +080028@@ -460,8 +466,9 @@ int ubiblock_create(struct ubi_volume_info *vi)
developer6d3cdc72022-06-10 10:55:30 +080029 dev->ubi_num, dev->vol_id, vi->name);
30 mutex_unlock(&devices_mutex);
31
32- if (!strcmp(vi->name, "rootfs") &&
33+ if (!strcmp(vi->name, rootfs_volume) &&
34 IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) &&
35+ !no_default_rootdev &&
36 ROOT_DEV == 0) {
37 pr_notice("ubiblock: device ubiblock%d_%d (%s) set to be root filesystem\n",
38 dev->ubi_num, dev->vol_id, vi->name);
developer5d148cb2023-06-02 13:08:11 +080039@@ -681,7 +688,7 @@ static void __init ubiblock_create_auto_rootfs(void)
developer6d3cdc72022-06-10 10:55:30 +080040 struct ubi_volume_info vi;
41
42 for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++) {
43- desc = ubi_open_volume_nm(ubi_num, "rootfs", UBI_READONLY);
44+ desc = ubi_open_volume_nm(ubi_num, rootfs_volume, UBI_READONLY);
45 if (IS_ERR(desc))
46 continue;
47
developer5d148cb2023-06-02 13:08:11 +080048--
492.34.1
50