The primary GPT has a pointer to the alternate GPT. Set this pointer correctly when writing the partition table. When the GPT originally has been created on the device, the alternate GPT should be at the end of the device already. However, when the GPT was created on an image which was then written to the disk, the alternate GPT might be at the end of the image instead of the device. In this case the alternate GPT changes its position during a partition write, so we have to adjust the pointer from the primary to the alternate GPT accordingly. Reported-by: Ulrich Ölmann <u.oelmann@xxxxxxxxxxxxxx> Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- common/partitions/efi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/common/partitions/efi.c b/common/partitions/efi.c index 6caa391983..5736b6033b 100644 --- a/common/partitions/efi.c +++ b/common/partitions/efi.c @@ -758,6 +758,7 @@ static __maybe_unused int efi_partition_write(struct partition_desc *pd) le32_to_cpu(gpt->sizeof_partition_entry); gpt->my_lba = cpu_to_le64(1); + gpt->alternate_lba = cpu_to_le64(last_lba(blk)); gpt->partition_entry_array_crc32 = cpu_to_le32(efi_crc32( (const unsigned char *)epd->ptes, count)); gpt->header_crc32 = 0; -- 2.39.5