@@ -18,6 +18,7 @@
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/byteorder/generic.h>
+#include <linux/of.h>
#include "mtdsplit.h"
@@ -26,10 +27,12 @@ mtdsplit_parse_squashfs(struct mtd_info *master,
const struct mtd_partition **pparts,
struct mtd_part_parser_data *data)
{
+ struct device_node *np;
struct mtd_partition *part;
struct mtd_info *parent_mtd;
size_t part_offset;
size_t squashfs_len;
+ const char *part_name = NULL;
int err;
err = mtd_get_squashfs_len(master, 0, &squashfs_len);
@@ -46,7 +49,18 @@ mtdsplit_parse_squashfs(struct mtd_info *master,
return -ENOMEM;
}
- part->name = ROOTFS_SPLIT_NAME;
+ np = mtd_get_of_node(parent_mtd);
+ if (np && of_device_is_compatible(np, "openwrt,squashfs")) {
+ err = of_property_read_string(np, "openwrt,data-partition-name", &part_name);
+ if (err)
+ pr_debug("failed to retrieve openwrt,data-partition-name.\n");
+ }
+
+ if (part_name == NULL) {
+ part->name = ROOTFS_SPLIT_NAME;
+ } else {
+ part->name = part_name;
+ }
part->offset = mtd_roundup_to_eb(part_offset + squashfs_len,
parent_mtd) - part_offset;
part->size = mtd_rounddown_to_eb(master->size - part->offset, master);
mtdsplit_squashfs always splits into rootfs and rootfs_data. Wit this patch is not possible to give the new partition a different name. Example: partition@140000 { reg = <0x140000 0x1ea0000>; compatible = "openwrt,uimage", "denx,uimage", "openwrt,squashfs"; label = "firmware"; openwrt,offset = <380>; openwrt,data-partition-name = "ubi"; }; This splits at first the uImage into kernel and rootfs, after that rootfs is splitted into rootfs (only squash) and the new ubi partition. Signed-off-by: André Valentin <avalentin@marcant.net> --- .../drivers/mtd/mtdsplit/mtdsplit_squashfs.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)