1 From: Daniel Golle <daniel@makrotopia.org>
2 Subject: ubi: set ROOT_DEV to ubiblock "rootfs" if unset
4 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
6 drivers/mtd/ubi/block.c | 10 ++++++++++
7 1 file changed, 10 insertions(+)
9 --- a/drivers/mtd/ubi/block.c
10 +++ b/drivers/mtd/ubi/block.c
12 #include <linux/scatterlist.h>
13 #include <linux/idr.h>
14 #include <asm/div64.h>
15 +#include <linux/root_dev.h>
17 #include "ubi-media.h"
19 @@ -429,6 +430,15 @@ int ubiblock_create(struct ubi_volume_in
20 dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)",
21 dev->ubi_num, dev->vol_id, vi->name);
22 mutex_unlock(&devices_mutex);
24 + if (!strcmp(vi->name, "rootfs") &&
25 + IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) &&
27 + pr_notice("ubiblock: device ubiblock%d_%d (%s) set to be root filesystem\n",
28 + dev->ubi_num, dev->vol_id, vi->name);
29 + ROOT_DEV = MKDEV(gd->major, gd->first_minor);