fix: use ESP partition type for UEFI boot detection
- Partition 2 type GUID changed from msftdata (EBD0A0A2) to ESP (C12A7328) in GUI installer, CLI partition resizer, and shell installer. UEFI firmware only scans ESP-type partitions for BOOTX64.EFI. - GPT is now the default partition style (MBR via -m flag) - Secure Boot default changed to OFF - Fix PATH using $PWD instead of $OLDDIR in Hiperiso2Disk.sh - Remove unused g_WindowsDataPartGuid dead code from partresize.c
This commit is contained in:
@@ -383,6 +383,7 @@ int hiperiso_fill_gpt(uint64_t size, uint64_t reserve, int align4k, HISO_GPT_INF
|
||||
HISO_GPT_HDR *Head = &gpt->Head;
|
||||
HISO_GPT_PART_TBL *Table = gpt->PartTbl;
|
||||
hiperiso_guid WindowsDataPartType = { 0xebd0a0a2, 0xb9e5, 0x4433, { 0x87, 0xc0, 0x68, 0xb6, 0xb7, 0x26, 0x99, 0xc7 } };
|
||||
hiperiso_guid EfiSystemPartType = { 0xc12a7328, 0xf81f, 0x11d2, { 0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b } };
|
||||
|
||||
HiperisoFillProtectMBR(size, &gpt->MBR);
|
||||
|
||||
@@ -434,8 +435,8 @@ int hiperiso_fill_gpt(uint64_t size, uint64_t reserve, int align4k, HISO_GPT_INF
|
||||
Table[0].Attr = 0;
|
||||
hiperiso_fill_gpt_partname(Table[0].Name, "Hiperiso");
|
||||
|
||||
// Use msftdata for partition 2 (Ventoy-compatible: both partitions visible + boots)
|
||||
memcpy(&(Table[1].PartType), &WindowsDataPartType, sizeof(hiperiso_guid));
|
||||
// Use ESP type for partition 2 (required for UEFI firmware to find BOOTX64.EFI)
|
||||
memcpy(&(Table[1].PartType), &EfiSystemPartType, sizeof(hiperiso_guid));
|
||||
hiperiso_gen_preudo_uuid(&(Table[1].PartGuid));
|
||||
Table[1].StartLBA = Table[0].LastLBA + 1;
|
||||
Table[1].LastLBA = Table[1].StartLBA + HISOEFI_PART_BYTES / 512 - 1;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
static int g_disk_fd = 0;
|
||||
static UINT64 g_disk_offset = 0;
|
||||
static GUID g_ZeroGuid = {0};
|
||||
static GUID g_WindowsDataPartGuid = { 0xebd0a0a2, 0xb9e5, 0x4433, { 0x87, 0xc0, 0x68, 0xb6, 0xb7, 0x26, 0x99, 0xc7 } };
|
||||
static GUID g_EfiSystemPartGuid = { 0xc12a7328, 0xf81f, 0x11d2, { 0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b } };
|
||||
|
||||
static int hiso_disk_read(uint32 sector, uint8 *buffer, uint32 sector_count)
|
||||
{
|
||||
@@ -591,7 +591,7 @@ static int update_part_table(char *disk, UINT64 part2start)
|
||||
}
|
||||
|
||||
memset(PartTbl + 1, 0, sizeof(HISO_GPT_PART_TBL));
|
||||
memcpy(&(PartTbl[1].PartType), &g_WindowsDataPartGuid, sizeof(GUID));
|
||||
memcpy(&(PartTbl[1].PartType), &g_EfiSystemPartGuid, sizeof(GUID));
|
||||
hiperiso_gen_preudo_uuid(&(PartTbl[1].PartGuid));
|
||||
|
||||
PartTbl[0].LastLBA = part2start - 1;
|
||||
|
||||
@@ -21,7 +21,7 @@ elif uname -m | grep -E -q 'mips64'; then
|
||||
else
|
||||
export TOOLDIR=i386
|
||||
fi
|
||||
export PATH="$OLDDIR/tool/$TOOLDIR:$PATH"
|
||||
export PATH="$PWD/tool/$TOOLDIR:$PATH"
|
||||
|
||||
|
||||
echo ''
|
||||
|
||||
@@ -13,17 +13,19 @@ print_usage() {
|
||||
echo ''
|
||||
echo ' OPTION: (optional)'
|
||||
echo ' -r SIZE_MiB preserve some space (MiB) at the bottom of the disk (only for install)'
|
||||
echo ' -s/-S enable/disable secure boot support (default is enabled)'
|
||||
echo ' -g use GPT partition style, default is MBR (only for install)'
|
||||
echo ' -s/-S enable/disable secure boot support (default is disabled)'
|
||||
echo ' -g use GPT partition style (default)'
|
||||
echo ' -m use MBR partition style'
|
||||
echo ' -L Label of the 1st exfat partition (default is Hiperiso)'
|
||||
echo ' -n try non-destructive installation (only for install)'
|
||||
echo ''
|
||||
}
|
||||
|
||||
|
||||
SECUREBOOT="YES"
|
||||
SECUREBOOT="NO"
|
||||
VTNEW_LABEL='Hiperiso'
|
||||
RESERVE_SIZE_MB=0
|
||||
VTGPT="YES"
|
||||
while [ -n "$1" ]; do
|
||||
if [ "$1" = "-i" ]; then
|
||||
MODE="install"
|
||||
@@ -42,6 +44,8 @@ while [ -n "$1" ]; do
|
||||
SECUREBOOT="NO"
|
||||
elif [ "$1" = "-g" ]; then
|
||||
VTGPT="YES"
|
||||
elif [ "$1" = "-m" ]; then
|
||||
VTGPT=""
|
||||
elif [ "$1" = "-L" ]; then
|
||||
shift
|
||||
VTNEW_LABEL=$1
|
||||
@@ -562,7 +566,7 @@ else
|
||||
#reserve secure boot option
|
||||
if [ -z "$SECUREBOOT" ]; then
|
||||
if check_disk_secure_boot $DISK; then
|
||||
SECUREBOOT="YES"
|
||||
SECUREBOOT="NO"
|
||||
else
|
||||
SECUREBOOT="NO"
|
||||
fi
|
||||
|
||||
@@ -444,7 +444,7 @@ format_hiperiso_disk_gpt() {
|
||||
hisodebug "format disk by parted ..."
|
||||
|
||||
if [ "$TOOLDIR" != "aarch64" ]; then
|
||||
vt_set_efi_type="set 2 msftdata on"
|
||||
vt_set_efi_type="set 2 esp on"
|
||||
fi
|
||||
|
||||
parted -a none --script $DISK \
|
||||
|
||||
Reference in New Issue
Block a user