sys-boot/refind: fix build against gnu-efi-3.0.5
authorSam Jorna <wraeth@gentoo.org>
Mon, 15 May 2017 05:11:28 +0000 (15:11 +1000)
committerSam Jorna <wraeth@gentoo.org>
Mon, 15 May 2017 05:12:41 +0000 (15:12 +1000)
Adds upstream patch for building against gnu-efi-3.0.5 which added functions
causing namespace collisions.

Gentoo-Bug: 616668
Package-Manager: Portage-2.3.5, Repoman-2.3.2

sys-boot/refind/files/refind-0.10.7-fix_build_gnuefi-3.0.5.patch [new file with mode: 0644]
sys-boot/refind/refind-0.10.7-r1.ebuild [moved from sys-boot/refind/refind-0.10.7.ebuild with 98% similarity]

diff --git a/sys-boot/refind/files/refind-0.10.7-fix_build_gnuefi-3.0.5.patch b/sys-boot/refind/files/refind-0.10.7-fix_build_gnuefi-3.0.5.patch
new file mode 100644 (file)
index 0000000..5320241
--- /dev/null
@@ -0,0 +1,1387 @@
+diff --git a/EfiLib/DevicePath.c b/EfiLib/DevicePath.c
+index bfaf1c6..023ea3f 100644
+--- a/EfiLib/DevicePath.c
++++ b/EfiLib/DevicePath.c
+@@ -31,7 +31,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+ \r
+ CHAR16 *\r
+ EFIAPI\r
+-CatPrint (\r
++MyCatPrint (\r
+   IN OUT POOL_PRINT   *Str,\r
+   IN CHAR16           *Fmt,\r
+   ...\r
+@@ -94,7 +94,7 @@ DevPathPci (
+   PCI_DEVICE_PATH *Pci;\r
+ \r
+   Pci = DevPath;\r
+-  CatPrint (Str, L"Pci(%x|%x)", (UINTN) Pci->Device, (UINTN) Pci->Function);\r
++  MyCatPrint (Str, L"Pci(%x|%x)", (UINTN) Pci->Device, (UINTN) Pci->Function);\r
+ }\r
+ \r
+ /**\r
+@@ -116,7 +116,7 @@ DevPathPccard (
+   PCCARD_DEVICE_PATH  *Pccard;\r
+ \r
+   Pccard = DevPath;\r
+-  CatPrint (Str, L"Pcmcia(Function%x)", (UINTN) Pccard->FunctionNumber);\r
++  MyCatPrint (Str, L"Pcmcia(Function%x)", (UINTN) Pccard->FunctionNumber);\r
+ }\r
+ \r
+ /**\r
+@@ -138,7 +138,7 @@ DevPathMemMap (
+   MEMMAP_DEVICE_PATH  *MemMap;\r
+ \r
+   MemMap = DevPath;\r
+-  CatPrint (\r
++  MyCatPrint (\r
+     Str,\r
+     L"MemMap(%d:%lx-%lx)",\r
+     (UINTN) MemMap->MemoryType,\r
+@@ -166,7 +166,7 @@ DevPathController (
+   CONTROLLER_DEVICE_PATH  *Controller;\r
+ \r
+   Controller = DevPath;\r
+-  CatPrint (Str, L"Ctrl(%d)", (UINTN) Controller->ControllerNumber);\r
++  MyCatPrint (Str, L"Ctrl(%d)", (UINTN) Controller->ControllerNumber);\r
+ }\r
+ \r
+ \r
+@@ -202,30 +202,30 @@ DevPathVendor (
+     Type = L"Msg";\r
+ /*              \r
+     if (CompareGuid (&Vendor->Guid, &gEfiPcAnsiGuid)) {\r
+-      CatPrint (Str, L"VenPcAnsi()");\r
++      MyCatPrint (Str, L"VenPcAnsi()");\r
+       return ;\r
+     } else if (CompareGuid (&Vendor->Guid, &gEfiVT100Guid)) {\r
+-      CatPrint (Str, L"VenVt100()");\r
++      MyCatPrint (Str, L"VenVt100()");\r
+       return ;\r
+     } else if (CompareGuid (&Vendor->Guid, &gEfiVT100PlusGuid)) {\r
+-      CatPrint (Str, L"VenVt100Plus()");\r
++      MyCatPrint (Str, L"VenVt100Plus()");\r
+       return ;\r
+     } else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) {\r
+-      CatPrint (Str, L"VenUft8()");\r
++      MyCatPrint (Str, L"VenUft8()");\r
+       return ;\r
+     } else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid     )) {\r
+       FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *) Vendor)->FlowControlMap);\r
+       switch (FlowControlMap & 0x00000003) {\r
+       case 0:\r
+-        CatPrint (Str, L"UartFlowCtrl(%s)", L"None");\r
++        MyCatPrint (Str, L"UartFlowCtrl(%s)", L"None");\r
+         break;\r
+ \r
+       case 1:\r
+-        CatPrint (Str, L"UartFlowCtrl(%s)", L"Hardware");\r
++        MyCatPrint (Str, L"UartFlowCtrl(%s)", L"Hardware");\r
+         break;\r
+ \r
+       case 2:\r
+-        CatPrint (Str, L"UartFlowCtrl(%s)", L"XonXoff");\r
++        MyCatPrint (Str, L"UartFlowCtrl(%s)", L"XonXoff");\r
+         break;\r
+ \r
+       default:\r
+@@ -237,7 +237,7 @@ DevPathVendor (
+     } else\r
+  */\r
+     if (CompareGuid (&Vendor->Guid, &gEfiSasDevicePathGuid)) {\r
+-      CatPrint (\r
++      MyCatPrint (\r
+         Str,\r
+         L"SAS(%lx,%lx,%x,",\r
+         ((SAS_DEVICE_PATH *) Vendor)->SasAddress,\r
+@@ -246,9 +246,9 @@ DevPathVendor (
+         );\r
+       Info = (((SAS_DEVICE_PATH *) Vendor)->DeviceTopology);\r
+       if ((Info & 0x0f) == 0) {\r
+-        CatPrint (Str, L"NoTopology,0,0,0,");\r
++        MyCatPrint (Str, L"NoTopology,0,0,0,");\r
+       } else if (((Info & 0x0f) == 1) || ((Info & 0x0f) == 2)) {\r
+-        CatPrint (\r
++        MyCatPrint (\r
+           Str,\r
+           L"%s,%s,%s,",\r
+           ((Info & (0x1 << 4)) != 0) ? L"SATA" : L"SAS",\r
+@@ -256,19 +256,19 @@ DevPathVendor (
+           ((Info & (0x1 << 6)) != 0) ? L"Expanded" : L"Direct"\r
+           );\r
+         if ((Info & 0x0f) == 1) {\r
+-          CatPrint (Str, L"0,");\r
++          MyCatPrint (Str, L"0,");\r
+         } else {\r
+-          CatPrint (Str, L"%x,", (UINTN) ((Info >> 8) & 0xff));\r
++          MyCatPrint (Str, L"%x,", (UINTN) ((Info >> 8) & 0xff));\r
+         }\r
+       } else {\r
+-        CatPrint (Str, L"0,0,0,0,");\r
++        MyCatPrint (Str, L"0,0,0,0,");\r
+       }\r
+ \r
+-      CatPrint (Str, L"%x)", (UINTN) ((SAS_DEVICE_PATH *) Vendor)->Reserved);\r
++      MyCatPrint (Str, L"%x)", (UINTN) ((SAS_DEVICE_PATH *) Vendor)->Reserved);\r
+       return ;\r
+ \r
+     } else if (CompareGuid (&Vendor->Guid, &gEfiDebugPortProtocolGuid)) {\r
+-      CatPrint (Str, L"DebugPort()");\r
++      MyCatPrint (Str, L"DebugPort()");\r
+       return ;\r
+     }\r
+     break;\r
+@@ -282,15 +282,15 @@ DevPathVendor (
+     break;\r
+   }\r
+ \r
+-  CatPrint (Str, L"Ven%s(%g", Type, &Vendor->Guid);\r
++  MyCatPrint (Str, L"Ven%s(%g", Type, &Vendor->Guid);\r
+   DataLength = DevicePathNodeLength (&Vendor->Header) - sizeof (VENDOR_DEVICE_PATH);\r
+   if (DataLength > 0) {\r
+-    CatPrint (Str, L",");\r
++    MyCatPrint (Str, L",");\r
+     for (Index = 0; Index < DataLength; Index++) {\r
+-      CatPrint (Str, L"%02x", (UINTN) ((VENDOR_DEVICE_PATH_WITH_DATA *) Vendor)->VendorDefinedData[Index]);\r
++      MyCatPrint (Str, L"%02x", (UINTN) ((VENDOR_DEVICE_PATH_WITH_DATA *) Vendor)->VendorDefinedData[Index]);\r
+     }\r
+   }\r
+-  CatPrint (Str, L")");\r
++  MyCatPrint (Str, L")");\r
+ }\r
+ \r
+ /**\r
+@@ -313,9 +313,9 @@ DevPathAcpi (
+ \r
+   Acpi = DevPath;\r
+   if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
+-    CatPrint (Str, L"Acpi(PNP%04x,%x)", (UINTN)  EISA_ID_TO_NUM (Acpi->HID), (UINTN) Acpi->UID);\r
++    MyCatPrint (Str, L"Acpi(PNP%04x,%x)", (UINTN)  EISA_ID_TO_NUM (Acpi->HID), (UINTN) Acpi->UID);\r
+   } else {\r
+-    CatPrint (Str, L"Acpi(%08x,%x)", (UINTN) Acpi->HID, (UINTN) Acpi->UID);\r
++    MyCatPrint (Str, L"Acpi(%08x,%x)", (UINTN) Acpi->HID, (UINTN) Acpi->UID);\r
+   }\r
+ }\r
+ \r
+@@ -388,50 +388,50 @@ DevPathExtendedAcpi (
+   }\r
+ \r
+   if (HIDSTRIdx == 0 && CIDSTRIdx == 0 && ExtendedAcpi->UID == 0) {\r
+-    CatPrint (Str, L"AcpiExp(");\r
++    MyCatPrint (Str, L"AcpiExp(");\r
+     if ((ExtendedAcpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
+-      CatPrint (Str, L"PNP%04x,", (UINTN) EISA_ID_TO_NUM (ExtendedAcpi->HID));\r
++      MyCatPrint (Str, L"PNP%04x,", (UINTN) EISA_ID_TO_NUM (ExtendedAcpi->HID));\r
+     } else {\r
+-      CatPrint (Str, L"%08x,", (UINTN) ExtendedAcpi->HID);\r
++      MyCatPrint (Str, L"%08x,", (UINTN) ExtendedAcpi->HID);\r
+     }\r
+     if ((ExtendedAcpi->CID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
+-      CatPrint (Str, L"PNP%04x,", (UINTN)  EISA_ID_TO_NUM (ExtendedAcpi->CID));\r
++      MyCatPrint (Str, L"PNP%04x,", (UINTN)  EISA_ID_TO_NUM (ExtendedAcpi->CID));\r
+     } else {\r
+-      CatPrint (Str, L"%08x,", (UINTN)  ExtendedAcpi->CID);\r
++      MyCatPrint (Str, L"%08x,", (UINTN)  ExtendedAcpi->CID);\r
+     }\r
+     if (UIDSTRIdx != 0) {\r
+-      CatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx);\r
++      MyCatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx);\r
+     } else {\r
+-      CatPrint (Str, L"\"\")");\r
++      MyCatPrint (Str, L"\"\")");\r
+     }\r
+   } else {\r
+-    CatPrint (Str, L"AcpiEx(");\r
++    MyCatPrint (Str, L"AcpiEx(");\r
+     if ((ExtendedAcpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
+-      CatPrint (Str, L"PNP%04x,", (UINTN)  EISA_ID_TO_NUM (ExtendedAcpi->HID));\r
++      MyCatPrint (Str, L"PNP%04x,", (UINTN)  EISA_ID_TO_NUM (ExtendedAcpi->HID));\r
+     } else {\r
+-      CatPrint (Str, L"%08x,", (UINTN) ExtendedAcpi->HID);\r
++      MyCatPrint (Str, L"%08x,", (UINTN) ExtendedAcpi->HID);\r
+     }\r
+     if ((ExtendedAcpi->CID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
+-      CatPrint (Str, L"PNP%04x,", (UINTN) EISA_ID_TO_NUM (ExtendedAcpi->CID));\r
++      MyCatPrint (Str, L"PNP%04x,", (UINTN) EISA_ID_TO_NUM (ExtendedAcpi->CID));\r
+     } else {\r
+-      CatPrint (Str, L"%08x,", (UINTN) ExtendedAcpi->CID);\r
++      MyCatPrint (Str, L"%08x,", (UINTN) ExtendedAcpi->CID);\r
+     }\r
+-    CatPrint (Str, L"%x,", (UINTN) ExtendedAcpi->UID);\r
++    MyCatPrint (Str, L"%x,", (UINTN) ExtendedAcpi->UID);\r
+ \r
+     if (HIDSTRIdx != 0) {\r
+-      CatPrint (Str, L"%a,", AsChar8Array + HIDSTRIdx);\r
++      MyCatPrint (Str, L"%a,", AsChar8Array + HIDSTRIdx);\r
+     } else {\r
+-      CatPrint (Str, L"\"\",");\r
++      MyCatPrint (Str, L"\"\",");\r
+     }\r
+     if (CIDSTRIdx != 0) {\r
+-      CatPrint (Str, L"%a,", AsChar8Array + CIDSTRIdx);\r
++      MyCatPrint (Str, L"%a,", AsChar8Array + CIDSTRIdx);\r
+     } else {\r
+-      CatPrint (Str, L"\"\",");\r
++      MyCatPrint (Str, L"\"\",");\r
+     }\r
+     if (UIDSTRIdx != 0) {\r
+-      CatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx);\r
++      MyCatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx);\r
+     } else {\r
+-      CatPrint (Str, L"\"\")");\r
++      MyCatPrint (Str, L"\"\")");\r
+     }\r
+   }\r
+ \r
+@@ -462,11 +462,11 @@ DevPathAdrAcpi (
+   Length             = (UINT16) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) AcpiAdr);\r
+   AdditionalAdrCount = (UINT16) ((Length - 8) / 4);\r
+ \r
+-  CatPrint (Str, L"AcpiAdr(%x", (UINTN) AcpiAdr->ADR);\r
++  MyCatPrint (Str, L"AcpiAdr(%x", (UINTN) AcpiAdr->ADR);\r
+   for (Index = 0; Index < AdditionalAdrCount; Index++) {\r
+-    CatPrint (Str, L",%x", (UINTN) *(UINT32 *) ((UINT8 *) AcpiAdr + 8 + Index * 4));\r
++    MyCatPrint (Str, L",%x", (UINTN) *(UINT32 *) ((UINT8 *) AcpiAdr + 8 + Index * 4));\r
+   }\r
+-  CatPrint (Str, L")");\r
++  MyCatPrint (Str, L")");\r
+ }\r
+ \r
+ /**\r
+@@ -488,7 +488,7 @@ DevPathAtapi (
+   ATAPI_DEVICE_PATH *Atapi;\r
+ \r
+   Atapi = DevPath;\r
+-  CatPrint (\r
++  MyCatPrint (\r
+     Str,\r
+     L"Ata(%s,%s)",\r
+     (Atapi->PrimarySecondary != 0)? L"Secondary" : L"Primary",\r
+@@ -515,7 +515,7 @@ DevPathScsi (
+   SCSI_DEVICE_PATH  *Scsi;\r
+ \r
+   Scsi = DevPath;\r
+-  CatPrint (Str, L"Scsi(Pun%x,Lun%x)", (UINTN) Scsi->Pun, (UINTN) Scsi->Lun);\r
++  MyCatPrint (Str, L"Scsi(Pun%x,Lun%x)", (UINTN) Scsi->Pun, (UINTN) Scsi->Lun);\r
+ }\r
+ \r
+ /**\r
+@@ -537,7 +537,7 @@ DevPathFibre (
+   FIBRECHANNEL_DEVICE_PATH  *Fibre;\r
+ \r
+   Fibre = DevPath;\r
+-  CatPrint (Str, L"Fibre(Wwn%lx,Lun%x)", Fibre->WWN, Fibre->Lun);\r
++  MyCatPrint (Str, L"Fibre(Wwn%lx,Lun%x)", Fibre->WWN, Fibre->Lun);\r
+ }\r
+ \r
+ /**\r
+@@ -559,7 +559,7 @@ DevPath1394 (
+   F1394_DEVICE_PATH *F1394Path;\r
+ \r
+   F1394Path = DevPath;\r
+-  CatPrint (Str, L"1394(%lx)", &F1394Path->Guid);\r
++  MyCatPrint (Str, L"1394(%lx)", &F1394Path->Guid);\r
+ }\r
+ \r
+ /**\r
+@@ -581,7 +581,7 @@ DevPathUsb (
+   USB_DEVICE_PATH *Usb;\r
+ \r
+   Usb = DevPath;\r
+-  CatPrint (Str, L"Usb(%x,%x)", (UINTN) Usb->ParentPortNumber, (UINTN) Usb->InterfaceNumber);\r
++  MyCatPrint (Str, L"Usb(%x,%x)", (UINTN) Usb->ParentPortNumber, (UINTN) Usb->InterfaceNumber);\r
+ }\r
+ \r
+ /**\r
+@@ -603,7 +603,7 @@ DevPathUsbWWID (
+   USB_WWID_DEVICE_PATH  *UsbWWId;\r
+ \r
+   UsbWWId = DevPath;\r
+-  CatPrint (\r
++  MyCatPrint (\r
+     Str,\r
+     L"UsbWwid(%x,%x,%x,\"WWID\")",\r
+     (UINTN) UsbWWId->VendorId,\r
+@@ -631,7 +631,7 @@ DevPathLogicalUnit (
+   DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit;\r
+ \r
+   LogicalUnit = DevPath;\r
+-  CatPrint (Str, L"Unit(%x)", (UINTN) LogicalUnit->Lun);\r
++  MyCatPrint (Str, L"Unit(%x)", (UINTN) LogicalUnit->Lun);\r
+ }\r
+ \r
+ /**\r
+@@ -653,7 +653,7 @@ DevPathUsbClass (
+   USB_CLASS_DEVICE_PATH *UsbClass;\r
+ \r
+   UsbClass = DevPath;\r
+-  CatPrint (\r
++  MyCatPrint (\r
+     Str,\r
+     L"Usb Class(%x,%x,%x,%x,%x)",\r
+     (UINTN) UsbClass->VendorId,\r
+@@ -684,14 +684,14 @@ DevPathSata (
+ \r
+   Sata = DevPath;\r
+   if ((Sata->PortMultiplierPortNumber & SATA_HBA_DIRECT_CONNECT_FLAG) != 0) {\r
+-    CatPrint (\r
++    MyCatPrint (\r
+       Str,\r
+       L"Sata(%x,%x)",\r
+       (UINTN) Sata->HBAPortNumber,\r
+       (UINTN) Sata->Lun\r
+       );\r
+   } else {\r
+-    CatPrint (\r
++    MyCatPrint (\r
+       Str,\r
+       L"Sata(%x,%x,%x)",\r
+       (UINTN) Sata->HBAPortNumber,\r
+@@ -720,7 +720,7 @@ DevPathI2O (
+   I2O_DEVICE_PATH *I2OPath;\r
+ \r
+   I2OPath = DevPath;\r
+-  CatPrint (Str, L"I2O(%x)", (UINTN) I2OPath->Tid);\r
++  MyCatPrint (Str, L"I2O(%x)", (UINTN) I2OPath->Tid);\r
+ }\r
+ \r
+ /**\r
+@@ -750,13 +750,13 @@ DevPathMacAddr (
+     HwAddressSize = 6;\r
+   }\r
+ \r
+-  CatPrint (Str, L"Mac(");\r
++  MyCatPrint (Str, L"Mac(");\r
+ \r
+   for (Index = 0; Index < HwAddressSize; Index++) {\r
+-    CatPrint (Str, L"%02x", (UINTN) MACDevPath->MacAddress.Addr[Index]);\r
++    MyCatPrint (Str, L"%02x", (UINTN) MACDevPath->MacAddress.Addr[Index]);\r
+   }\r
+ \r
+-  CatPrint (Str, L")");\r
++  MyCatPrint (Str, L")");\r
+ }\r
+ \r
+ /**\r
+@@ -778,7 +778,7 @@ DevPathIPv4 (
+   IPv4_DEVICE_PATH  *IPDevPath;\r
+ \r
+   IPDevPath = DevPath;\r
+-  CatPrint (\r
++  MyCatPrint (\r
+     Str,\r
+     L"IPv4(%d.%d.%d.%d:%d)",\r
+     (UINTN) IPDevPath->RemoteIpAddress.Addr[0],\r
+@@ -808,7 +808,7 @@ DevPathIPv6 (
+   IPv6_DEVICE_PATH  *IPv6DevPath;\r
+ \r
+   IPv6DevPath = DevPath;\r
+-  CatPrint (\r
++  MyCatPrint (\r
+     Str,\r
+     L"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",\r
+     (UINTN) IPv6DevPath->RemoteIpAddress.Addr[0],\r
+@@ -849,7 +849,7 @@ DevPathInfiniBand (
+   INFINIBAND_DEVICE_PATH  *InfiniBand;\r
+ \r
+   InfiniBand = DevPath;\r
+-  CatPrint (\r
++  MyCatPrint (\r
+     Str,\r
+     L"Infiniband(%x,%g,%lx,%lx,%lx)",\r
+     (UINTN) InfiniBand->ResourceFlags,\r
+@@ -911,36 +911,36 @@ DevPathUart (
+   }\r
+ \r
+   if (Uart->BaudRate == 0) {\r
+-    CatPrint (Str, L"Uart(DEFAULT,%c,", Parity);\r
++    MyCatPrint (Str, L"Uart(DEFAULT,%c,", Parity);\r
+   } else {\r
+-    CatPrint (Str, L"Uart(%ld,%c,", Uart->BaudRate, Parity);\r
++    MyCatPrint (Str, L"Uart(%ld,%c,", Uart->BaudRate, Parity);\r
+   }\r
+ \r
+   if (Uart->DataBits == 0) {\r
+-    CatPrint (Str, L"D,");\r
++    MyCatPrint (Str, L"D,");\r
+   } else {\r
+-    CatPrint (Str, L"%d,", (UINTN) Uart->DataBits);\r
++    MyCatPrint (Str, L"%d,", (UINTN) Uart->DataBits);\r
+   }\r
+ \r
+   switch (Uart->StopBits) {\r
+   case 0:\r
+-    CatPrint (Str, L"D)");\r
++    MyCatPrint (Str, L"D)");\r
+     break;\r
+ \r
+   case 1:\r
+-    CatPrint (Str, L"1)");\r
++    MyCatPrint (Str, L"1)");\r
+     break;\r
+ \r
+   case 2:\r
+-    CatPrint (Str, L"1.5)");\r
++    MyCatPrint (Str, L"1.5)");\r
+     break;\r
+ \r
+   case 3:\r
+-    CatPrint (Str, L"2)");\r
++    MyCatPrint (Str, L"2)");\r
+     break;\r
+ \r
+   default:\r
+-    CatPrint (Str, L"x)");\r
++    MyCatPrint (Str, L"x)");\r
+     break;\r
+   }\r
+ }\r
+@@ -965,7 +965,7 @@ DevPathiSCSI (
+   UINT16                      Options;\r
+ \r
+   IScsi = DevPath;\r
+-  CatPrint (\r
++  MyCatPrint (\r
+     Str,\r
+     L"iSCSI(%a,%x,%lx,",\r
+     IScsi->TargetName,\r
+@@ -974,18 +974,18 @@ DevPathiSCSI (
+     );\r
+ \r
+   Options = IScsi->LoginOption;\r
+-  CatPrint (Str, L"%s,", (((Options >> 1) & 0x0001) != 0) ? L"CRC32C" : L"None");\r
+-  CatPrint (Str, L"%s,", (((Options >> 3) & 0x0001) != 0) ? L"CRC32C" : L"None");\r
++  MyCatPrint (Str, L"%s,", (((Options >> 1) & 0x0001) != 0) ? L"CRC32C" : L"None");\r
++  MyCatPrint (Str, L"%s,", (((Options >> 3) & 0x0001) != 0) ? L"CRC32C" : L"None");\r
+   if (((Options >> 11) & 0x0001) != 0) {\r
+-    CatPrint (Str, L"%s,", L"None");\r
++    MyCatPrint (Str, L"%s,", L"None");\r
+   } else if (((Options >> 12) & 0x0001) != 0) {\r
+-    CatPrint (Str, L"%s,", L"CHAP_UNI");\r
++    MyCatPrint (Str, L"%s,", L"CHAP_UNI");\r
+   } else {\r
+-    CatPrint (Str, L"%s,", L"CHAP_BI");\r
++    MyCatPrint (Str, L"%s,", L"CHAP_BI");\r
+ \r
+   }\r
+ \r
+-  CatPrint (Str, L"%s)", (IScsi->NetworkProtocol == 0) ? L"TCP" : L"reserved");\r
++  MyCatPrint (Str, L"%s)", (IScsi->NetworkProtocol == 0) ? L"TCP" : L"reserved");\r
+ }\r
+ \r
+ /**\r
+@@ -1007,7 +1007,7 @@ DevPathVlan (
+   VLAN_DEVICE_PATH  *Vlan;\r
+ \r
+   Vlan = DevPath;\r
+-  CatPrint (Str, L"Vlan(%d)", (UINTN) Vlan->VlanId);\r
++  MyCatPrint (Str, L"Vlan(%d)", (UINTN) Vlan->VlanId);\r
+ }\r
+ \r
+ /**\r
+@@ -1031,7 +1031,7 @@ DevPathHardDrive (
+   Hd = DevPath;\r
+   switch (Hd->SignatureType) {\r
+   case SIGNATURE_TYPE_MBR:\r
+-    CatPrint (\r
++    MyCatPrint (\r
+       Str,\r
+       L"HD(Part%d,Sig%08x)",\r
+       (UINTN) Hd->PartitionNumber,\r
+@@ -1040,7 +1040,7 @@ DevPathHardDrive (
+     break;\r
+ \r
+   case SIGNATURE_TYPE_GUID:\r
+-    CatPrint (\r
++    MyCatPrint (\r
+       Str,\r
+       L"HD(Part%d,Sig%g)",\r
+       (UINTN) Hd->PartitionNumber,\r
+@@ -1049,7 +1049,7 @@ DevPathHardDrive (
+     break;\r
+ \r
+   default:\r
+-    CatPrint (\r
++    MyCatPrint (\r
+       Str,\r
+       L"HD(Part%d,MBRType=%02x,SigType=%02x)",\r
+       (UINTN) Hd->PartitionNumber,\r
+@@ -1079,7 +1079,7 @@ DevPathCDROM (
+   CDROM_DEVICE_PATH *Cd;\r
+ \r
+   Cd = DevPath;\r
+-  CatPrint (Str, L"CDROM(Entry%x)", (UINTN) Cd->BootEntry);\r
++  MyCatPrint (Str, L"CDROM(Entry%x)", (UINTN) Cd->BootEntry);\r
+ }\r
+ \r
+ /**\r
+@@ -1101,7 +1101,7 @@ DevPathFilePath (
+   FILEPATH_DEVICE_PATH  *Fp;\r
+ \r
+   Fp = DevPath;\r
+-  CatPrint (Str, L"%s", Fp->PathName);\r
++  MyCatPrint (Str, L"%s", Fp->PathName);\r
+ }\r
+ \r
+ /**\r
+@@ -1123,7 +1123,7 @@ DevPathMediaProtocol (
+   MEDIA_PROTOCOL_DEVICE_PATH  *MediaProt;\r
+ \r
+   MediaProt = DevPath;\r
+-  CatPrint (Str, L"Media(%g)", &MediaProt->Protocol);\r
++  MyCatPrint (Str, L"Media(%g)", &MediaProt->Protocol);\r
+ }\r
+ \r
+ /**\r
+@@ -1145,7 +1145,7 @@ DevPathFvFilePath (
+   MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFilePath;\r
+ \r
+   FvFilePath = DevPath;\r
+-  CatPrint (Str, L"%g", &FvFilePath->FvFileName);\r
++  MyCatPrint (Str, L"%g", &FvFilePath->FvFileName);\r
+ }\r
+ \r
+ /**\r
+@@ -1167,7 +1167,7 @@ MyDevPathRelativeOffsetRange (
+   MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset;\r
+ \r
+   Offset = DevPath;\r
+-  CatPrint (\r
++  MyCatPrint (\r
+     Str,\r
+     L"Offset(%lx,%lx)",\r
+     Offset->StartingOffset,\r
+@@ -1228,7 +1228,7 @@ DevPathBssBss (
+     Type = L"?";\r
+     break;\r
+   }\r
+-  CatPrint (Str, L"Legacy-%s", Type);\r
++  MyCatPrint (Str, L"Legacy-%s", Type);\r
+ }\r
+ \r
+ /**\r
+@@ -1247,7 +1247,7 @@ DevPathEndInstance (
+   IN VOID                 *DevPath\r
+   )\r
+ {\r
+-  CatPrint (Str, L",");\r
++  MyCatPrint (Str, L",");\r
+ }\r
+ \r
+ /**\r
+@@ -1266,7 +1266,7 @@ DevPathNodeUnknown (
+   IN VOID                 *DevPath\r
+   )\r
+ {\r
+-  CatPrint (Str, L"?");\r
++  MyCatPrint (Str, L"?");\r
+ }\r
+ /**\r
+   Convert Device Path to a Unicode string for printing.\r
+@@ -1287,7 +1287,7 @@ DevPathFvPath (
+   MEDIA_FW_VOL_DEVICE_PATH *FvPath;\r
+ \r
+   FvPath = DevPath;\r
+-  CatPrint (Str, L"Fv(%g)", &FvPath->FvName);\r
++  MyCatPrint (Str, L"Fv(%g)", &FvPath->FvName);\r
+ }\r
+ \r
+ DEVICE_PATH_STRING_TABLE  DevPathTable[] = {\r
+@@ -1553,7 +1553,7 @@ DevicePathToStr (
+     //  Put a path seperator in if needed\r
+     //\r
+     if ((Str.Len != 0) && (DumpNode != DevPathEndInstance)) {\r
+-      CatPrint (&Str, L"/");\r
++      MyCatPrint (&Str, L"/");\r
+     }\r
+     //\r
+     // Print this node of the device path\r
+diff --git a/EfiLib/GenericBdsLib.h b/EfiLib/GenericBdsLib.h
+index be4325b..afc10cb 100644
+--- a/EfiLib/GenericBdsLib.h
++++ b/EfiLib/GenericBdsLib.h
+@@ -872,11 +872,6 @@ BdsLibSaveMemoryTypeInformation (
+   @retval EFI_ACCESS_DENIED   The user was not successfully identified.\r
+ \r
+ **/\r
+-// EFI_STATUS\r
+-// EFIAPI\r
+-// BdsLibUserIdentify (\r
+-//   OUT EFI_USER_PROFILE_HANDLE         *User\r
+-//   );  \r
+ \r
+ /**\r
+   This function checks if a Fv file device path is valid, according to a file GUID. If it is invalid,\r
+@@ -961,7 +956,7 @@ DevPathVendor (
+ \r
+ CHAR16 *\r
+ EFIAPI\r
+-CatPrint (\r
++MyCatPrint (\r
+   IN OUT POOL_PRINT   *Str,\r
+   IN CHAR16           *Fmt,\r
+   ...\r
+diff --git a/EfiLib/gnuefi-helper.c b/EfiLib/gnuefi-helper.c
+index d4f269d..f8cd9a3 100644
+--- a/EfiLib/gnuefi-helper.c
++++ b/EfiLib/gnuefi-helper.c
+@@ -21,7 +21,6 @@
+ #include "LegacyBios.h"
+ 
+ EFI_GUID gEfiDevicePathUtilitiesProtocolGuid = { 0x09576E91, 0x6D3F, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
+-EFI_GUID gEfiGlobalVariableGuid = { 0x8BE4DF61, 0x93CA, 0x11D2, { 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C }};
+ EFI_GUID gEfiLegacyBiosProtocolGuid = { 0xdb9a1e3d, 0x45cb, 0x4abb, { 0x85, 0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d }};
+ 
+ /**
+diff --git a/EfiLib/legacy.c b/EfiLib/legacy.c
+index 3e5edee..271b948 100644
+--- a/EfiLib/legacy.c
++++ b/EfiLib/legacy.c
+@@ -36,6 +36,7 @@ UINTN                    mBootOptionBbsMappingCount = 0;
+ extern EFI_DEVICE_PATH EndDevicePath[];
+ extern EFI_GUID gEfiLegacyBiosProtocolGuid;
+ EFI_GUID gEfiLegacyDevOrderVariableGuid     = { 0xa56074db, 0x65fe, 0x45f7, {0xbd, 0x21, 0x2d, 0x2b, 0xdd, 0x8e, 0x96, 0x52 }};
++static EFI_GUID EfiGlobalVariableGuid = { 0x8BE4DF61, 0x93CA, 0x11D2, { 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C }};
+ 
+ /**
+ 
+@@ -276,7 +277,7 @@ BdsFindLegacyBootOptionByDevTypeAndName (
+     UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", (UINTN) BootOrder[Index]);
+     BootOptionVar = BdsLibGetVariableAndSize (
+                       BootOption,
+-                      &gEfiGlobalVariableGuid,
++                      &EfiGlobalVariableGuid,
+                       &BootOptionSize
+                       );
+     if (NULL == BootOptionVar) {
+@@ -462,7 +463,7 @@ BdsCreateLegacyBootOption (
+ 
+   Status = refit_call5_wrapper(gRT->SetVariable,
+                   BootString,
+-                  &gEfiGlobalVariableGuid,
++                  &EfiGlobalVariableGuid,
+                   VAR_FLAG,
+                   BufferSize,
+                   Buffer
+@@ -747,7 +748,7 @@ BdsAddNonExistingLegacyBootOptions (
+ 
+   BootOrder = BdsLibGetVariableAndSize (
+                 L"BootOrder",
+-                &gEfiGlobalVariableGuid,
++                &EfiGlobalVariableGuid,
+                 &BootOrderSize
+                 );
+   if (BootOrder == NULL) {
+@@ -817,13 +818,13 @@ BdsAddNonExistingLegacyBootOptions (
+   if (BootOrderSize > 0) {
+     Status = refit_call5_wrapper(gRT->SetVariable,
+                     L"BootOrder",
+-                    &gEfiGlobalVariableGuid,
++                    &EfiGlobalVariableGuid,
+                     VAR_FLAG,
+                     BootOrderSize,
+                     BootOrder
+                     );
+   } else {
+-    EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);
++    EfiLibDeleteVariable (L"BootOrder", &EfiGlobalVariableGuid);
+   }
+ 
+   if (BootOrder != NULL) {
+@@ -861,7 +862,7 @@ BdsDeleteBootOption (
+   Index2Del = 0;
+ 
+   UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", OptionNumber);
+-  Status = EfiLibDeleteVariable (BootOption, &gEfiGlobalVariableGuid);
++  Status = EfiLibDeleteVariable (BootOption, &EfiGlobalVariableGuid);
+ 
+   //
+   // adjust boot order array
+@@ -940,7 +941,7 @@ BdsDeleteAllInvalidLegacyBootOptions (
+ 
+   BootOrder = BdsLibGetVariableAndSize (
+                 L"BootOrder",
+-                &gEfiGlobalVariableGuid,
++                &EfiGlobalVariableGuid,
+                 &BootOrderSize
+                 );
+   if (BootOrder == NULL) {
+@@ -952,14 +953,14 @@ BdsDeleteAllInvalidLegacyBootOptions (
+     UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);
+     BootOptionVar = BdsLibGetVariableAndSize (
+                       BootOption,
+-                      &gEfiGlobalVariableGuid,
++                      &EfiGlobalVariableGuid,
+                       &BootOptionSize
+                       );
+     if (NULL == BootOptionVar) {
+       BootOptionSize = 0;
+       Status = refit_call5_wrapper(gRT->GetVariable,
+                       BootOption,
+-                      &gEfiGlobalVariableGuid,
++                      &EfiGlobalVariableGuid,
+                       NULL,
+                       &BootOptionSize,
+                       BootOptionVar
+@@ -1035,13 +1036,13 @@ BdsDeleteAllInvalidLegacyBootOptions (
+   if (BootOrderSize != 0) {
+     Status = refit_call5_wrapper(gRT->SetVariable,
+                     L"BootOrder",
+-                    &gEfiGlobalVariableGuid,
++                    &EfiGlobalVariableGuid,
+                     VAR_FLAG,
+                     BootOrderSize,
+                     BootOrder
+                     );
+   } else {
+-    EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);
++    EfiLibDeleteVariable (L"BootOrder", &EfiGlobalVariableGuid);
+   }
+ 
+   if (BootOrder != NULL) {
+diff --git a/filesystems/edk2/DriverBinding.h b/filesystems/edk2/DriverBinding.h
+index fdb16c5..c2de33a 100644
+--- a/filesystems/edk2/DriverBinding.h
++++ b/filesystems/edk2/DriverBinding.h
+@@ -21,30 +21,32 @@ Revision History
+ \r
+ --*/\r
+ \r
++/*\r
++ * rEFInd NOTE: This file is included only when compiling with GNU-EFI,\r
++ * which has not traditionally provided the definitions supplied here.\r
++ * Unfortunately, recent (ca. 3.0.5) versions of GNU-EFI have added\r
++ * SOME of these functions to an existing header file, creating problems\r
++ * when trying to maintain compatibility with multiple GNU-EFI versions.\r
++ * I've therefore renamed the relevant defines, types, and functions,\r
++ * both here and in fsw_efi.c; and included a define to match the only\r
++ * used name (REFIND_EFI_DRIVER_BINDING_PROTOCOL) to the traditional\r
++ * name (EFI_DRIVER_BINDING_PROTOCOL) in fsw_efi.c for compiling with\r
++ * TianoCore.\r
++ */\r
++\r
+ #ifndef _EFI_DRIVER_BINDING_H_\r
+ #define _EFI_DRIVER_BINDING_H_\r
+ \r
+ #include <efidevp.h>\r
+ \r
+-//\r
+-// Global ID for the ControllerHandle Driver Protocol\r
+-//\r
+-#define EFI_DRIVER_BINDING_PROTOCOL_GUID \\r
++#define REFIND_EFI_DRIVER_BINDING_PROTOCOL_GUID \\r
+   { \\r
+     0x18a031ab, 0xb443, 0x4d1a, {0xa5, 0xc0, 0xc, 0x9, 0x26, 0x1e, 0x9f, 0x71} \\r
+   }\r
+ \r
+ #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x\r
+ \r
+-EFI_FORWARD_DECLARATION (EFI_DRIVER_BINDING_PROTOCOL);\r
+-\r
+-///\r
+-/// Device Path protocol.\r
+-///\r
+-#define EFI_DEVICE_PATH_PROTOCOL_GUID \\r
+-  { \\r
+-    0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \\r
+-  }\r
++EFI_FORWARD_DECLARATION (REFIND_EFI_DRIVER_BINDING_PROTOCOL);\r
+ \r
+ // Begin included from DevicePath.h....\r
+ \r
+@@ -79,18 +81,19 @@ typedef struct {
+   UINT8 Length[2];  ///< Specific Device Path data. Type and Sub-Type define\r
+                     ///< type of data. Size of data is included in Length.\r
+ \r
+-} EFI_DEVICE_PATH_PROTOCOL;\r
++} REFIND_EFI_DEVICE_PATH_PROTOCOL;\r
+ \r
+ #pragma pack()\r
+ \r
++\r
+ // End included from DevicePath.h\r
+ \r
+ typedef\r
+ EFI_STATUS\r
+ (EFI_FUNCTION EFIAPI *EFI_DRIVER_BINDING_SUPPORTED) (\r
+-  IN EFI_DRIVER_BINDING_PROTOCOL            * This,\r
++  IN REFIND_EFI_DRIVER_BINDING_PROTOCOL            * This,\r
+   IN EFI_HANDLE                             ControllerHandle,\r
+-  IN EFI_DEVICE_PATH_PROTOCOL               * RemainingDevicePath OPTIONAL\r
++  IN REFIND_EFI_DEVICE_PATH_PROTOCOL               * RemainingDevicePath OPTIONAL\r
+   )\r
+ /*++\r
+ \r
+@@ -114,9 +117,9 @@ EFI_STATUS
+ typedef\r
+ EFI_STATUS\r
+ (EFI_FUNCTION EFIAPI *EFI_DRIVER_BINDING_START) (\r
+-  IN EFI_DRIVER_BINDING_PROTOCOL            * This,\r
++  IN REFIND_EFI_DRIVER_BINDING_PROTOCOL            * This,\r
+   IN EFI_HANDLE                             ControllerHandle,\r
+-  IN EFI_DEVICE_PATH_PROTOCOL               * RemainingDevicePath OPTIONAL\r
++  IN REFIND_EFI_DEVICE_PATH_PROTOCOL               * RemainingDevicePath OPTIONAL\r
+   )\r
+ /*++\r
+ \r
+@@ -140,7 +143,7 @@ EFI_STATUS
+ typedef\r
+ EFI_STATUS\r
+ (EFI_FUNCTION EFIAPI *EFI_DRIVER_BINDING_STOP) (\r
+-  IN EFI_DRIVER_BINDING_PROTOCOL            * This,\r
++  IN REFIND_EFI_DRIVER_BINDING_PROTOCOL            * This,\r
+   IN  EFI_HANDLE                            ControllerHandle,\r
+   IN  UINTN                                 NumberOfChildren,\r
+   IN  EFI_HANDLE                            * ChildHandleBuffer\r
+@@ -167,7 +170,7 @@ EFI_STATUS
+ //\r
+ // Interface structure for the ControllerHandle Driver Protocol\r
+ //\r
+-struct _EFI_DRIVER_BINDING_PROTOCOL {\r
++struct _REFIND_EFI_DRIVER_BINDING_PROTOCOL {\r
+   EFI_DRIVER_BINDING_SUPPORTED  Supported;\r
+   EFI_DRIVER_BINDING_START      Start;\r
+   EFI_DRIVER_BINDING_STOP       Stop;\r
+diff --git a/filesystems/fsw_efi.c b/filesystems/fsw_efi.c
+index a7257fa..635985e 100644
+--- a/filesystems/fsw_efi.c
++++ b/filesystems/fsw_efi.c
+@@ -43,9 +43,18 @@
+ #ifdef __MAKEWITH_GNUEFI
+ #include "edk2/DriverBinding.h"
+ #include "edk2/ComponentName.h"
++#define gMyEfiSimpleFileSystemProtocolGuid FileSystemProtocol
+ #else
++#define REFIND_EFI_DRIVER_BINDING_PROTOCOL EFI_DRIVER_BINDING_PROTOCOL
+ #define REFIND_EFI_COMPONENT_NAME_PROTOCOL EFI_COMPONENT_NAME_PROTOCOL
++#define REFIND_EFI_COMPONENT_NAME_PROTOCOL_GUID EFI_COMPONENT_NAME_PROTOCOL_GUID
++#define REFIND_EFI_DRIVER_BINDING_PROTOCOL_GUID EFI_DRIVER_BINDING_PROTOCOL_GUID
++#define REFIND_EFI_DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH_PROTOCOL
++#define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID    \
++    { 0xDB47D7D3,0xFE81, 0x11d3, {0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
++#define gMyEfiSimpleFileSystemProtocolGuid gEfiSimpleFileSystemProtocolGuid
+ #endif
++
+ #include "../include/refit_call_wrapper.h"
+ 
+ #define DEBUG_LEVEL 0
+@@ -55,27 +64,13 @@
+ #define FSTYPE ext2
+ #endif
+ 
+-#ifdef __MAKEWITH_GNUEFI
+-
+-#define EFI_DISK_IO_PROTOCOL_GUID \
+-  { \
+-    0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
+-  }
+-
+-#define EFI_BLOCK_IO_PROTOCOL_GUID \
+-  { \
+-    0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
+-  }
+-
+-EFI_GUID gEfiDriverBindingProtocolGuid = EFI_DRIVER_BINDING_PROTOCOL_GUID;
+-EFI_GUID gEfiComponentNameProtocolGuid = REFIND_EFI_COMPONENT_NAME_PROTOCOL_GUID;
+-EFI_GUID gEfiDiskIoProtocolGuid = EFI_DISK_IO_PROTOCOL_GUID;
+-EFI_GUID gEfiBlockIoProtocolGuid = EFI_BLOCK_IO_PROTOCOL_GUID;
+-EFI_GUID gEfiFileInfoGuid = EFI_FILE_INFO_ID;
+-EFI_GUID gEfiFileSystemInfoGuid = EFI_FILE_SYSTEM_INFO_ID;
+-EFI_GUID gEfiFileSystemVolumeLabelInfoIdGuid = EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID;
+-#define gEfiSimpleFileSystemProtocolGuid FileSystemProtocol
+-#endif
++EFI_GUID gMyEfiDriverBindingProtocolGuid = REFIND_EFI_DRIVER_BINDING_PROTOCOL_GUID;
++EFI_GUID gMyEfiComponentNameProtocolGuid = REFIND_EFI_COMPONENT_NAME_PROTOCOL_GUID;
++EFI_GUID gMyEfiDiskIoProtocolGuid = REFIND_EFI_DISK_IO_PROTOCOL_GUID;
++EFI_GUID gMyEfiBlockIoProtocolGuid = REFIND_EFI_BLOCK_IO_PROTOCOL_GUID;
++EFI_GUID gMyEfiFileInfoGuid = EFI_FILE_INFO_ID;
++EFI_GUID gMyEfiFileSystemInfoGuid = EFI_FILE_SYSTEM_INFO_ID;
++EFI_GUID gMyEfiFileSystemVolumeLabelInfoIdGuid = EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID;
+ 
+ /** Helper macro for stringification. */
+ #define FSW_EFI_STRINGIFY(x) #x
+@@ -84,25 +79,25 @@ EFI_GUID gEfiFileSystemVolumeLabelInfoIdGuid = EFI_FILE_SYSTEM_VOLUME_LABEL_INFO
+ 
+ // function prototypes
+ 
+-EFI_STATUS EFIAPI fsw_efi_DriverBinding_Supported(IN EFI_DRIVER_BINDING_PROTOCOL  *This,
+-                                                  IN EFI_HANDLE                   ControllerHandle,
+-                                                  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath);
+-EFI_STATUS EFIAPI fsw_efi_DriverBinding_Start(IN EFI_DRIVER_BINDING_PROTOCOL  *This,
+-                                              IN EFI_HANDLE                   ControllerHandle,
+-                                              IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath);
+-EFI_STATUS EFIAPI fsw_efi_DriverBinding_Stop(IN  EFI_DRIVER_BINDING_PROTOCOL  *This,
+-                                             IN  EFI_HANDLE                   ControllerHandle,
+-                                             IN  UINTN                        NumberOfChildren,
+-                                             IN  EFI_HANDLE                   *ChildHandleBuffer);
++EFI_STATUS EFIAPI fsw_efi_DriverBinding_Supported(IN REFIND_EFI_DRIVER_BINDING_PROTOCOL  *This,
++                                                  IN EFI_HANDLE                          ControllerHandle,
++                                                  IN REFIND_EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath);
++EFI_STATUS EFIAPI fsw_efi_DriverBinding_Start(IN REFIND_EFI_DRIVER_BINDING_PROTOCOL  *This,
++                                              IN EFI_HANDLE                          ControllerHandle,
++                                              IN REFIND_EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath);
++EFI_STATUS EFIAPI fsw_efi_DriverBinding_Stop(IN REFIND_EFI_DRIVER_BINDING_PROTOCOL  *This,
++                                             IN EFI_HANDLE                          ControllerHandle,
++                                             IN UINTN                               NumberOfChildren,
++                                             IN EFI_HANDLE                          *ChildHandleBuffer);
+ 
+ EFI_STATUS EFIAPI fsw_efi_ComponentName_GetDriverName(IN  REFIND_EFI_COMPONENT_NAME_PROTOCOL  *This,
+-                                                      IN  CHAR8                        *Language,
+-                                                      OUT CHAR16                       **DriverName);
+-EFI_STATUS EFIAPI fsw_efi_ComponentName_GetControllerName(IN  REFIND_EFI_COMPONENT_NAME_PROTOCOL    *This,
+-                                                          IN  EFI_HANDLE                     ControllerHandle,
+-                                                          IN  EFI_HANDLE                     ChildHandle  OPTIONAL,
+-                                                          IN  CHAR8                          *Language,
+-                                                          OUT CHAR16                         **ControllerName);
++                                                      IN  CHAR8                               *Language,
++                                                      OUT CHAR16                              **DriverName);
++EFI_STATUS EFIAPI fsw_efi_ComponentName_GetControllerName(IN  REFIND_EFI_COMPONENT_NAME_PROTOCOL  *This,
++                                                          IN  EFI_HANDLE                          ControllerHandle,
++                                                          IN  EFI_HANDLE                          ChildHandle  OPTIONAL,
++                                                          IN  CHAR8                               *Language,
++                                                          OUT CHAR16                              **ControllerName);
+ 
+ void EFIAPI fsw_efi_change_blocksize(struct fsw_volume *vol,
+                               fsw_u32 old_phys_blocksize, fsw_u32 old_log_blocksize,
+@@ -164,7 +159,7 @@ static int LastRead = -1;
+  * Interface structure for the EFI Driver Binding protocol.
+  */
+ 
+-EFI_DRIVER_BINDING_PROTOCOL fsw_efi_DriverBinding_table = {
++REFIND_EFI_DRIVER_BINDING_PROTOCOL fsw_efi_DriverBinding_table = {
+     fsw_efi_DriverBinding_Supported,
+     fsw_efi_DriverBinding_Start,
+     fsw_efi_DriverBinding_Stop,
+@@ -233,7 +228,7 @@ EFI_STATUS EFIAPI fsw_efi_main(IN EFI_HANDLE         ImageHandle,
+     fsw_efi_DriverBinding_table.DriverBindingHandle  = ImageHandle;
+     // install Driver Binding protocol
+     Status = refit_call4_wrapper(BS->InstallProtocolInterface, &fsw_efi_DriverBinding_table.DriverBindingHandle,
+-                                          &gEfiDriverBindingProtocolGuid,
++                                          &gMyEfiDriverBindingProtocolGuid,
+                                           EFI_NATIVE_INTERFACE,
+                                           &fsw_efi_DriverBinding_table);
+     if (EFI_ERROR (Status)) {
+@@ -242,7 +237,7 @@ EFI_STATUS EFIAPI fsw_efi_main(IN EFI_HANDLE         ImageHandle,
+ 
+     // install Component Name protocol
+     Status = refit_call4_wrapper(BS->InstallProtocolInterface, &fsw_efi_DriverBinding_table.DriverBindingHandle,
+-                                          &gEfiComponentNameProtocolGuid,
++                                          &gMyEfiComponentNameProtocolGuid,
+                                           EFI_NATIVE_INTERFACE,
+                                           &fsw_efi_ComponentName_table);
+     if (EFI_ERROR (Status)) {
+@@ -272,9 +267,9 @@ EFI_DRIVER_ENTRY_POINT(fsw_efi_main)
+  * and implicitly checks if the disk is already in use by another driver.
+  */
+ 
+-EFI_STATUS EFIAPI fsw_efi_DriverBinding_Supported(IN EFI_DRIVER_BINDING_PROTOCOL  *This,
++EFI_STATUS EFIAPI fsw_efi_DriverBinding_Supported(IN REFIND_EFI_DRIVER_BINDING_PROTOCOL  *This,
+                                                   IN EFI_HANDLE                   ControllerHandle,
+-                                                  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath)
++                                                  IN REFIND_EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath)
+ {
+     EFI_STATUS          Status;
+     EFI_DISK_IO         *DiskIo;
+@@ -283,7 +278,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Supported(IN EFI_DRIVER_BINDING_PROTOCOL
+ 
+     // first, open DiskIO
+     Status = refit_call6_wrapper(BS->OpenProtocol, ControllerHandle,
+-                              &gEfiDiskIoProtocolGuid,
++                              &gMyEfiDiskIoProtocolGuid,
+                               (VOID **) &DiskIo,
+                               This->DriverBindingHandle,
+                               ControllerHandle,
+@@ -293,13 +288,13 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Supported(IN EFI_DRIVER_BINDING_PROTOCOL
+ 
+     // we were just checking, close it again
+     refit_call4_wrapper(BS->CloseProtocol, ControllerHandle,
+-                      &gEfiDiskIoProtocolGuid,
++                      &gMyEfiDiskIoProtocolGuid,
+                       This->DriverBindingHandle,
+                       ControllerHandle);
+ 
+     // next, check BlockIO without actually opening it
+     Status = refit_call6_wrapper(BS->OpenProtocol, ControllerHandle,
+-                              &gEfiBlockIoProtocolGuid,
++                              &gMyEfiBlockIoProtocolGuid,
+                               NULL,
+                               This->DriverBindingHandle,
+                               ControllerHandle,
+@@ -320,9 +315,9 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Supported(IN EFI_DRIVER_BINDING_PROTOCOL
+  * device handle.
+  */
+ 
+-EFI_STATUS EFIAPI fsw_efi_DriverBinding_Start(IN EFI_DRIVER_BINDING_PROTOCOL  *This,
++EFI_STATUS EFIAPI fsw_efi_DriverBinding_Start(IN REFIND_EFI_DRIVER_BINDING_PROTOCOL  *This,
+                                               IN EFI_HANDLE                   ControllerHandle,
+-                                              IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath)
++                                              IN REFIND_EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath)
+ {
+     EFI_STATUS          Status;
+     EFI_BLOCK_IO        *BlockIo;
+@@ -335,7 +330,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Start(IN EFI_DRIVER_BINDING_PROTOCOL  *T
+ 
+     // open consumed protocols
+     Status = refit_call6_wrapper(BS->OpenProtocol, ControllerHandle,
+-                              &gEfiBlockIoProtocolGuid,
++                              &gMyEfiBlockIoProtocolGuid,
+                               (VOID **) &BlockIo,
+                               This->DriverBindingHandle,
+                               ControllerHandle,
+@@ -346,7 +341,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Start(IN EFI_DRIVER_BINDING_PROTOCOL  *T
+     }
+ 
+     Status = refit_call6_wrapper(BS->OpenProtocol, ControllerHandle,
+-                              &gEfiDiskIoProtocolGuid,
++                              &gMyEfiDiskIoProtocolGuid,
+                               (VOID **) &DiskIo,
+                               This->DriverBindingHandle,
+                               ControllerHandle,
+@@ -373,7 +368,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Start(IN EFI_DRIVER_BINDING_PROTOCOL  *T
+         Volume->FileSystem.Revision     = EFI_FILE_IO_INTERFACE_REVISION;
+         Volume->FileSystem.OpenVolume   = fsw_efi_FileSystem_OpenVolume;
+         Status = refit_call4_wrapper(BS->InstallMultipleProtocolInterfaces, &ControllerHandle,
+-                                                       &gEfiSimpleFileSystemProtocolGuid,
++                                                       &gMyEfiSimpleFileSystemProtocolGuid,
+                                                        &Volume->FileSystem,
+                                                        NULL);
+         if (EFI_ERROR(Status)) {
+@@ -388,7 +383,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Start(IN EFI_DRIVER_BINDING_PROTOCOL  *T
+         FreePool(Volume);
+ 
+         refit_call4_wrapper(BS->CloseProtocol, ControllerHandle,
+-                          &gEfiDiskIoProtocolGuid,
++                          &gMyEfiDiskIoProtocolGuid,
+                           This->DriverBindingHandle,
+                           ControllerHandle);
+     }
+@@ -405,7 +400,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Start(IN EFI_DRIVER_BINDING_PROTOCOL  *T
+  * case; it closes all file handles between commands.
+  */
+ 
+-EFI_STATUS EFIAPI fsw_efi_DriverBinding_Stop(IN  EFI_DRIVER_BINDING_PROTOCOL  *This,
++EFI_STATUS EFIAPI fsw_efi_DriverBinding_Stop(IN  REFIND_EFI_DRIVER_BINDING_PROTOCOL  *This,
+                                              IN  EFI_HANDLE                   ControllerHandle,
+                                              IN  UINTN                        NumberOfChildren,
+                                              IN  EFI_HANDLE                   *ChildHandleBuffer)
+@@ -420,7 +415,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Stop(IN  EFI_DRIVER_BINDING_PROTOCOL  *T
+ 
+     // get the installed SimpleFileSystem interface
+     Status = refit_call6_wrapper(BS->OpenProtocol, ControllerHandle,
+-                              &gEfiSimpleFileSystemProtocolGuid,
++                              &gMyEfiSimpleFileSystemProtocolGuid,
+                               (VOID **) &FileSystem,
+                               This->DriverBindingHandle,
+                               ControllerHandle,
+@@ -433,7 +428,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Stop(IN  EFI_DRIVER_BINDING_PROTOCOL  *T
+ 
+     // uninstall Simple File System protocol
+     Status = refit_call4_wrapper(BS->UninstallMultipleProtocolInterfaces, ControllerHandle,
+-                                                     &gEfiSimpleFileSystemProtocolGuid, &Volume->FileSystem,
++                                                     &gMyEfiSimpleFileSystemProtocolGuid, &Volume->FileSystem,
+                                                      NULL);
+     if (EFI_ERROR(Status)) {
+  //       Print(L"Fsw ERROR: UninstallMultipleProtocolInterfaces returned %x\n", Status);
+@@ -450,7 +445,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Stop(IN  EFI_DRIVER_BINDING_PROTOCOL  *T
+ 
+     // close the consumed protocols
+     Status = refit_call4_wrapper(BS->CloseProtocol, ControllerHandle,
+-                               &gEfiDiskIoProtocolGuid,
++                               &gMyEfiDiskIoProtocolGuid,
+                                This->DriverBindingHandle,
+                                ControllerHandle);
+ 
+@@ -1027,14 +1022,14 @@ EFI_STATUS fsw_efi_dnode_getinfo(IN FSW_FILE_DATA *File,
+     struct fsw_volume_stat vsb;
+ 
+ 
+-    if (CompareGuid(InformationType, &gEfiFileInfoGuid)) {
++    if (CompareGuid(InformationType, &gMyEfiFileInfoGuid)) {
+ #if DEBUG_LEVEL
+         Print(L"fsw_efi_dnode_getinfo: FILE_INFO\n");
+ #endif
+ 
+         Status = fsw_efi_dnode_fill_FileInfo(Volume, File->shand.dnode, BufferSize, Buffer);
+ 
+-    } else if (CompareGuid(InformationType, &gEfiFileSystemInfoGuid)) {
++    } else if (CompareGuid(InformationType, &gMyEfiFileSystemInfoGuid)) {
+ #if DEBUG_LEVEL
+         Print(L"fsw_efi_dnode_getinfo: FILE_SYSTEM_INFO\n");
+ #endif
+@@ -1065,7 +1060,7 @@ EFI_STATUS fsw_efi_dnode_getinfo(IN FSW_FILE_DATA *File,
+         *BufferSize = RequiredSize;
+         Status = EFI_SUCCESS;
+ 
+-    } else if (CompareGuid(InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
++    } else if (CompareGuid(InformationType, &gMyEfiFileSystemVolumeLabelInfoIdGuid)) {
+ #if DEBUG_LEVEL
+         Print(L"fsw_efi_dnode_getinfo: FILE_SYSTEM_VOLUME_LABEL\n");
+ #endif
+diff --git a/filesystems/fsw_efi.h b/filesystems/fsw_efi.h
+index c3b7a3c..d9442ef 100644
+--- a/filesystems/fsw_efi.h
++++ b/filesystems/fsw_efi.h
+@@ -44,6 +44,16 @@
+ #define CompareGuid(a, b) CompareGuid(a, b)==0
+ #endif
+ 
++#define REFIND_EFI_DISK_IO_PROTOCOL_GUID \
++  { \
++    0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
++  }
++
++#define REFIND_EFI_BLOCK_IO_PROTOCOL_GUID \
++  { \
++    0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
++  }
++
+ /**
+  * EFI Host: Private per-volume structure.
+  */
+diff --git a/filesystems/scandisk.c b/filesystems/scandisk.c
+index d8b862a..ddd6908 100644
+--- a/filesystems/scandisk.c
++++ b/filesystems/scandisk.c
+@@ -24,8 +24,11 @@
+ #ifdef __MAKEWITH_GNUEFI
+ #include "edk2/DriverBinding.h"
+ #include "edk2/ComponentName.h"
+-extern EFI_GUID gEfiDiskIoProtocolGuid;
+-extern EFI_GUID gEfiBlockIoProtocolGuid;
++extern EFI_GUID gMyEfiDiskIoProtocolGuid;
++extern EFI_GUID gMyEfiBlockIoProtocolGuid;
++#else
++#define gMyEfiBlockIoProtocolGuid gEfiBlockIoProtocolGuid
++#define gMyEfiDiskIoProtocolGuid gEfiDiskIoProtocolGuid
+ #endif
+ #include "../include/refit_call_wrapper.h"
+ 
+@@ -99,16 +102,16 @@ static int scan_disks(int (*hook)(struct fsw_volume *, struct fsw_volume *), str
+     Print(L" ");
+ #endif
+     DPRINT(L"Scanning disks\n");
+-    Status = refit_call5_wrapper(BS->LocateHandleBuffer, ByProtocol, &gEfiDiskIoProtocolGuid, NULL, &HandleCount, &Handles);
++    Status = refit_call5_wrapper(BS->LocateHandleBuffer, ByProtocol, &gMyEfiDiskIoProtocolGuid, NULL, &HandleCount, &Handles);
+     if (Status == EFI_NOT_FOUND)
+         return -1;  // no filesystems. strange, but true...
+     for (i = 0; i < HandleCount; i++) {
+         EFI_DISK_IO *diskio;
+         EFI_BLOCK_IO *blockio;
+-        Status = refit_call3_wrapper(BS->HandleProtocol, Handles[i], &gEfiDiskIoProtocolGuid, (VOID **) &diskio);
++        Status = refit_call3_wrapper(BS->HandleProtocol, Handles[i], &gMyEfiDiskIoProtocolGuid, (VOID **) &diskio);
+         if (Status != 0)
+             continue;
+-        Status = refit_call3_wrapper(BS->HandleProtocol, Handles[i], &gEfiBlockIoProtocolGuid, (VOID **) &blockio);
++        Status = refit_call3_wrapper(BS->HandleProtocol, Handles[i], &gMyEfiBlockIoProtocolGuid, (VOID **) &blockio);
+         if (Status != 0)
+             continue;
+         struct fsw_volume *vol = create_dummy_volume(diskio, blockio->Media->MediaId);
+diff --git a/refind.conf-sample b/refind.conf-sample
+index 8b5853e..69cef8b 100644
+--- a/refind.conf-sample
++++ b/refind.conf-sample
+@@ -395,7 +395,7 @@ timeout 20
+ #default_selection Microsoft
+ #default_selection "+,bzImage,vmlinuz"
+ #default_selection Maintenance 23:30 2:00
+-#default_selection "Maintenance,OS X" 1:00 2:30
++#default_selection "Maintenance,macOS" 1:00 2:30
+ 
+ # Enable VMX bit and lock the CPU MSR if unlocked.
+ # On some Intel Apple computers, the firmware does not lock the MSR 0x3A.
+diff --git a/refind/driver_support.c b/refind/driver_support.c
+index 26c5965..8ab25ff 100644
+--- a/refind/driver_support.c
++++ b/refind/driver_support.c
+@@ -85,37 +85,34 @@
+ #define DRIVER_DIRS             L"drivers"
+ #endif
+ 
+-#ifdef __MAKEWITH_GNUEFI
+ // Following "global" constants are from EDK2's AutoGen.c....
+-EFI_GUID gEfiLoadedImageProtocolGuid = { 0x5B1B31A1, 0x9562, 0x11D2, { 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
+-EFI_GUID gEfiDriverBindingProtocolGuid = { 0x18A031AB, 0xB443, 0x4D1A, { 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71 }};
+-EFI_GUID gEfiDriverConfiguration2ProtocolGuid = { 0xBFD7DC1D, 0x24F1, 0x40D9, { 0x82, 0xE7, 0x2E, 0x09, 0xBB, 0x6B, 0x4E, 0xBE }};
+-EFI_GUID gEfiDriverConfigurationProtocolGuid = { 0x107A772B, 0xD5E1, 0x11D4, { 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
+-EFI_GUID gEfiDriverDiagnosticsProtocolGuid = { 0x0784924F, 0xE296, 0x11D4, { 0x9A, 0x49, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
+-EFI_GUID gEfiDriverDiagnostics2ProtocolGuid = { 0x4D330321, 0x025F, 0x4AAC, { 0x90, 0xD8, 0x5E, 0xD9, 0x00, 0x17, 0x3B, 0x63 }};
+-EFI_GUID gEfiComponentNameProtocolGuid = { 0x107A772C, 0xD5E1, 0x11D4, { 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
+-EFI_GUID gEfiComponentName2ProtocolGuid = { 0x6A7A5CFF, 0xE8D9, 0x4F70, { 0xBA, 0xDA, 0x75, 0xAB, 0x30, 0x25, 0xCE, 0x14 }};
+-EFI_GUID gEfiDevicePathProtocolGuid = { 0x09576E91, 0x6D3F, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
+-EFI_GUID gEfiDiskIoProtocolGuid = { 0xCE345171, 0xBA0B, 0x11D2, { 0x8E, 0x4F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
+-EFI_GUID gEfiBlockIoProtocolGuid = { 0x964E5B21, 0x6459, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
+-EFI_GUID gEfiSimpleFileSystemProtocolGuid = { 0x964E5B22, 0x6459, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
+-
+-struct EFI_SIMPLE_FILE_SYSTEM_PROTOCOL;
+-struct EFI_FILE_PROTOCOL;
++EFI_GUID gMyEfiLoadedImageProtocolGuid = { 0x5B1B31A1, 0x9562, 0x11D2, { 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
++EFI_GUID gMyEfiDriverBindingProtocolGuid = { 0x18A031AB, 0xB443, 0x4D1A, { 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71 }};
++EFI_GUID gMyEfiDriverConfigurationProtocolGuid = { 0x107A772B, 0xD5E1, 0x11D4, { 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
++EFI_GUID gMyEfiDriverDiagnosticsProtocolGuid = { 0x0784924F, 0xE296, 0x11D4, { 0x9A, 0x49, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
++EFI_GUID gMyEfiComponentNameProtocolGuid = { 0x107A772C, 0xD5E1, 0x11D4, { 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
++EFI_GUID gMyEfiDevicePathProtocolGuid = { 0x09576E91, 0x6D3F, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
++EFI_GUID gMyEfiDiskIoProtocolGuid = { 0xCE345171, 0xBA0B, 0x11D2, { 0x8E, 0x4F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
++EFI_GUID gMyEfiBlockIoProtocolGuid = { 0x964E5B21, 0x6459, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
++EFI_GUID gMyEfiSimpleFileSystemProtocolGuid = { 0x964E5B22, 0x6459, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
++
++#ifdef __MAKEWITH_GNUEFI
++struct MY_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL;
++struct MY_EFI_FILE_PROTOCOL;
+ 
+ typedef
+ EFI_STATUS
+-(EFIAPI *EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME)(
+-  IN struct EFI_SIMPLE_FILE_SYSTEM_PROTOCOL    *This,
+-  OUT struct EFI_FILE_PROTOCOL                 **Root
++(EFIAPI *MY_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME)(
++  IN struct MY_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL    *This,
++  OUT struct MY_EFI_FILE_PROTOCOL                 **Root
+   );
+ 
+-typedef struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL {
++typedef struct _MY_MY_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL {
+   UINT64                                      Revision;
+-  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME OpenVolume;
+-} EFI_SIMPLE_FILE_SYSTEM_PROTOCOL;
++  MY_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME OpenVolume;
++} MY_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL;
+ 
+-typedef struct _EFI_FILE_PROTOCOL {
++typedef struct _MY_EFI_FILE_PROTOCOL {
+   UINT64                Revision;
+   EFI_FILE_OPEN         Open;
+   EFI_FILE_CLOSE        Close;
+@@ -127,16 +124,20 @@ typedef struct _EFI_FILE_PROTOCOL {
+   EFI_FILE_GET_INFO     GetInfo;
+   EFI_FILE_SET_INFO     SetInfo;
+   EFI_FILE_FLUSH        Flush;
+-} EFI_FILE_PROTOCOL;
++} MY_EFI_FILE_PROTOCOL;
+ 
+-typedef struct _EFI_BLOCK_IO_PROTOCOL {
++typedef struct _MY_EFI_BLOCK_IO_PROTOCOL {
+   UINT64             Revision;
+   EFI_BLOCK_IO_MEDIA *Media;
+   EFI_BLOCK_RESET    Reset;
+   EFI_BLOCK_READ     ReadBlocks;
+   EFI_BLOCK_WRITE    WriteBlocks;
+   EFI_BLOCK_FLUSH    FlushBlocks;
+-} EFI_BLOCK_IO_PROTOCOL;
++} MY_EFI_BLOCK_IO_PROTOCOL;
++#else /* Make with Tianocore */
++#define MY_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
++#define MY_EFI_FILE_PROTOCOL EFI_FILE_PROTOCOL
++#define MY_EFI_BLOCK_IO_PROTOCOL EFI_BLOCK_IO_PROTOCOL
+ #endif
+ 
+ /* LibScanHandleDatabase() is used by rEFInd's driver-loading code (inherited
+@@ -232,27 +233,27 @@ LibScanHandleDatabase (EFI_HANDLE  DriverBindingHandle, OPTIONAL
+ 
+       for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {
+ 
+-        if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiLoadedImageProtocolGuid) == 0) {
++        if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gMyEfiLoadedImageProtocolGuid) == 0) {
+           (*HandleType)[HandleIndex] |= EFI_HANDLE_TYPE_IMAGE_HANDLE;
+         }
+ 
+-        if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverBindingProtocolGuid) == 0) {
++        if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gMyEfiDriverBindingProtocolGuid) == 0) {
+           (*HandleType)[HandleIndex] |= EFI_HANDLE_TYPE_DRIVER_BINDING_HANDLE;
+         }
+ 
+-        if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverConfigurationProtocolGuid) == 0) {
++        if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gMyEfiDriverConfigurationProtocolGuid) == 0) {
+           (*HandleType)[HandleIndex] |= EFI_HANDLE_TYPE_DRIVER_CONFIGURATION_HANDLE;
+         }
+ 
+-        if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverDiagnosticsProtocolGuid) == 0) {
++        if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gMyEfiDriverDiagnosticsProtocolGuid) == 0) {
+           (*HandleType)[HandleIndex] |= EFI_HANDLE_TYPE_DRIVER_DIAGNOSTICS_HANDLE;
+         }
+ 
+-        if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiComponentNameProtocolGuid) == 0) {
++        if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gMyEfiComponentNameProtocolGuid) == 0) {
+           (*HandleType)[HandleIndex] |= EFI_HANDLE_TYPE_COMPONENT_NAME_HANDLE;
+         }
+ 
+-        if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDevicePathProtocolGuid) == 0) {
++        if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gMyEfiDevicePathProtocolGuid) == 0) {
+           (*HandleType)[HandleIndex] |= EFI_HANDLE_TYPE_DEVICE_HANDLE;
+         }
+         //
+@@ -453,8 +454,8 @@ VOID ConnectFilesystemDriver(EFI_HANDLE DriverHandle) {
+     UINTN                                 Index;
+     UINTN                                 OpenInfoIndex;
+     EFI_HANDLE                            *Handles = NULL;
+-    EFI_SIMPLE_FILE_SYSTEM_PROTOCOL       *Fs;
+-    EFI_BLOCK_IO_PROTOCOL                 *BlockIo;
++    MY_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL       *Fs;
++    MY_EFI_BLOCK_IO_PROTOCOL                 *BlockIo;
+     EFI_OPEN_PROTOCOL_INFORMATION_ENTRY   *OpenInfo;
+     UINTN                                 OpenInfoCount;
+     EFI_HANDLE                            DriverHandleList[2];
+@@ -464,7 +465,7 @@ VOID ConnectFilesystemDriver(EFI_HANDLE DriverHandle) {
+     //
+     Status = refit_call5_wrapper(gBS->LocateHandleBuffer,
+                                  ByProtocol,
+-                                 &gEfiDiskIoProtocolGuid,
++                                 &gMyEfiDiskIoProtocolGuid,
+                                  NULL,
+                                  &HandleCount,
+                                  &Handles);
+@@ -483,7 +484,7 @@ VOID ConnectFilesystemDriver(EFI_HANDLE DriverHandle) {
+         //
+         Status = refit_call3_wrapper(gBS->HandleProtocol,
+                                      Handles[Index],
+-                                     &gEfiBlockIoProtocolGuid,
++                                     &gMyEfiBlockIoProtocolGuid,
+                                      (VOID **) &BlockIo);
+         if (EFI_ERROR (Status))
+             continue;
+@@ -494,9 +495,9 @@ VOID ConnectFilesystemDriver(EFI_HANDLE DriverHandle) {
+         // If SimpleFileSystem is already produced - skip it, this is ok
+         //
+         Status = refit_call3_wrapper(gBS->HandleProtocol,
+-                                    Handles[Index],
+-                                    &gEfiSimpleFileSystemProtocolGuid,
+-                                    (VOID **) &Fs);
++                                     Handles[Index],
++                                     &gMyEfiSimpleFileSystemProtocolGuid,
++                                     (VOID **) &Fs);
+         if (Status == EFI_SUCCESS)
+             continue;
+ 
+@@ -506,7 +507,7 @@ VOID ConnectFilesystemDriver(EFI_HANDLE DriverHandle) {
+         //
+         Status = refit_call4_wrapper(gBS->OpenProtocolInformation,
+                                      Handles[Index],
+-                                     &gEfiDiskIoProtocolGuid,
++                                     &gMyEfiDiskIoProtocolGuid,
+                                      &OpenInfo,
+                                      &OpenInfoCount);
+         if (EFI_ERROR (Status))
+diff --git a/refind/legacy.c b/refind/legacy.c
+index aead421..cd4ee9b 100644
+--- a/refind/legacy.c
++++ b/refind/legacy.c
+@@ -76,6 +76,8 @@ extern REFIT_MENU_SCREEN MainMenu;
+ #define DevicePathProtocol gEfiDevicePathProtocolGuid
+ #endif
+ 
++EFI_GUID EfiGlobalVariableGuid = { 0x8BE4DF61, 0x93CA, 0x11D2, { 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C }};
++
+ static EFI_STATUS ActivateMbrPartition(IN EFI_BLOCK_IO *BlockIO, IN UINTN PartitionIndex)
+ {
+     EFI_STATUS          Status;
+@@ -538,7 +540,7 @@ static VOID ScanLegacyUEFI(IN UINTN DiskType)
+     } // if
+ 
+     // Grab the boot order
+-    BootOrder = BdsLibGetVariableAndSize(L"BootOrder", &gEfiGlobalVariableGuid, &BootOrderSize);
++    BootOrder = BdsLibGetVariableAndSize(L"BootOrder", &EfiGlobalVariableGuid, &BootOrderSize);
+     if (BootOrder == NULL) {
+         BootOrderSize = 0;
+     }
+-- 
+2.13.0
+
similarity index 98%
rename from sys-boot/refind/refind-0.10.7.ebuild
rename to sys-boot/refind/refind-0.10.7-r1.ebuild
index 044b7ed7c12e755f90fe76b95e63e8e46e05b15f..b77f6fc42e80bd24355c5d2251de7d883b0647ab 100644 (file)
@@ -54,6 +54,9 @@ pkg_setup() {
 src_prepare() {
        default
 
+       # bug 616668 - build fails against gnu-efi-3.0.5
+       eapply "${FILESDIR}"/"${PF}"-fix_build_gnuefi-3.0.5.patch
+
        # bug 598647 - PIE not supported
        sed -e 's:CFLAGS          =:& -fno-PIE:' -i "${S}/Make.common" || die