From patchwork Mon May 17 09:57:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Valentin?= X-Patchwork-Id: 1479333 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=R9hxytL0; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FkF3v1QRYz9sSs for ; Mon, 17 May 2021 19:59:54 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wMUtEJUxYX5q+Dg6fGgUJTMbNY0EBI9/Rap2em7BPdM=; b=R9hxytL0r1EKyTOKnaQWcC/t2 puZwSJ2HDJ9FSUrZ+HhN9s+J3l8cN33syFu2W8ndJGmeG9gsuO40H+AM+46ZcCAbL4EQ5I2I9LnCZ QEfvq9Y+RgaVnvP35WsJBF68VNSPAt6K+JNBDZl0b3XY0uWZT4WHpmdBCVRFceAk+BtjB89yGwo8/ xphiC9qDshlDnmg6LG5ne24XavrQA/gszkLNRV7Qe0uBc/irNOcjjBz1HU2b+FcH9HiPwdkTPDz04 LYPeFbh7ACViQGDlekJqREDcuQFsqZ5hJY0SWoyiEWqy6oeNk8nwmpyHBKYnI1aE1RtnWP4fKt/SB 4icvD51PQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lia0p-00EUKy-5F; Mon, 17 May 2021 09:58:11 +0000 Received: from mail3.marcant.net ([217.14.160.188]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lia00-00EU5w-SD for openwrt-devel@lists.openwrt.org; Mon, 17 May 2021 09:57:36 +0000 Received: from [192.168.180.1] (port=55078 helo=admins.marcant.net) by mail3.marcant.net with esmtp (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1liZzx-0007ay-2A; Mon, 17 May 2021 11:57:17 +0200 Received: from varus.marcant.loc (unknown [192.168.3.44]) by admins.marcant.net (Postfix) with ESMTPA id 940DA280919; Mon, 17 May 2021 11:57:17 +0200 (CEST) From: =?utf-8?q?Andr=C3=A9_Valentin?= To: openwrt-devel@lists.openwrt.org, a.valentin@ddimension.net Cc: avalentin@marcant.net Subject: [PATCH v2 2/4] mtdsplit_squashfs: allow devicetree to define the name of the new partition Date: Mon, 17 May 2021 11:57:09 +0200 Message-Id: <20210517095712.24332-3-avalentin@marcant.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210517095712.24332-1-avalentin@marcant.net> References: <20210517095712.24332-1-avalentin@marcant.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210517_105730_645281_52EB3854 X-CRM114-Status: GOOD ( 14.40 ) X-Spam-Score: 0.0 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 [...] Content analysis details: (0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org 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 --- .../drivers/mtd/mtdsplit/mtdsplit_squashfs.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_squashfs.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_squashfs.c index f6353da65b..9fdc425844 100644 --- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_squashfs.c +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_squashfs.c @@ -18,6 +18,7 @@ #include #include #include +#include #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);