[openwrt/openwrt] bcm53xx: add pending TRX patch for "firmware" partition

LEDE Commits lede-commits at lists.infradead.org
Fri Apr 16 15:27:55 BST 2021


rmilecki pushed a commit to openwrt/openwrt.git, branch openwrt-21.02:
https://git.openwrt.org/beab1bf16317d83e59c669ce83ce16268d197f91

commit beab1bf16317d83e59c669ce83ce16268d197f91
Author: Rafał Miłecki <rafal at milecki.pl>
AuthorDate: Wed Apr 14 08:26:25 2021 +0200

    bcm53xx: add pending TRX patch for "firmware" partition
    
    This fixes partitioning on Linksys EA9500. With this change only the
    currently used firmware MTD partition gets parsed.
    
    Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
    (cherry picked from commit a3c7633ddcd4fac9ec8935e5be9249c011bfec14)
---
 ...rs-trx-parse-firmware-MTD-partitions-only.patch | 43 ++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/target/linux/bcm53xx/patches-5.4/140-mtd-parsers-trx-parse-firmware-MTD-partitions-only.patch b/target/linux/bcm53xx/patches-5.4/140-mtd-parsers-trx-parse-firmware-MTD-partitions-only.patch
new file mode 100644
index 0000000000..fa86303637
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/140-mtd-parsers-trx-parse-firmware-MTD-partitions-only.patch
@@ -0,0 +1,43 @@
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
+Date: Tue, 13 Apr 2021 18:25:20 +0200
+Subject: [PATCH] mtd: parsers: trx: parse "firmware" MTD partitions only
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Parsing every partition with "compatible" set to "brcm,trx" results in
+parsing both: firmware partition and failsafe partition on devices that
+implement failsafe booting. This affects e.g. Linksys EA9500 which has:
+
+partition at 200000 {
+	reg = <0x0200000 0x01d00000>;
+	compatible = "linksys,ns-firmware", "brcm,trx";
+};
+
+partition at 1f00000 {
+	reg = <0x01f00000 0x01d00000>;
+	compatible = "linksys,ns-firmware", "brcm,trx";
+};
+
+Check for MTD partition name "firmware" before parsing. Recently added
+ofpart_linksys_ns.c creates "firmware" and "failsafe" depending on
+bootloader setup.
+
+Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
+---
+ drivers/mtd/parsers/parser_trx.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/mtd/parsers/parser_trx.c
++++ b/drivers/mtd/parsers/parser_trx.c
+@@ -85,6 +85,10 @@ static int parser_trx_parse(struct mtd_i
+ 	uint8_t curr_part = 0, i = 0;
+ 	int err;
+ 
++	/* Don't parse any failsafe / backup partitions */
++	if (strcmp(mtd->name, "firmware"))
++		return -EINVAL;
++
+ 	parts = kcalloc(TRX_PARSER_MAX_PARTS, sizeof(struct mtd_partition),
+ 			GFP_KERNEL);
+ 	if (!parts)



More information about the lede-commits mailing list