summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikhail Kshevetskiy2026-01-05 20:41:02 +0000
committerRobert Marko2026-03-05 10:03:06 +0000
commitc0d7de851c9a0c803d6e060736db52a03b27aa2d (patch)
tree2ca07e40dacfc039dd9f4d3aadbb9ef841cba486
parentcaac8b133aca8abc7736159758d76902357cf1f5 (diff)
downloadfirmware-utils-c0d7de851c9a0c803d6e060736db52a03b27aa2d.tar.gz
ptgen: fix bug caused by not completely correct reverts
The commit 0782d243d23e (Revert "ptgen: do not create stub partition to fill a gap if gap caused by alignment") fixes one issue but introduce another. If "-e <gpt_entry_offs>" option is used and there is no gap between GPT Entry Table and 1-st partition, then 1) A GPT stub partition will be created, but this should not be done because of no space for it. 2) A stub partition will be incorrect (start_sector > end_sector) This patch fixes an issue. Fixes: 0782d243d23e (Revert "ptgen: do not create stub partition to fill a gap if gap caused by alignment") Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> Link: https://github.com/openwrt/firmware-utils/pull/58 Signed-off-by: Robert Marko <robimarko@gmail.com>
-rw-r--r--src/ptgen.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ptgen.c b/src/ptgen.c
index d480908..dd27b07 100644
--- a/src/ptgen.c
+++ b/src/ptgen.c
@@ -489,7 +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].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;