Closed Harshal5 closed 1 year ago
The bsdiff algorithm that is used to create in-place patches is not trivial to modify to minimize the number of fwrites. To get the lowest number of fwrites you should write the .bin as is, and not creating a patch. Patches are by nature moving lots of data around.
Got it. Thank you for the reply. Closing this issue.
Hello @eerimoq,
I am trying to investigate the integration of
detools
in an embedded systems project, where I need anin-place
patching mechanism.We are using an SPI (NOR) flash memory and the "flash" writes a whole binary (
.bin
) file on it. To write a new binary file on it, we were thinking of using the diffin-place
patching mechanism provided bydetools
rather than the orthodox way of writing the whole new binary file.Our main objective behind this is to reduce the number of fwrite calls needed. Below are the results of a basic analysis I carried out to check the number of fwrite calls needed in an
in-place
operation:Created two in_place patches, one with minimum shift size 0 (patch size = 93179 B) and another with default minimum shift size (2*segment_size) (patch size = 11715 B).
(
from_file
size = 176128 B,to_file
size = 174624 B.)(number of fwrite counts was counted by adding a static count variable here)
I had the following questions regarding the same:
minimum-shift-size
bytes (ref). Does changing theminimum shift size
to 0 make sure that the initial memory shifting does not take place?minimum shift size
is 0 (patch size = 93179 B) as compared to when theminimum shift size
is 8192 B (patch size = 11715 B) ?)Could you please help me answer these questions? Also, please do let me know about any suggestions for this integration in my case.