diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2016-02-01 12:41:53 +0000 |
---|---|---|
committer | Rafał Miłecki <zajec5@gmail.com> | 2016-02-01 12:41:53 +0000 |
commit | 9cde66b8221841d62c7ad5901af9d2bed81d9e75 (patch) | |
tree | 54e71f8b4b5eb9114a626ab3fb009c9788f976c0 /target/linux/generic/files/drivers | |
parent | dae91075584260451e12fc43d1255b8a11fbcafe (diff) | |
download | master-187ad058-9cde66b8221841d62c7ad5901af9d2bed81d9e75.tar.gz master-187ad058-9cde66b8221841d62c7ad5901af9d2bed81d9e75.tar.bz2 master-187ad058-9cde66b8221841d62c7ad5901af9d2bed81d9e75.zip |
kernel: mtdsplit: support Seama entity with UBI
Some D-Link routers (e.g. DIR-885L) have NAND and use Seama format. It
means OpenWrt will want to have UBI in Sseama entity and should be able
to detect it.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@48600 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic/files/drivers')
-rw-r--r-- | target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit.h | 1 | ||||
-rw-r--r-- | target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_seama.c | 10 |
2 files changed, 8 insertions, 3 deletions
diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit.h b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit.h index 42841ef541..0b52f088c4 100644 --- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit.h +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit.h @@ -15,6 +15,7 @@ #define KERNEL_PART_NAME "kernel" #define ROOTFS_PART_NAME "rootfs" +#define UBI_PART_NAME "ubi" #define ROOTFS_SPLIT_NAME "rootfs_data" diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_seama.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_seama.c index 228b8997ad..f8ddee7ce0 100644 --- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_seama.c +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_seama.c @@ -36,6 +36,7 @@ static int mtdsplit_parse_seama(struct mtd_info *master, size_t hdr_len, retlen, kernel_ent_size; size_t rootfs_offset; struct mtd_partition *parts; + enum mtdsplit_part_type type; int err; hdr_len = sizeof(hdr); @@ -56,7 +57,7 @@ static int mtdsplit_parse_seama(struct mtd_info *master, return -EINVAL; /* Check for the rootfs right after Seama entity with a kernel. */ - err = mtd_check_rootfs_magic(master, kernel_ent_size, NULL); + err = mtd_check_rootfs_magic(master, kernel_ent_size, &type); if (!err) { rootfs_offset = kernel_ent_size; } else { @@ -67,7 +68,7 @@ static int mtdsplit_parse_seama(struct mtd_info *master, * Start the search from an arbitrary offset. */ err = mtd_find_rootfs_from(master, SEAMA_MIN_ROOTFS_OFFS, - master->size, &rootfs_offset, NULL); + master->size, &rootfs_offset, &type); if (err) return err; } @@ -80,7 +81,10 @@ static int mtdsplit_parse_seama(struct mtd_info *master, parts[0].offset = 0; parts[0].size = rootfs_offset; - parts[1].name = ROOTFS_PART_NAME; + if (type == MTDSPLIT_PART_TYPE_UBI) + parts[1].name = UBI_PART_NAME; + else + parts[1].name = ROOTFS_PART_NAME; parts[1].offset = rootfs_offset; parts[1].size = master->size - rootfs_offset; |