[PATCH] flashcp copy only different blocks

Denys Vlasenko vda.linux at googlemail.com
Sat Nov 21 10:23:05 UTC 2020


Sorry for the delay.

On Mon, Oct 26, 2020 at 10:24 AM Harvey Wu (吳崇維) <Harvey.Wu at quantatw.com> wrote:
> The original flashcp process is erase, write and verify all blocks
> in one time from file to device.
> This patch will add a function that only copy different block data
> from file to device. The function will compare block by block between
> file and device, then erase write block data from file to device if
> found different block.

This sounds like a sensible idea.

However, mtd-utils-2.1.2 don't seem to implement such an option.

I don't think "running before the train" makes sense, I propose to wait
and follow mtd-utils development.


-       /*opts =*/ getopt32(argv, "^" "v" "\0" "=2"/*exactly 2
non-option args: file,dev*/);
+       /*opts =*/ getopt32(argv, "^" "u" "v" "\0" "=2"/*exactly 2
non-option args: file,dev*/);
+       if (strcmp(argv[1], "-u") == 0) {
+               update_check = 1;
+               if (strcmp(argv[2], "-v") == 0)
+                       option_mask32 = 1;
+               else
+                       option_mask32 = 0;
+       }

No, you simply need

        opts = getopt32(argv, "^" "vu" "\0" "=2"/*exactly 2 non-option
args: file,dev*/);

then (opts & 1) is "do we have -v" and (opts & 2) is "do we have -u".

Compare/write loop can be folded into existing write/verify loop.


More information about the busybox mailing list