Support Lenovo BIOS Update CD (#729)

This commit is contained in:
longpanda 2021-02-02 23:54:01 +08:00
parent 66d5946bd1
commit dccefc5277
1 changed files with 13 additions and 0 deletions

View File

@ -2266,6 +2266,7 @@ int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector)
int i;
int x86count = 0;
grub_uint8_t buf[512];
grub_uint8_t parttype[] = { 0x04, 0x06, 0x0B, 0x0C };
grub_file_seek(file, sector * 2048);
grub_file_read(file, buf, sizeof(buf));
@ -2296,6 +2297,18 @@ int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector)
}
}
if (x86count && buf[32] == 0x88 && buf[33] == 0x04)
{
for (i = 0; i < (int)(ARRAY_SIZE(parttype)); i++)
{
if (buf[36] == parttype[i])
{
debug("hard disk image assume %s efi eltorito, part type 0x%x\n", file->name, buf[36]);
return 1;
}
}
}
debug("%s does not contain efi eltorito\n", file->name);
return 0;
}