pengutronix / genimage

tool to generate multiple filesystem and flash images from a tree
GNU General Public License v2.0
308 stars 110 forks source link

image-hd: align image size to 4k when using GPT #133

Closed michaelolbrich closed 3 years ago

michaelolbrich commented 3 years ago

The backup partition table at the end of the image for GPT consists of an odd number of sectors. The size of filesystem images or the explicit size of a partition is almost always a multiple of 4k. Unless explicitly configured otherwise, the beginning of all partitions is also multiple of 4k. So when the backup partition table is appended directly after the last partition then the image size is most likely not a multiple of 4k. This causes problems with tools such as 'fastboot'.

If the image size is not specified explicitly and GPT is used then increase the image size if necessary to ensure that it is a multiple of 4k.

Signed-off-by: Michael Olbrich m.olbrich@pengutronix.de

jluebbe commented 3 years ago

Maybe we should do that for all images (not just GPT). But it looks good as is.

michaelolbrich commented 3 years ago

In the non-GPT case it's actually quite hard to get an image that is not already 4k aligned.