]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
Support Lenovo BIOS Update CD (#729)
authorlongpanda <admin@ventoy.net>
Tue, 2 Feb 2021 15:54:01 +0000 (23:54 +0800)
committerlongpanda <admin@ventoy.net>
Tue, 2 Feb 2021 15:54:01 +0000 (23:54 +0800)
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c

index acf7a2f673366c625f580eda9af8d391a713b332..6fb113639135e90c60e8edd55ac49f64ed3304ed 100644 (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;
 }