summaryrefslogtreecommitdiff
path: root/package/mtd/mtd-utils
diff options
context:
space:
mode:
authorPeter Korsgaard <jacmet@sunsite.dk>2009-02-17 14:04:49 +0000
committerPeter Korsgaard <jacmet@sunsite.dk>2009-02-17 14:04:49 +0000
commit1aae99bc3426414e64751303e121946ad4f1f01a (patch)
tree4d73af932a96debc666e2e15bc436129997260f5 /package/mtd/mtd-utils
parent7892b23ae7891834f14b7cf478852b2b529bb3cb (diff)
mtd-utils: flashcp: handle non-power-of-2 erase size (E.G. for dataflash)
Diffstat (limited to 'package/mtd/mtd-utils')
-rw-r--r--package/mtd/mtd-utils/mtd-utils-1.1.0-all-flashcp-npow2-erase.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/package/mtd/mtd-utils/mtd-utils-1.1.0-all-flashcp-npow2-erase.patch b/package/mtd/mtd-utils/mtd-utils-1.1.0-all-flashcp-npow2-erase.patch
new file mode 100644
index 000000000..b9a0a607c
--- /dev/null
+++ b/package/mtd/mtd-utils/mtd-utils-1.1.0-all-flashcp-npow2-erase.patch
@@ -0,0 +1,23 @@
+flashcp: handle non-power-of-2 erase size (E.G. for dataflash)
+
+Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
+---
+ flashcp.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+Index: mtd-utils-1.1.0/flashcp.c
+===================================================================
+--- mtd-utils-1.1.0.orig/flashcp.c 2007-08-03 15:55:51.000000000 +0200
++++ mtd-utils-1.1.0/flashcp.c 2009-02-17 14:02:09.000000000 +0100
+@@ -255,8 +255,9 @@
+ #warning "Check for smaller erase regions"
+
+ erase.start = 0;
+- erase.length = filestat.st_size & ~(mtd.erasesize - 1);
+- if (filestat.st_size % mtd.erasesize) erase.length += mtd.erasesize;
++ erase.length = (filestat.st_size + mtd.erasesize - 1) / mtd.erasesize;
++ erase.length *= mtd.erasesize;
++
+ if (flags & FLAG_VERBOSE)
+ {
+ /* if the user wants verbose output, erase 1 block at a time and show him/her what's going on */