kernel: mtdsplit: detect UBI partition when looking for rootfs

This allows mtdsplit parsers work with UBI which is very popular on
NAND flases.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 48599
This commit is contained in:
Rafał Miłecki 2016-02-01 12:41:47 +00:00
parent e1491b341b
commit 4156f292c1
2 changed files with 7 additions and 0 deletions

View file

@ -22,6 +22,8 @@
#include "mtdsplit.h"
#define UBI_EC_MAGIC 0x55424923 /* UBI# */
struct squashfs_super_block {
__le32 s_magic;
__le32 pad0[9];
@ -93,6 +95,10 @@ int mtd_check_rootfs_magic(struct mtd_info *mtd, size_t offset,
if (type)
*type = MTDSPLIT_PART_TYPE_JFFS2;
return 0;
} else if (be32_to_cpu(magic) == UBI_EC_MAGIC) {
if (type)
*type = MTDSPLIT_PART_TYPE_UBI;
return 0;
}
return -EINVAL;

View file

@ -22,6 +22,7 @@ enum mtdsplit_part_type {
MTDSPLIT_PART_TYPE_UNK = 0,
MTDSPLIT_PART_TYPE_SQUASHFS,
MTDSPLIT_PART_TYPE_JFFS2,
MTDSPLIT_PART_TYPE_UBI,
};
#ifdef CONFIG_MTD_SPLIT