kernel: update 3.14 to 3.14.7
[openwrt.git] / target / linux / generic / patches-3.14 / 493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch
1 From cd68d1b12b5ea4c01a664c064179ada42bf55d3d Mon Sep 17 00:00:00 2001
2 From: Daniel Golle <daniel@makrotopia.org>
3 Date: Thu, 15 May 2014 20:55:42 +0200
4 Subject: [PATCH 5/5] ubi: set ROOT_DEV to ubiblock "rootfs" if unset
5 To: openwrt-devel@lists.openwrt.org
6
7 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
8 ---
9  drivers/mtd/ubi/block.c | 10 ++++++++++
10  1 file changed, 10 insertions(+)
11
12 --- a/drivers/mtd/ubi/block.c
13 +++ b/drivers/mtd/ubi/block.c
14 @@ -48,6 +48,7 @@
15  #include <linux/blkdev.h>
16  #include <linux/hdreg.h>
17  #include <asm/div64.h>
18 +#include <linux/root_dev.h>
19  
20  #include "ubi-media.h"
21  #include "ubi.h"
22 @@ -444,6 +445,15 @@ int ubiblock_create(struct ubi_volume_in
23         add_disk(dev->gd);
24         ubi_msg("%s created from ubi%d:%d(%s)",
25                 dev->gd->disk_name, dev->ubi_num, dev->vol_id, vi->name);
26 +
27 +       if (!strcmp(vi->name, "rootfs") &&
28 +           config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) &&
29 +           ROOT_DEV == 0) {
30 +               pr_notice("ubiblock: device ubiblock%d_%d (%s) set to be root filesystem\n",
31 +                         dev->ubi_num, dev->vol_id, vi->name);
32 +               ROOT_DEV = MKDEV(gd->major, gd->first_minor);
33 +       }
34 +
35         return 0;
36  
37  out_free_queue: