Introduce image_options and supports a dynamic checksum's size

A lot of changes in preparation for the image format 0002. All the changes
require the image_options to determine how to handle the image.
check_mem_size() is rewritten to handle the various cases.

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
Handle the checksum in a generic way

Image version 0002 must supports various checksum algorithms. To that end,
we move the checksum code in a new file and we define generic functions to
hide the details of the selected algorithm.

After this, partclone still generates images in version 0001, but the bases
to supports more checksum algorithms is in place.

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
write_image_bitmap() learns to write various type of bitmap

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
load_image_bitmap() learns to load various type of bitmap

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
Clone & Restore operations learns to handle checksum on a block count other than 1

These changes update the code producing the checksum and make it aware of
value for blocks_per_checksum other than 1.

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
Partclone learns to handle various image version

This commit updates load_image_desc() to handle the image by determining its
version. The version written is still 0001.

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
Enable image format version 0002

Add the command line parameters to allow the user to select which features
to use when he clones a file system.

From this point, the image format writen by partclone is 0002.

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
print_partclone_info() learns about the info mode

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
partclone.info: show the image's details

Show the details like:
- partclone's version used to create the image
- bitmap mode
- checksum options

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
partclone.chkimg: check only the image's size when it does not contains checksums

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
Test various blocks per checksum to check various checksum patterns

The checksum's offset varies when blocks per checksum is odd,
so it is better to test various values.

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>