blob: 1ee614240869ec9f7735098ff7b3bac12094d61a [file] [log] [blame]
From 27ae9a1b684cd183ccf6881d32710b8890113d20 Mon Sep 17 00:00:00 2001
From: Sam Shih <sam.shih@mediatek.com>
Date: Fri, 2 Jun 2023 13:06:14 +0800
Subject: [PATCH]
[spi-and-storage][999-2329-ubi-add-configurable-rootdev.patch]
---
drivers/mtd/ubi/block.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
index 873f9cb24..33e969fd3 100644
--- a/drivers/mtd/ubi/block.c
+++ b/drivers/mtd/ubi/block.c
@@ -97,6 +97,12 @@ static DEFINE_IDR(ubiblock_minor_idr);
static DEFINE_MUTEX(devices_mutex);
static int ubiblock_major;
+static char rootfs_volume[256] = "rootfs";
+module_param_string(rootfs_volume, rootfs_volume, sizeof(rootfs_volume), 0444);
+
+static bool no_default_rootdev;
+module_param(no_default_rootdev, bool, 0444);
+
static int __init ubiblock_set_param(const char *val,
const struct kernel_param *kp)
{
@@ -460,8 +466,9 @@ int ubiblock_create(struct ubi_volume_info *vi)
dev->ubi_num, dev->vol_id, vi->name);
mutex_unlock(&devices_mutex);
- if (!strcmp(vi->name, "rootfs") &&
+ if (!strcmp(vi->name, rootfs_volume) &&
IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) &&
+ !no_default_rootdev &&
ROOT_DEV == 0) {
pr_notice("ubiblock: device ubiblock%d_%d (%s) set to be root filesystem\n",
dev->ubi_num, dev->vol_id, vi->name);
@@ -681,7 +688,7 @@ static void __init ubiblock_create_auto_rootfs(void)
struct ubi_volume_info vi;
for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++) {
- desc = ubi_open_volume_nm(ubi_num, "rootfs", UBI_READONLY);
+ desc = ubi_open_volume_nm(ubi_num, rootfs_volume, UBI_READONLY);
if (IS_ERR(desc))
continue;
--
2.34.1