From patchwork Mon Nov 30 22:19:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Bj=C3=B8rn_Mork?= X-Patchwork-Id: 1408499 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mork.no 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=merlin.20170209 header.b=R2e5qQk0; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=mork.no header.i=@mork.no header.a=rsa-sha256 header.s=b header.b=AgvwfoAC; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 4ClKTh5MFzz9sSf for ; Tue, 1 Dec 2020 09:21:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PFAY2Gb+rgOhXNM6Wac9gb7ZGFDoLPFp9XbndUFK8wE=; b=R2e5qQk0bUs9lcjt6bDJmr9Ea iFlCsch1s77EQrnE5M8h0itBv0SbSXav/C78cPRF3/xGx4vMAS7CIWR08eGT+qQx4qfxu0dEtM7nH YDrptKvD8IPGjSwU+SVWGKvoPpjnqLicNNR0+Sqq0n8rlDQpTfFRm14uBaVgNP3pqIr3VKsg1L7Pj hkxFjbJoT0yRw/bRHvHf1zetodq8fwluBK+gw5hlC6aKiQxMSzV29pycm2fkpWuxHHbuZ4uSfbYJD ppHCzhFaviMUFceGogBgxo2OgWyBKZnfG3x6hqh+nPn84smRPsJ54/UHLRT6EwNfHz+cPMPKpsqrf 6xRPdS0AQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjrWg-0002l1-Be; Mon, 30 Nov 2020 22:20:06 +0000 Received: from canardo.mork.no ([2001:4641::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjrWJ-0002d4-Q5 for openwrt-devel@lists.openwrt.org; Mon, 30 Nov 2020 22:19:51 +0000 Received: from canardo.mork.no (ip6-localhost [IPv6:0:0:0:0:0:0:0:1]) by canardo.mork.no (8.15.2/8.15.2) with ESMTPS id 0AUMJeOR011319 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK); Mon, 30 Nov 2020 23:19:40 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mork.no; s=b; t=1606774780; bh=TstyhZJQm7635InGONFAKUiDdSYnJ5HR9xcW5qFpOPE=; h=From:To:Cc:Subject:Date:Message-Id:References:From; b=AgvwfoACjkwHJ0L77H+UBNWZfeAmYVhKb+MrKD6O9DeWvx6SdCDDdLshgzPl0gayO R74jOpRwUjkeokyCPVqARONqpPs6cOVx1Mzc5AbkloimXjSlMfjhdZtSb//jLSGD+h skaZZhvA9Q9+tODl3kPuwBBDXb2I/RQ1xJ8ZjAWs= Received: (from bjorn@localhost) by canardo.mork.no (8.15.2/8.15.2/Submit) id 0AUMJei3011312; Mon, 30 Nov 2020 23:19:40 +0100 From: =?utf-8?q?Bj=C3=B8rn_Mork?= To: openwrt-devel@lists.openwrt.org Subject: [PATCH v2 05/10] kernel: mtdsplit_uimage: replace "openwrt, okli" parser Date: Mon, 30 Nov 2020 23:19:30 +0100 Message-Id: <20201130221935.11127-6-bjorn@mork.no> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201130221935.11127-1-bjorn@mork.no> References: <20201130221935.11127-1-bjorn@mork.no> MIME-Version: 1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on canardo.mork.no X-Virus-Scanned: clamav-milter 0.102.4 at canardo X-Virus-Status: Clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201130_171944_188077_9049EA08 X-CRM114-Status: GOOD ( 15.29 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [2001:4641:0:0:0:0:0:1 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Bj=C3=B8rn_Mork?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org The only difference between the "openwrt,okli" and the generic parser is the magic. Set this in device tree for all affected devices and remove the "openwrt,okli" parser. Signed-off-by: Bjørn Mork --- .../ath79/dts/ar7240_engenius_enh202-v1.dts | 3 +- .../dts/ar9341_engenius_ens202ext-v1.dts | 3 +- .../linux/ath79/dts/ar9341_pisen_wmb001n.dts | 3 +- .../drivers/mtd/mtdsplit/mtdsplit_uimage.c | 53 ------------------- .../ramips/dts/mt7620n_sunvalley_filehub.dtsi | 3 +- 5 files changed, 8 insertions(+), 57 deletions(-) diff --git a/target/linux/ath79/dts/ar7240_engenius_enh202-v1.dts b/target/linux/ath79/dts/ar7240_engenius_enh202-v1.dts index 4752ad1edd5b..d42f75d31dcc 100644 --- a/target/linux/ath79/dts/ar7240_engenius_enh202-v1.dts +++ b/target/linux/ath79/dts/ar7240_engenius_enh202-v1.dts @@ -80,7 +80,8 @@ #size-cells = <1>; partition@0 { - compatible = "openwrt,okli"; + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = <0x4f4b4c49>; label = "firmware"; reg = <0x0 0x0>; }; diff --git a/target/linux/ath79/dts/ar9341_engenius_ens202ext-v1.dts b/target/linux/ath79/dts/ar9341_engenius_ens202ext-v1.dts index da1e59d4c321..e936109351df 100644 --- a/target/linux/ath79/dts/ar9341_engenius_ens202ext-v1.dts +++ b/target/linux/ath79/dts/ar9341_engenius_ens202ext-v1.dts @@ -70,7 +70,8 @@ #size-cells = <1>; partition@0 { - compatible = "openwrt,okli"; + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = <0x4f4b4c49>; label = "firmware"; reg = <0x0 0x0>; }; diff --git a/target/linux/ath79/dts/ar9341_pisen_wmb001n.dts b/target/linux/ath79/dts/ar9341_pisen_wmb001n.dts index 7057c3b1adf2..42f2fc22ae00 100644 --- a/target/linux/ath79/dts/ar9341_pisen_wmb001n.dts +++ b/target/linux/ath79/dts/ar9341_pisen_wmb001n.dts @@ -106,7 +106,8 @@ partition@0 { reg = <0x0 0x0>; label = "firmware"; - compatible = "openwrt,okli"; + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = <0x4f4b4c49>; }; }; }; diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c index 58c40e9ec70b..32c027d3e979 100644 --- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c @@ -429,58 +429,6 @@ static struct mtd_part_parser uimage_edimax_parser = { .type = MTD_PARSER_TYPE_FIRMWARE, }; -/************************************************** - * OKLI (OpenWrt Kernel Loader Image) - **************************************************/ - -#define IH_MAGIC_OKLI 0x4f4b4c49 - -static ssize_t uimage_verify_okli(u_char *buf, size_t len, u32 ih_magic) -{ - struct uimage_header *header = (struct uimage_header *)buf; - - /* default sanity checks */ - if (be32_to_cpu(header->ih_magic) != IH_MAGIC_OKLI) { - pr_debug("invalid uImage magic: %08x\n", - be32_to_cpu(header->ih_magic)); - return -EINVAL; - } - - if (header->ih_os != IH_OS_LINUX) { - pr_debug("invalid uImage OS: %08x\n", - be32_to_cpu(header->ih_os)); - return -EINVAL; - } - - if (header->ih_type != IH_TYPE_KERNEL) { - pr_debug("invalid uImage type: %08x\n", - be32_to_cpu(header->ih_type)); - return -EINVAL; - } - - return 0; -} - -static int -mtdsplit_uimage_parse_okli(struct mtd_info *master, - const struct mtd_partition **pparts, - struct mtd_part_parser_data *data) -{ - return __mtdsplit_parse_uimage(master, pparts, data, - uimage_verify_okli); -} - -static const struct of_device_id mtdsplit_uimage_okli_of_match_table[] = { - { .compatible = "openwrt,okli" }, - {}, -}; - -static struct mtd_part_parser uimage_okli_parser = { - .owner = THIS_MODULE, - .name = "okli-fw", - .of_match_table = mtdsplit_uimage_okli_of_match_table, - .parse_fn = mtdsplit_uimage_parse_okli, -}; /************************************************** * Init @@ -492,7 +440,6 @@ static int __init mtdsplit_uimage_init(void) register_mtd_parser(&uimage_netgear_parser); register_mtd_parser(&uimage_allnet_parser); register_mtd_parser(&uimage_edimax_parser); - register_mtd_parser(&uimage_okli_parser); return 0; } diff --git a/target/linux/ramips/dts/mt7620n_sunvalley_filehub.dtsi b/target/linux/ramips/dts/mt7620n_sunvalley_filehub.dtsi index d94379a41f2f..cc06dfab877e 100644 --- a/target/linux/ramips/dts/mt7620n_sunvalley_filehub.dtsi +++ b/target/linux/ramips/dts/mt7620n_sunvalley_filehub.dtsi @@ -31,7 +31,8 @@ #size-cells = <1>; partition@0 { - compatible = "openwrt,okli"; + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = <0x4f4b4c49>; label = "firmware"; reg = <0x0 0x0>; };