Print this page
10570 Need workaround to EFI boot on AMI BIOS

@@ -19,10 +19,11 @@
  * CDDL HEADER END
  */
 
 /*
  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, Joyent, Inc.
  */
 
 /*
  * Virtual disk server
  */

@@ -5830,11 +5831,11 @@
         s0_start = first_u_lba;
         s0_end = vd->vdisk_size - 1;
 
         gpt->efi_gpt_Signature = LE_64(EFI_SIGNATURE);
         gpt->efi_gpt_Revision = LE_32(EFI_VERSION_CURRENT);
-        gpt->efi_gpt_HeaderSize = LE_32(sizeof (efi_gpt_t));
+        gpt->efi_gpt_HeaderSize = LE_32(EFI_HEADER_SIZE);
         gpt->efi_gpt_FirstUsableLBA = LE_64(first_u_lba);
         gpt->efi_gpt_PartitionEntryLBA = LE_64(2ULL);
         gpt->efi_gpt_SizeOfPartitionEntry = LE_32(sizeof (efi_gpe_t));
 
         UUID_LE_CONVERT(gpe[0].efi_gpe_PartitionTypeGUID, uuid);

@@ -5867,11 +5868,11 @@
         gpt->efi_gpt_AlternateLBA = LE_64(vd->vdisk_size - 1);
 
         CRC32(crc, gpe, sizeof (efi_gpe_t) * VD_MAXPART, -1U, crc32_table);
         gpt->efi_gpt_PartitionEntryArrayCRC32 = LE_32(~crc);
 
-        CRC32(crc, gpt, sizeof (efi_gpt_t), -1U, crc32_table);
+        CRC32(crc, gpt, EFI_HEADER_SIZE, -1U, crc32_table);
         gpt->efi_gpt_HeaderCRC32 = LE_32(~crc);
 
         return (0);
 }