Revert "ptgen: do not create stub partition to fill a gap if gap caused by alignment"
authorDaniel Golle <[email protected]>
Wed, 1 Oct 2025 15:20:25 +0000 (16:20 +0100)
committerDaniel Golle <[email protected]>
Wed, 1 Oct 2025 15:39:47 +0000 (16:39 +0100)
Without the BIOS Boot Partition in the gap GRUB fails to install on
MBR-boot images.

Hence revert commit f1f98b0b8456e89f6c959d8f028c5204da82365e.

Signed-off-by: Daniel Golle <[email protected]>
src/ptgen.c

index d9fb7442994ea44a0a7a9b2313dd912dff514e0f..d480908badeda820945b5151c811c3c877e02e3d 100644 (file)
@@ -489,8 +489,7 @@ static int gen_gptable(uint32_t signature, guid_t guid, unsigned nr)
                printf("%" PRIu64 "\n", (sect - start) * DISK_SECTOR_SIZE);
        }
 
-       if ((parts[0].start != 0) &&
-           (parts[0].actual_start > gpt_first_entry_sector + GPT_SIZE)) {
+       if (parts[0].actual_start > GPT_FIRST_ENTRY_SECTOR + GPT_SIZE) {
                gpte[GPT_ENTRY_MAX - 1].start = cpu_to_le64(gpt_first_entry_sector + GPT_SIZE);
                gpte[GPT_ENTRY_MAX - 1].end = cpu_to_le64(parts[0].actual_start - 1);
                gpte[GPT_ENTRY_MAX - 1].type = GUID_PARTITION_BIOS_BOOT;