mtd: make the dump commnd honour the -o option

Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 43512
This commit is contained in:
John Crispin 2014-12-03 20:22:32 +00:00
parent 426467beba
commit c3bb3906ee

View File

@ -274,7 +274,7 @@ mtd_erase(const char *mtd)
} }
static int 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 ret = 0, offset = 0;
int fd; int fd;
@ -292,6 +292,9 @@ mtd_dump(const char *mtd, int size)
if (!size) if (!size)
size = mtdsize; size = mtdsize;
if (part_offset)
lseek(fd, part_offset, SEEK_SET);
buf = malloc(erasesize); buf = malloc(erasesize);
if (!buf) if (!buf)
return -1; return -1;
@ -769,10 +772,6 @@ int main (int argc, char **argv)
} }
break; break;
case 'o': case 'o':
if (!mtd_fixtrx) {
fprintf(stderr, "-o: is not available on this platform\n");
usage();
}
errno = 0; errno = 0;
offset = strtoul(optarg, 0, 0); offset = strtoul(optarg, 0, 0);
if (errno) { if (errno) {
@ -872,7 +871,7 @@ int main (int argc, char **argv)
mtd_verify(device, imagefile); mtd_verify(device, imagefile);
break; break;
case CMD_DUMP: case CMD_DUMP:
mtd_dump(device, dump_len); mtd_dump(device, offset, dump_len);
break; break;
case CMD_ERASE: case CMD_ERASE:
if (!unlocked) if (!unlocked)