From ac0e2479dc5a720d1ad70fb558fe415588f05a27 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@openwrt.org>
Date: Sun, 10 May 2015 16:09:58 +0000
Subject: [PATCH] mtd: remove the warning about read-only caused by size vs.
 block boundary mismatch

Since the kernel/rootfs split handling was modified 2 years ago by r37283 (
https://dev.openwrt.org/changeset/37283 ) and by the subsequent checkins,
users have seen rather scary mtd errors in the log at every boot. The message
ends "-- forcing read-only", which looks a bit error-like. That error has
been mentioned in some forum threads, when users have noticed this message
instead of some actual error.

[    2.940000] 0x000000070000-0x000000ff0000 : "firmware"
[    2.970000] 2 netgear-fw partitions found on MTD device firmware
[    2.970000] 0x000000070000-0x000000188440 : "kernel"
[    2.980000] mtd: partition "kernel" must either start or end on erase
block boundary or be smaller than an erase block -- forcing read-only
[    2.990000] 0x000000188440-0x000000ff0000 : "rootfs"

The patch removes the rather useless warning message.

signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>

SVN-Revision: 45669
---
 .../patches-3.18/411-mtd-partial_eraseblock_write.patch      | 5 +----
 .../patches-4.0/411-mtd-partial_eraseblock_write.patch       | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/target/linux/generic/patches-3.18/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/patches-3.18/411-mtd-partial_eraseblock_write.patch
index 0bb7be0848..0c117c2703 100644
--- a/target/linux/generic/patches-3.18/411-mtd-partial_eraseblock_write.patch
+++ b/target/linux/generic/patches-3.18/411-mtd-partial_eraseblock_write.patch
@@ -97,7 +97,7 @@
  		if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
  			instr->fail_addr -= part->offset;
  		instr->addr -= part->offset;
-@@ -514,18 +582,24 @@ static struct mtd_part *allocate_partiti
+@@ -514,18 +582,21 @@ static struct mtd_part *allocate_partiti
  	if ((slave->mtd.flags & MTD_WRITEABLE) &&
  	    mtd_mod_by_eb(slave->offset, &slave->mtd)) {
  		/* Doesn't start on a boundary of major erase size */
@@ -125,9 +125,6 @@
 +		else
 +			slave->mtd.erasesize = slave->mtd.size;
  	}
-+	if ((slave->mtd.flags & (MTD_ERASE_PARTIAL|MTD_WRITEABLE)) == MTD_ERASE_PARTIAL)
-+		printk(KERN_WARNING"mtd: partition \"%s\" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only\n",
-+				part->name);
  
  	slave->mtd.ecclayout = master->ecclayout;
  	slave->mtd.ecc_step_size = master->ecc_step_size;
diff --git a/target/linux/generic/patches-4.0/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/patches-4.0/411-mtd-partial_eraseblock_write.patch
index ed6f4a3152..94aa6aecd0 100644
--- a/target/linux/generic/patches-4.0/411-mtd-partial_eraseblock_write.patch
+++ b/target/linux/generic/patches-4.0/411-mtd-partial_eraseblock_write.patch
@@ -97,7 +97,7 @@
  		if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
  			instr->fail_addr -= part->offset;
  		instr->addr -= part->offset;
-@@ -513,18 +581,24 @@ static struct mtd_part *allocate_partiti
+@@ -513,18 +581,21 @@ static struct mtd_part *allocate_partiti
  	if ((slave->mtd.flags & MTD_WRITEABLE) &&
  	    mtd_mod_by_eb(slave->offset, &slave->mtd)) {
  		/* Doesn't start on a boundary of major erase size */
@@ -125,9 +125,6 @@
 +		else
 +			slave->mtd.erasesize = slave->mtd.size;
  	}
-+	if ((slave->mtd.flags & (MTD_ERASE_PARTIAL|MTD_WRITEABLE)) == MTD_ERASE_PARTIAL)
-+		printk(KERN_WARNING"mtd: partition \"%s\" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only\n",
-+				part->name);
  
  	slave->mtd.ecclayout = master->ecclayout;
  	slave->mtd.ecc_step_size = master->ecc_step_size;
-- 
GitLab