From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: [PATCH] Skip Apple ghosts
Date: Tue, 24 Dec 2013 14:26:50 +0100 [thread overview]
Message-ID: <52B98B9A.5020609@gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 699 bytes --]
Hello, all. It was discovered that on macs sometimes firmware defines
ghost disks with vendor suffix. E.g.
/ACPI(a0341d0,0)/PCI(2,1f)/UnknownMessaging(12)/EndEntire
is a normal disks with partitions presented with HD(...) but then
/ACPI(a0341d0,0)/PCI(2,1f)/UnknownMessaging(12)/MediaVendor(Apple)[0:
]/EndEntire
is a ghost disk. It has as suffix a vendor path with empty vendor data.
This is a problem because when chainloading on such disks GRUB can't
find handle of partition as none is defined. I propose to dkip ghosts
completely. This should be safe as the skip happens only for empty Apple
vendor suffix and if the parent is already a known disk.
Did anyone see anything similar?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: appledisk.diff --]
[-- Type: text/x-diff; name="appledisk.diff", Size: 1035 bytes --]
diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
index e04203f..3b12c34 100644
--- a/grub-core/disk/efi/efidisk.c
+++ b/grub-core/disk/efi/efidisk.c
@@ -333,6 +333,21 @@ name_devices (struct grub_efidisk_data *devices)
if (! dp)
continue;
+ /* Ghosts proudly presented by Apple. */
+ if (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE
+ && GRUB_EFI_DEVICE_PATH_SUBTYPE (dp)
+ == GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE)
+ {
+ grub_efi_vendor_device_path_t *vendor = (grub_efi_vendor_device_path_t *) dp;
+ const struct grub_efi_guid apple = GRUB_EFI_VENDOR_APPLE_GUID;
+
+ if (vendor->header.length == sizeof (*vendor)
+ && grub_memcmp (&vendor->vendor_guid, &apple,
+ sizeof (vendor->vendor_guid)) == 0
+ && find_parent_device (devices, d))
+ continue;
+ }
+
m = d->block_io->media;
if (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_ACPI_DEVICE_PATH_TYPE
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (dp)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 291 bytes --]
next reply other threads:[~2013-12-24 13:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-24 13:26 Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2013-12-24 16:44 ` [PATCH] Skip Apple ghosts Andrey Borzenkov
2013-12-24 17:00 ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-01-07 18:17 ` Andrey Borzenkov
2014-01-07 18:20 ` Andrey Borzenkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52B98B9A.5020609@gmail.com \
--to=phcoder@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).