From 53b2d85f98e8e39f61701bdac6a3c9dc3ae57a7e Mon Sep 17 00:00:00 2001 From: vasilito Date: Thu, 2 Jul 2026 06:01:52 +0300 Subject: [PATCH] fix: update GRUB2 module partition size checks 131072 -> 65536 After reducing ESP partition from 64MB to 32MB to match Ventoy, the GRUB2 module's hardcoded partition size checks now reject the disk with error 7 'Disk partition layout check failed.' Updated 4 hardcoded 131072 / 67108864 (64MB) values to 65536 / 33554432 (32MB) in: - src/grub2/hiperiso_cmd.c (3 places in hiperiso_check_official_device) - src/grub2/hiperiso_def.h (HISO_CMD_CHECK macro partition size) GRUB2 module rebuilt with new BOOTX64.EFI. Payload rebuilt. --- src/grub2/hiperiso_cmd.c | 6 +++--- src/grub2/hiperiso_def.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/grub2/hiperiso_cmd.c b/src/grub2/hiperiso_cmd.c index 1c6d1ef..cc0187c 100644 --- a/src/grub2/hiperiso_cmd.c +++ b/src/grub2/hiperiso_cmd.c @@ -629,7 +629,7 @@ static int hiperiso_check_official_device(grub_device_t dev) { hiperiso_gpt_part_tbl *PartTbl = g_hiperiso_part_info->PartTbl; if (PartTbl[1].StartLBA != PartTbl[0].LastLBA + 1 || - (PartTbl[1].LastLBA + 1 - PartTbl[1].StartLBA) != 131072) + (PartTbl[1].LastLBA + 1 - PartTbl[1].StartLBA) != 65536) { grub_file_close(file); return hiperiso_set_check_result(6, "Disk partition layout check failed."); @@ -639,7 +639,7 @@ static int hiperiso_check_official_device(grub_device_t dev) { hiperiso_part_table *PartTbl = g_hiperiso_part_info->MBR.PartTbl; if (PartTbl[1].StartSectorId != PartTbl[0].StartSectorId + PartTbl[0].SectorCount || - PartTbl[1].SectorCount != 131072) + PartTbl[1].SectorCount != 65536) { grub_file_close(file); return hiperiso_set_check_result(6, "Disk partition layout check failed."); @@ -650,7 +650,7 @@ static int hiperiso_check_official_device(grub_device_t dev) { offset = partition->start + partition->len; partition = file->device->disk->partition; - if ((partition->number != 1) || (partition->len != 131072) || (offset != partition->start)) + if ((partition->number != 1) || (partition->len != 65536) || (offset != partition->start)) { grub_file_close(file); return hiperiso_set_check_result(7, "Disk partition layout check failed."); diff --git a/src/grub2/hiperiso_def.h b/src/grub2/hiperiso_def.h index 07fa7eb..168410b 100644 --- a/src/grub2/hiperiso_def.h +++ b/src/grub2/hiperiso_def.h @@ -1217,7 +1217,7 @@ int hiperiso_unregister_all_cmd(void); int hiperiso_chain_file_size(const char *path); int hiperiso_chain_file_read(const char *path, int offset, int len, void *buf); -#define HISO_CMD_CHECK(a) if (67108864 != g_hiperiso_disk_part_size[a]) hiperiso_syscall0(exit) +#define HISO_CMD_CHECK(a) if (33554432 != g_hiperiso_disk_part_size[a]) hiperiso_syscall0(exit) #define hiso_theme_random_boot_second 0 #define hiso_theme_random_boot_day 1