Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Workaround Apple CD oddities

CD-booting off Apple Partition Map media results in a device path that
looks like a hard drive with an out of spec partition type rather than
a CD device path. Attempt to detect that case and fix it up.
  • Loading branch information...
commit b554bd598d4630d423d436d3774dcb90b127052f 1 parent 18fbaf2
authored April 02, 2012 vathpela committed April 13, 2012

Showing 1 changed file with 18 additions and 0 deletions. Show diff stats Hide diff stats

  1. 18  efi/efidisk.c
18  efi/efidisk.c
@@ -522,6 +522,7 @@ grub_get_drive_partition_from_bdev_handle (grub_efi_handle_t handle,
522 522
     {
523 523
       grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp1);
524 524
       grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE(dp1);
  525
+      grub_efi_uint16_t len = GRUB_EFI_DEVICE_PATH_LENGTH (dp);
525 526
 
526 527
       if (type == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE &&
527 528
 	      subtype == GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE)
@@ -532,6 +533,23 @@ grub_get_drive_partition_from_bdev_handle (grub_efi_handle_t handle,
532 533
 	  dp1->length[1] = 0;
533 534
 	}
534 535
 
  536
+      if (type == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE &&
  537
+	  subtype == GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE)
  538
+	{
  539
+	  grub_efi_hard_drive_device_path_t temp_hd;
  540
+	  grub_memcpy (&temp_hd, dp1, len);
  541
+	  if (temp_hd.signature_type == 0 && temp_hd.mbr_type >= 0x10) {
  542
+	    /*
  543
+	     * Apple Parttion Map CDs appear as hard drives with non-spec
  544
+	     * partition type fields. Fix them up.
  545
+	     */
  546
+	    dp1->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
  547
+	    dp1->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
  548
+	    dp1->length[0] = 4;
  549
+	    dp1->length[1] = 0;
  550
+	  }
  551
+	}
  552
+
535 553
       if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp1))
536 554
 	break;
537 555
 

0 notes on commit b554bd5

Please sign in to comment.
Something went wrong with that request. Please try again.