local: Fix calling nanddump

In last 15 years nanddump changed its command line arguments. Argument -b
(omit bad blocks) was completely removed and argument -o (omit oob data)
changed its meaning to "include" oob data. So for compatibility with all
nanddump versions, do not use argument -b and instead of -o use argument
--omitoob which is present in all nanddump versions and has same meaning
to omit oob data.

This change should fix dumping firmware files on devices with recent
versions of nanddump.
This commit is contained in:
Pali Rohár committed 2021-05-01 15:34:22 +02:00
1 parent bf24ca2345
commit 67427daf17
2 files changed
+4 -5

No files matched your search

+2 -3
View File
@@ -30,11 +30,10 @@ Technical details:
For dumping mtd partition is used tool nanddump. Here is example how to dump For dumping mtd partition is used tool nanddump. Here is example how to dump
kernel image without padding to file zImage: kernel image without padding to file zImage:
$ nanddump -o -b -s 0x00000800 -l 0x001FF800 -f zImage /dev/mtd2 $ nanddump --omitoob -s 0x00000800 -l 0x001FF800 -f zImage /dev/mtd2
Params means: Params means:
-o - "Omit oob data" --omitoob - "Omit oob data"
-b - "Omit bad blocks"
-s - "Start address" -s - "Start address"
-l - "Length" -l - "Length"
-f - "Output file" -f - "Output file"
+2 -2
View File
@@ -227,13 +227,13 @@ static int local_nanddump(const char * file, int mtd, int offset, int length) {
return 1; return 1;
} }
size = snprintf(NULL, 0, "nanddump -o -b -s %d -l %d -f %s /dev/mtd%dro", offset, length, file, mtd); size = snprintf(NULL, 0, "nanddump --omitoob -s %d -l %d -f %s /dev/mtd%d", offset, length, file, mtd);
command = malloc(size+1); command = malloc(size+1);
if ( ! command ) if ( ! command )
return 1; return 1;
snprintf(command, size+1, "nanddump -o -b -s %d -l %d -f %s /dev/mtd%dro", offset, length, file, mtd); snprintf(command, size+1, "nanddump --omitoob -s %d -l %d -f %s /dev/mtd%d", offset, length, file, mtd);
ret = system(command); ret = system(command);