developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 1 | From 27ae9a1b684cd183ccf6881d32710b8890113d20 Mon Sep 17 00:00:00 2001 |
| 2 | From: Sam Shih <sam.shih@mediatek.com> |
| 3 | Date: Fri, 2 Jun 2023 13:06:14 +0800 |
| 4 | Subject: [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 | |
| 11 | diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c |
| 12 | index 873f9cb24..33e969fd3 100644 |
developer | 6d3cdc7 | 2022-06-10 10:55:30 +0800 | [diff] [blame] | 13 | --- 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 | { |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 28 | @@ -460,8 +466,9 @@ int ubiblock_create(struct ubi_volume_info *vi) |
developer | 6d3cdc7 | 2022-06-10 10:55:30 +0800 | [diff] [blame] | 29 | 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); |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 39 | @@ -681,7 +688,7 @@ static void __init ubiblock_create_auto_rootfs(void) |
developer | 6d3cdc7 | 2022-06-10 10:55:30 +0800 | [diff] [blame] | 40 | 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 | |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 48 | -- |
| 49 | 2.34.1 |
| 50 | |