aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2014-12-03 20:22:32 +0000
committerJohn Crispin <blogic@openwrt.org>2014-12-03 20:22:32 +0000
commit41c3bf1931ec651d64a1fbad949da5ec13b4b096 (patch)
tree7b47b1b9bcb32794c3d5b1bf3335278882d4308d /package
parent644cc284effeeb52251c78a8c3c1f4eacdea66ed (diff)
downloadupstream-41c3bf1931ec651d64a1fbad949da5ec13b4b096.tar.gz
upstream-41c3bf1931ec651d64a1fbad949da5ec13b4b096.tar.bz2
upstream-41c3bf1931ec651d64a1fbad949da5ec13b4b096.zip
mtd: make the dump commnd honour the -o option
Signed-off-by: John Crispin <blogic@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@43512 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rw-r--r--package/system/mtd/src/mtd.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/package/system/mtd/src/mtd.c b/package/system/mtd/src/mtd.c
index db3fc804c9..72b9ddfe21 100644
--- a/package/system/mtd/src/mtd.c
+++ b/package/system/mtd/src/mtd.c
@@ -274,7 +274,7 @@ mtd_erase(const char *mtd)
}
static int
-mtd_dump(const char *mtd, int size)
+mtd_dump(const char *mtd, int part_offset, int size)
{
int ret = 0, offset = 0;
int fd;
@@ -292,6 +292,9 @@ mtd_dump(const char *mtd, int size)
if (!size)
size = mtdsize;
+ if (part_offset)
+ lseek(fd, part_offset, SEEK_SET);
+
buf = malloc(erasesize);
if (!buf)
return -1;
@@ -769,10 +772,6 @@ int main (int argc, char **argv)
}
break;
case 'o':
- if (!mtd_fixtrx) {
- fprintf(stderr, "-o: is not available on this platform\n");
- usage();
- }
errno = 0;
offset = strtoul(optarg, 0, 0);
if (errno) {
@@ -872,7 +871,7 @@ int main (int argc, char **argv)
mtd_verify(device, imagefile);
break;
case CMD_DUMP:
- mtd_dump(device, dump_len);
+ mtd_dump(device, offset, dump_len);
break;
case CMD_ERASE:
if (!unlocked)