Closed Villemoes closed 1 year ago
Shouldn't file offsets use off_t with Large File Support enabled?
Shouldn't file offsets use off_t with Large File Support enabled?
Perhaps, but I didn't want to deviate from what insert_image() does. Generally genimage uses "unsigned long long" instead of size_t, off_t etc., which you always end up having to mix and convert between anyway.
Shouldn't file offsets use off_t with Large File Support enabled?
Perhaps, but I didn't want to deviate from what insert_image() does. Generally genimage uses "unsigned long long" instead of size_t, off_t etc., which you always end up having to mix and convert between anyway.
I agree. We should probably clean this up in general, but this is pull request is not the place for that. And we should ensure that Large File Support is enabled first.
When using genimage on a 32 bit host and trying to populate a ~8GiB eMMC with a GPT image, we hit
INFO: hdimage(/dev/mmcblk0): determined size of block device /dev/mmcblk0 to be 7820083200 ... ERROR: hdimage(/dev/mmcblk0): seek /dev/mmcblk0: Invalid argument ERROR: hdimage(/dev/mmcblk0): failed to write backup GPT table
This is because the "image->size - GPT_SECTORS*512" aka 7820066304 passed from hdimage_insert_gpt() becomes -769868288 when shoehorned into a "signed long".
Make the offset parameter "unsigned long long" to match the protoype of insert_image().
Signed-off-by: Rasmus Villemoes rasmus.villemoes@prevas.dk