diff --git a/cmd/gpt.c b/cmd/gpt.c index 3d9706b..897596a 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -298,8 +298,8 @@ static int set_gpt_info(struct blk_desc *dev_desc, if (extract_env(val, &p)) p = val; if ((strcmp(p, "-") == 0)) { - /* remove first usable lba and last block */ - parts[i].size = dev_desc->lba - 34 - 1 - offset; + /* Let part efi module to auto extend the size */ + parts[i].size = 0; } else { size_ll = ustrtoull(p, &p, 0); parts[i].size = lldiv(size_ll, dev_desc->blksz); diff --git a/disk/part_efi.c b/disk/part_efi.c index 01f71be..8d67c09 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -655,6 +655,10 @@ int gpt_verify_partitions(struct blk_desc *dev_desc, (unsigned long long)partitions[i].size); if (le64_to_cpu(gpt_part_size) != partitions[i].size) { + /* We do not check the extend partition size */ + if ((i == parts - 1) && (partitions[i].size == 0)) + continue; + error("Partition %s size: %llu does not match %llu!\n", efi_str, (unsigned long long)gpt_part_size, (unsigned long long)partitions[i].size);