A system and method for updating a binary image stored across a
block-structured memory device, such as a flash memory device. From
comparison of original and new images, an update package is generated
which includes an encoded instruction set comprising COPY and ADD
operations instructing the copying of source data from locations in the
memory device and adding other data provided in the update package. The
instruction set comprises SETBLOCK operations that direct updating of the
memory blocks in an order that optimizes the COPY and ADD operations
required and resulting update package size. The instruction set further
comprises SETCOPYOFFSET operations to toggle between copy-offset modes
thereby allowing for improved efficient encoding of COPY operations. The
update package further includes an array of status bits corresponding to
the memory blocks to be updated, thereby allowing for reliable restarting
of the update process following power loss or other interruption.