From 7c4e72babf0b6675281208334313aba4c40dd914 Mon Sep 17 00:00:00 2001 From: Sam Jorna Date: Mon, 15 May 2017 15:11:28 +1000 Subject: sys-boot/refind: fix build against gnu-efi-3.0.5 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 --- .../refind-0.10.7-fix_build_gnuefi-3.0.5.patch | 1387 ++++++++++++++++++++ sys-boot/refind/refind-0.10.7-r1.ebuild | 200 +++ sys-boot/refind/refind-0.10.7.ebuild | 197 --- 3 files changed, 1587 insertions(+), 197 deletions(-) create mode 100644 sys-boot/refind/files/refind-0.10.7-fix_build_gnuefi-3.0.5.patch create mode 100644 sys-boot/refind/refind-0.10.7-r1.ebuild delete mode 100644 sys-boot/refind/refind-0.10.7.ebuild (limited to 'sys-boot/refind') 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 index 000000000000..5320241acb00 --- /dev/null +++ b/sys-boot/refind/files/refind-0.10.7-fix_build_gnuefi-3.0.5.patch @@ -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. + + CHAR16 * + EFIAPI +-CatPrint ( ++MyCatPrint ( + IN OUT POOL_PRINT *Str, + IN CHAR16 *Fmt, + ... +@@ -94,7 +94,7 @@ DevPathPci ( + PCI_DEVICE_PATH *Pci; + + Pci = DevPath; +- CatPrint (Str, L"Pci(%x|%x)", (UINTN) Pci->Device, (UINTN) Pci->Function); ++ MyCatPrint (Str, L"Pci(%x|%x)", (UINTN) Pci->Device, (UINTN) Pci->Function); + } + + /** +@@ -116,7 +116,7 @@ DevPathPccard ( + PCCARD_DEVICE_PATH *Pccard; + + Pccard = DevPath; +- CatPrint (Str, L"Pcmcia(Function%x)", (UINTN) Pccard->FunctionNumber); ++ MyCatPrint (Str, L"Pcmcia(Function%x)", (UINTN) Pccard->FunctionNumber); + } + + /** +@@ -138,7 +138,7 @@ DevPathMemMap ( + MEMMAP_DEVICE_PATH *MemMap; + + MemMap = DevPath; +- CatPrint ( ++ MyCatPrint ( + Str, + L"MemMap(%d:%lx-%lx)", + (UINTN) MemMap->MemoryType, +@@ -166,7 +166,7 @@ DevPathController ( + CONTROLLER_DEVICE_PATH *Controller; + + Controller = DevPath; +- CatPrint (Str, L"Ctrl(%d)", (UINTN) Controller->ControllerNumber); ++ MyCatPrint (Str, L"Ctrl(%d)", (UINTN) Controller->ControllerNumber); + } + + +@@ -202,30 +202,30 @@ DevPathVendor ( + Type = L"Msg"; + /* + if (CompareGuid (&Vendor->Guid, &gEfiPcAnsiGuid)) { +- CatPrint (Str, L"VenPcAnsi()"); ++ MyCatPrint (Str, L"VenPcAnsi()"); + return ; + } else if (CompareGuid (&Vendor->Guid, &gEfiVT100Guid)) { +- CatPrint (Str, L"VenVt100()"); ++ MyCatPrint (Str, L"VenVt100()"); + return ; + } else if (CompareGuid (&Vendor->Guid, &gEfiVT100PlusGuid)) { +- CatPrint (Str, L"VenVt100Plus()"); ++ MyCatPrint (Str, L"VenVt100Plus()"); + return ; + } else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) { +- CatPrint (Str, L"VenUft8()"); ++ MyCatPrint (Str, L"VenUft8()"); + return ; + } else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid )) { + FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *) Vendor)->FlowControlMap); + switch (FlowControlMap & 0x00000003) { + case 0: +- CatPrint (Str, L"UartFlowCtrl(%s)", L"None"); ++ MyCatPrint (Str, L"UartFlowCtrl(%s)", L"None"); + break; + + case 1: +- CatPrint (Str, L"UartFlowCtrl(%s)", L"Hardware"); ++ MyCatPrint (Str, L"UartFlowCtrl(%s)", L"Hardware"); + break; + + case 2: +- CatPrint (Str, L"UartFlowCtrl(%s)", L"XonXoff"); ++ MyCatPrint (Str, L"UartFlowCtrl(%s)", L"XonXoff"); + break; + + default: +@@ -237,7 +237,7 @@ DevPathVendor ( + } else + */ + if (CompareGuid (&Vendor->Guid, &gEfiSasDevicePathGuid)) { +- CatPrint ( ++ MyCatPrint ( + Str, + L"SAS(%lx,%lx,%x,", + ((SAS_DEVICE_PATH *) Vendor)->SasAddress, +@@ -246,9 +246,9 @@ DevPathVendor ( + ); + Info = (((SAS_DEVICE_PATH *) Vendor)->DeviceTopology); + if ((Info & 0x0f) == 0) { +- CatPrint (Str, L"NoTopology,0,0,0,"); ++ MyCatPrint (Str, L"NoTopology,0,0,0,"); + } else if (((Info & 0x0f) == 1) || ((Info & 0x0f) == 2)) { +- CatPrint ( ++ MyCatPrint ( + Str, + L"%s,%s,%s,", + ((Info & (0x1 << 4)) != 0) ? L"SATA" : L"SAS", +@@ -256,19 +256,19 @@ DevPathVendor ( + ((Info & (0x1 << 6)) != 0) ? L"Expanded" : L"Direct" + ); + if ((Info & 0x0f) == 1) { +- CatPrint (Str, L"0,"); ++ MyCatPrint (Str, L"0,"); + } else { +- CatPrint (Str, L"%x,", (UINTN) ((Info >> 8) & 0xff)); ++ MyCatPrint (Str, L"%x,", (UINTN) ((Info >> 8) & 0xff)); + } + } else { +- CatPrint (Str, L"0,0,0,0,"); ++ MyCatPrint (Str, L"0,0,0,0,"); + } + +- CatPrint (Str, L"%x)", (UINTN) ((SAS_DEVICE_PATH *) Vendor)->Reserved); ++ MyCatPrint (Str, L"%x)", (UINTN) ((SAS_DEVICE_PATH *) Vendor)->Reserved); + return ; + + } else if (CompareGuid (&Vendor->Guid, &gEfiDebugPortProtocolGuid)) { +- CatPrint (Str, L"DebugPort()"); ++ MyCatPrint (Str, L"DebugPort()"); + return ; + } + break; +@@ -282,15 +282,15 @@ DevPathVendor ( + break; + } + +- CatPrint (Str, L"Ven%s(%g", Type, &Vendor->Guid); ++ MyCatPrint (Str, L"Ven%s(%g", Type, &Vendor->Guid); + DataLength = DevicePathNodeLength (&Vendor->Header) - sizeof (VENDOR_DEVICE_PATH); + if (DataLength > 0) { +- CatPrint (Str, L","); ++ MyCatPrint (Str, L","); + for (Index = 0; Index < DataLength; Index++) { +- CatPrint (Str, L"%02x", (UINTN) ((VENDOR_DEVICE_PATH_WITH_DATA *) Vendor)->VendorDefinedData[Index]); ++ MyCatPrint (Str, L"%02x", (UINTN) ((VENDOR_DEVICE_PATH_WITH_DATA *) Vendor)->VendorDefinedData[Index]); + } + } +- CatPrint (Str, L")"); ++ MyCatPrint (Str, L")"); + } + + /** +@@ -313,9 +313,9 @@ DevPathAcpi ( + + Acpi = DevPath; + if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) { +- CatPrint (Str, L"Acpi(PNP%04x,%x)", (UINTN) EISA_ID_TO_NUM (Acpi->HID), (UINTN) Acpi->UID); ++ MyCatPrint (Str, L"Acpi(PNP%04x,%x)", (UINTN) EISA_ID_TO_NUM (Acpi->HID), (UINTN) Acpi->UID); + } else { +- CatPrint (Str, L"Acpi(%08x,%x)", (UINTN) Acpi->HID, (UINTN) Acpi->UID); ++ MyCatPrint (Str, L"Acpi(%08x,%x)", (UINTN) Acpi->HID, (UINTN) Acpi->UID); + } + } + +@@ -388,50 +388,50 @@ DevPathExtendedAcpi ( + } + + if (HIDSTRIdx == 0 && CIDSTRIdx == 0 && ExtendedAcpi->UID == 0) { +- CatPrint (Str, L"AcpiExp("); ++ MyCatPrint (Str, L"AcpiExp("); + if ((ExtendedAcpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) { +- CatPrint (Str, L"PNP%04x,", (UINTN) EISA_ID_TO_NUM (ExtendedAcpi->HID)); ++ MyCatPrint (Str, L"PNP%04x,", (UINTN) EISA_ID_TO_NUM (ExtendedAcpi->HID)); + } else { +- CatPrint (Str, L"%08x,", (UINTN) ExtendedAcpi->HID); ++ MyCatPrint (Str, L"%08x,", (UINTN) ExtendedAcpi->HID); + } + if ((ExtendedAcpi->CID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) { +- CatPrint (Str, L"PNP%04x,", (UINTN) EISA_ID_TO_NUM (ExtendedAcpi->CID)); ++ MyCatPrint (Str, L"PNP%04x,", (UINTN) EISA_ID_TO_NUM (ExtendedAcpi->CID)); + } else { +- CatPrint (Str, L"%08x,", (UINTN) ExtendedAcpi->CID); ++ MyCatPrint (Str, L"%08x,", (UINTN) ExtendedAcpi->CID); + } + if (UIDSTRIdx != 0) { +- CatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx); ++ MyCatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx); + } else { +- CatPrint (Str, L"\"\")"); ++ MyCatPrint (Str, L"\"\")"); + } + } else { +- CatPrint (Str, L"AcpiEx("); ++ MyCatPrint (Str, L"AcpiEx("); + if ((ExtendedAcpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) { +- CatPrint (Str, L"PNP%04x,", (UINTN) EISA_ID_TO_NUM (ExtendedAcpi->HID)); ++ MyCatPrint (Str, L"PNP%04x,", (UINTN) EISA_ID_TO_NUM (ExtendedAcpi->HID)); + } else { +- CatPrint (Str, L"%08x,", (UINTN) ExtendedAcpi->HID); ++ MyCatPrint (Str, L"%08x,", (UINTN) ExtendedAcpi->HID); + } + if ((ExtendedAcpi->CID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) { +- CatPrint (Str, L"PNP%04x,", (UINTN) EISA_ID_TO_NUM (ExtendedAcpi->CID)); ++ MyCatPrint (Str, L"PNP%04x,", (UINTN) EISA_ID_TO_NUM (ExtendedAcpi->CID)); + } else { +- CatPrint (Str, L"%08x,", (UINTN) ExtendedAcpi->CID); ++ MyCatPrint (Str, L"%08x,", (UINTN) ExtendedAcpi->CID); + } +- CatPrint (Str, L"%x,", (UINTN) ExtendedAcpi->UID); ++ MyCatPrint (Str, L"%x,", (UINTN) ExtendedAcpi->UID); + + if (HIDSTRIdx != 0) { +- CatPrint (Str, L"%a,", AsChar8Array + HIDSTRIdx); ++ MyCatPrint (Str, L"%a,", AsChar8Array + HIDSTRIdx); + } else { +- CatPrint (Str, L"\"\","); ++ MyCatPrint (Str, L"\"\","); + } + if (CIDSTRIdx != 0) { +- CatPrint (Str, L"%a,", AsChar8Array + CIDSTRIdx); ++ MyCatPrint (Str, L"%a,", AsChar8Array + CIDSTRIdx); + } else { +- CatPrint (Str, L"\"\","); ++ MyCatPrint (Str, L"\"\","); + } + if (UIDSTRIdx != 0) { +- CatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx); ++ MyCatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx); + } else { +- CatPrint (Str, L"\"\")"); ++ MyCatPrint (Str, L"\"\")"); + } + } + +@@ -462,11 +462,11 @@ DevPathAdrAcpi ( + Length = (UINT16) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) AcpiAdr); + AdditionalAdrCount = (UINT16) ((Length - 8) / 4); + +- CatPrint (Str, L"AcpiAdr(%x", (UINTN) AcpiAdr->ADR); ++ MyCatPrint (Str, L"AcpiAdr(%x", (UINTN) AcpiAdr->ADR); + for (Index = 0; Index < AdditionalAdrCount; Index++) { +- CatPrint (Str, L",%x", (UINTN) *(UINT32 *) ((UINT8 *) AcpiAdr + 8 + Index * 4)); ++ MyCatPrint (Str, L",%x", (UINTN) *(UINT32 *) ((UINT8 *) AcpiAdr + 8 + Index * 4)); + } +- CatPrint (Str, L")"); ++ MyCatPrint (Str, L")"); + } + + /** +@@ -488,7 +488,7 @@ DevPathAtapi ( + ATAPI_DEVICE_PATH *Atapi; + + Atapi = DevPath; +- CatPrint ( ++ MyCatPrint ( + Str, + L"Ata(%s,%s)", + (Atapi->PrimarySecondary != 0)? L"Secondary" : L"Primary", +@@ -515,7 +515,7 @@ DevPathScsi ( + SCSI_DEVICE_PATH *Scsi; + + Scsi = DevPath; +- CatPrint (Str, L"Scsi(Pun%x,Lun%x)", (UINTN) Scsi->Pun, (UINTN) Scsi->Lun); ++ MyCatPrint (Str, L"Scsi(Pun%x,Lun%x)", (UINTN) Scsi->Pun, (UINTN) Scsi->Lun); + } + + /** +@@ -537,7 +537,7 @@ DevPathFibre ( + FIBRECHANNEL_DEVICE_PATH *Fibre; + + Fibre = DevPath; +- CatPrint (Str, L"Fibre(Wwn%lx,Lun%x)", Fibre->WWN, Fibre->Lun); ++ MyCatPrint (Str, L"Fibre(Wwn%lx,Lun%x)", Fibre->WWN, Fibre->Lun); + } + + /** +@@ -559,7 +559,7 @@ DevPath1394 ( + F1394_DEVICE_PATH *F1394Path; + + F1394Path = DevPath; +- CatPrint (Str, L"1394(%lx)", &F1394Path->Guid); ++ MyCatPrint (Str, L"1394(%lx)", &F1394Path->Guid); + } + + /** +@@ -581,7 +581,7 @@ DevPathUsb ( + USB_DEVICE_PATH *Usb; + + Usb = DevPath; +- CatPrint (Str, L"Usb(%x,%x)", (UINTN) Usb->ParentPortNumber, (UINTN) Usb->InterfaceNumber); ++ MyCatPrint (Str, L"Usb(%x,%x)", (UINTN) Usb->ParentPortNumber, (UINTN) Usb->InterfaceNumber); + } + + /** +@@ -603,7 +603,7 @@ DevPathUsbWWID ( + USB_WWID_DEVICE_PATH *UsbWWId; + + UsbWWId = DevPath; +- CatPrint ( ++ MyCatPrint ( + Str, + L"UsbWwid(%x,%x,%x,\"WWID\")", + (UINTN) UsbWWId->VendorId, +@@ -631,7 +631,7 @@ DevPathLogicalUnit ( + DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit; + + LogicalUnit = DevPath; +- CatPrint (Str, L"Unit(%x)", (UINTN) LogicalUnit->Lun); ++ MyCatPrint (Str, L"Unit(%x)", (UINTN) LogicalUnit->Lun); + } + + /** +@@ -653,7 +653,7 @@ DevPathUsbClass ( + USB_CLASS_DEVICE_PATH *UsbClass; + + UsbClass = DevPath; +- CatPrint ( ++ MyCatPrint ( + Str, + L"Usb Class(%x,%x,%x,%x,%x)", + (UINTN) UsbClass->VendorId, +@@ -684,14 +684,14 @@ DevPathSata ( + + Sata = DevPath; + if ((Sata->PortMultiplierPortNumber & SATA_HBA_DIRECT_CONNECT_FLAG) != 0) { +- CatPrint ( ++ MyCatPrint ( + Str, + L"Sata(%x,%x)", + (UINTN) Sata->HBAPortNumber, + (UINTN) Sata->Lun + ); + } else { +- CatPrint ( ++ MyCatPrint ( + Str, + L"Sata(%x,%x,%x)", + (UINTN) Sata->HBAPortNumber, +@@ -720,7 +720,7 @@ DevPathI2O ( + I2O_DEVICE_PATH *I2OPath; + + I2OPath = DevPath; +- CatPrint (Str, L"I2O(%x)", (UINTN) I2OPath->Tid); ++ MyCatPrint (Str, L"I2O(%x)", (UINTN) I2OPath->Tid); + } + + /** +@@ -750,13 +750,13 @@ DevPathMacAddr ( + HwAddressSize = 6; + } + +- CatPrint (Str, L"Mac("); ++ MyCatPrint (Str, L"Mac("); + + for (Index = 0; Index < HwAddressSize; Index++) { +- CatPrint (Str, L"%02x", (UINTN) MACDevPath->MacAddress.Addr[Index]); ++ MyCatPrint (Str, L"%02x", (UINTN) MACDevPath->MacAddress.Addr[Index]); + } + +- CatPrint (Str, L")"); ++ MyCatPrint (Str, L")"); + } + + /** +@@ -778,7 +778,7 @@ DevPathIPv4 ( + IPv4_DEVICE_PATH *IPDevPath; + + IPDevPath = DevPath; +- CatPrint ( ++ MyCatPrint ( + Str, + L"IPv4(%d.%d.%d.%d:%d)", + (UINTN) IPDevPath->RemoteIpAddress.Addr[0], +@@ -808,7 +808,7 @@ DevPathIPv6 ( + IPv6_DEVICE_PATH *IPv6DevPath; + + IPv6DevPath = DevPath; +- CatPrint ( ++ MyCatPrint ( + Str, + L"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)", + (UINTN) IPv6DevPath->RemoteIpAddress.Addr[0], +@@ -849,7 +849,7 @@ DevPathInfiniBand ( + INFINIBAND_DEVICE_PATH *InfiniBand; + + InfiniBand = DevPath; +- CatPrint ( ++ MyCatPrint ( + Str, + L"Infiniband(%x,%g,%lx,%lx,%lx)", + (UINTN) InfiniBand->ResourceFlags, +@@ -911,36 +911,36 @@ DevPathUart ( + } + + if (Uart->BaudRate == 0) { +- CatPrint (Str, L"Uart(DEFAULT,%c,", Parity); ++ MyCatPrint (Str, L"Uart(DEFAULT,%c,", Parity); + } else { +- CatPrint (Str, L"Uart(%ld,%c,", Uart->BaudRate, Parity); ++ MyCatPrint (Str, L"Uart(%ld,%c,", Uart->BaudRate, Parity); + } + + if (Uart->DataBits == 0) { +- CatPrint (Str, L"D,"); ++ MyCatPrint (Str, L"D,"); + } else { +- CatPrint (Str, L"%d,", (UINTN) Uart->DataBits); ++ MyCatPrint (Str, L"%d,", (UINTN) Uart->DataBits); + } + + switch (Uart->StopBits) { + case 0: +- CatPrint (Str, L"D)"); ++ MyCatPrint (Str, L"D)"); + break; + + case 1: +- CatPrint (Str, L"1)"); ++ MyCatPrint (Str, L"1)"); + break; + + case 2: +- CatPrint (Str, L"1.5)"); ++ MyCatPrint (Str, L"1.5)"); + break; + + case 3: +- CatPrint (Str, L"2)"); ++ MyCatPrint (Str, L"2)"); + break; + + default: +- CatPrint (Str, L"x)"); ++ MyCatPrint (Str, L"x)"); + break; + } + } +@@ -965,7 +965,7 @@ DevPathiSCSI ( + UINT16 Options; + + IScsi = DevPath; +- CatPrint ( ++ MyCatPrint ( + Str, + L"iSCSI(%a,%x,%lx,", + IScsi->TargetName, +@@ -974,18 +974,18 @@ DevPathiSCSI ( + ); + + Options = IScsi->LoginOption; +- CatPrint (Str, L"%s,", (((Options >> 1) & 0x0001) != 0) ? L"CRC32C" : L"None"); +- CatPrint (Str, L"%s,", (((Options >> 3) & 0x0001) != 0) ? L"CRC32C" : L"None"); ++ MyCatPrint (Str, L"%s,", (((Options >> 1) & 0x0001) != 0) ? L"CRC32C" : L"None"); ++ MyCatPrint (Str, L"%s,", (((Options >> 3) & 0x0001) != 0) ? L"CRC32C" : L"None"); + if (((Options >> 11) & 0x0001) != 0) { +- CatPrint (Str, L"%s,", L"None"); ++ MyCatPrint (Str, L"%s,", L"None"); + } else if (((Options >> 12) & 0x0001) != 0) { +- CatPrint (Str, L"%s,", L"CHAP_UNI"); ++ MyCatPrint (Str, L"%s,", L"CHAP_UNI"); + } else { +- CatPrint (Str, L"%s,", L"CHAP_BI"); ++ MyCatPrint (Str, L"%s,", L"CHAP_BI"); + + } + +- CatPrint (Str, L"%s)", (IScsi->NetworkProtocol == 0) ? L"TCP" : L"reserved"); ++ MyCatPrint (Str, L"%s)", (IScsi->NetworkProtocol == 0) ? L"TCP" : L"reserved"); + } + + /** +@@ -1007,7 +1007,7 @@ DevPathVlan ( + VLAN_DEVICE_PATH *Vlan; + + Vlan = DevPath; +- CatPrint (Str, L"Vlan(%d)", (UINTN) Vlan->VlanId); ++ MyCatPrint (Str, L"Vlan(%d)", (UINTN) Vlan->VlanId); + } + + /** +@@ -1031,7 +1031,7 @@ DevPathHardDrive ( + Hd = DevPath; + switch (Hd->SignatureType) { + case SIGNATURE_TYPE_MBR: +- CatPrint ( ++ MyCatPrint ( + Str, + L"HD(Part%d,Sig%08x)", + (UINTN) Hd->PartitionNumber, +@@ -1040,7 +1040,7 @@ DevPathHardDrive ( + break; + + case SIGNATURE_TYPE_GUID: +- CatPrint ( ++ MyCatPrint ( + Str, + L"HD(Part%d,Sig%g)", + (UINTN) Hd->PartitionNumber, +@@ -1049,7 +1049,7 @@ DevPathHardDrive ( + break; + + default: +- CatPrint ( ++ MyCatPrint ( + Str, + L"HD(Part%d,MBRType=%02x,SigType=%02x)", + (UINTN) Hd->PartitionNumber, +@@ -1079,7 +1079,7 @@ DevPathCDROM ( + CDROM_DEVICE_PATH *Cd; + + Cd = DevPath; +- CatPrint (Str, L"CDROM(Entry%x)", (UINTN) Cd->BootEntry); ++ MyCatPrint (Str, L"CDROM(Entry%x)", (UINTN) Cd->BootEntry); + } + + /** +@@ -1101,7 +1101,7 @@ DevPathFilePath ( + FILEPATH_DEVICE_PATH *Fp; + + Fp = DevPath; +- CatPrint (Str, L"%s", Fp->PathName); ++ MyCatPrint (Str, L"%s", Fp->PathName); + } + + /** +@@ -1123,7 +1123,7 @@ DevPathMediaProtocol ( + MEDIA_PROTOCOL_DEVICE_PATH *MediaProt; + + MediaProt = DevPath; +- CatPrint (Str, L"Media(%g)", &MediaProt->Protocol); ++ MyCatPrint (Str, L"Media(%g)", &MediaProt->Protocol); + } + + /** +@@ -1145,7 +1145,7 @@ DevPathFvFilePath ( + MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFilePath; + + FvFilePath = DevPath; +- CatPrint (Str, L"%g", &FvFilePath->FvFileName); ++ MyCatPrint (Str, L"%g", &FvFilePath->FvFileName); + } + + /** +@@ -1167,7 +1167,7 @@ MyDevPathRelativeOffsetRange ( + MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset; + + Offset = DevPath; +- CatPrint ( ++ MyCatPrint ( + Str, + L"Offset(%lx,%lx)", + Offset->StartingOffset, +@@ -1228,7 +1228,7 @@ DevPathBssBss ( + Type = L"?"; + break; + } +- CatPrint (Str, L"Legacy-%s", Type); ++ MyCatPrint (Str, L"Legacy-%s", Type); + } + + /** +@@ -1247,7 +1247,7 @@ DevPathEndInstance ( + IN VOID *DevPath + ) + { +- CatPrint (Str, L","); ++ MyCatPrint (Str, L","); + } + + /** +@@ -1266,7 +1266,7 @@ DevPathNodeUnknown ( + IN VOID *DevPath + ) + { +- CatPrint (Str, L"?"); ++ MyCatPrint (Str, L"?"); + } + /** + Convert Device Path to a Unicode string for printing. +@@ -1287,7 +1287,7 @@ DevPathFvPath ( + MEDIA_FW_VOL_DEVICE_PATH *FvPath; + + FvPath = DevPath; +- CatPrint (Str, L"Fv(%g)", &FvPath->FvName); ++ MyCatPrint (Str, L"Fv(%g)", &FvPath->FvName); + } + + DEVICE_PATH_STRING_TABLE DevPathTable[] = { +@@ -1553,7 +1553,7 @@ DevicePathToStr ( + // Put a path seperator in if needed + // + if ((Str.Len != 0) && (DumpNode != DevPathEndInstance)) { +- CatPrint (&Str, L"/"); ++ MyCatPrint (&Str, L"/"); + } + // + // Print this node of the device path +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. + + **/ +-// EFI_STATUS +-// EFIAPI +-// BdsLibUserIdentify ( +-// OUT EFI_USER_PROFILE_HANDLE *User +-// ); + + /** + This function checks if a Fv file device path is valid, according to a file GUID. If it is invalid, +@@ -961,7 +956,7 @@ DevPathVendor ( + + CHAR16 * + EFIAPI +-CatPrint ( ++MyCatPrint ( + IN OUT POOL_PRINT *Str, + IN CHAR16 *Fmt, + ... +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 + + --*/ + ++/* ++ * rEFInd NOTE: This file is included only when compiling with GNU-EFI, ++ * which has not traditionally provided the definitions supplied here. ++ * Unfortunately, recent (ca. 3.0.5) versions of GNU-EFI have added ++ * SOME of these functions to an existing header file, creating problems ++ * when trying to maintain compatibility with multiple GNU-EFI versions. ++ * I've therefore renamed the relevant defines, types, and functions, ++ * both here and in fsw_efi.c; and included a define to match the only ++ * used name (REFIND_EFI_DRIVER_BINDING_PROTOCOL) to the traditional ++ * name (EFI_DRIVER_BINDING_PROTOCOL) in fsw_efi.c for compiling with ++ * TianoCore. ++ */ ++ + #ifndef _EFI_DRIVER_BINDING_H_ + #define _EFI_DRIVER_BINDING_H_ + + #include + +-// +-// Global ID for the ControllerHandle Driver Protocol +-// +-#define EFI_DRIVER_BINDING_PROTOCOL_GUID \ ++#define REFIND_EFI_DRIVER_BINDING_PROTOCOL_GUID \ + { \ + 0x18a031ab, 0xb443, 0x4d1a, {0xa5, 0xc0, 0xc, 0x9, 0x26, 0x1e, 0x9f, 0x71} \ + } + + #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x + +-EFI_FORWARD_DECLARATION (EFI_DRIVER_BINDING_PROTOCOL); +- +-/// +-/// Device Path protocol. +-/// +-#define EFI_DEVICE_PATH_PROTOCOL_GUID \ +- { \ +- 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ +- } ++EFI_FORWARD_DECLARATION (REFIND_EFI_DRIVER_BINDING_PROTOCOL); + + // Begin included from DevicePath.h.... + +@@ -79,18 +81,19 @@ typedef struct { + UINT8 Length[2]; ///< Specific Device Path data. Type and Sub-Type define + ///< type of data. Size of data is included in Length. + +-} EFI_DEVICE_PATH_PROTOCOL; ++} REFIND_EFI_DEVICE_PATH_PROTOCOL; + + #pragma pack() + ++ + // End included from DevicePath.h + + typedef + EFI_STATUS + (EFI_FUNCTION EFIAPI *EFI_DRIVER_BINDING_SUPPORTED) ( +- IN EFI_DRIVER_BINDING_PROTOCOL * This, ++ IN REFIND_EFI_DRIVER_BINDING_PROTOCOL * This, + IN EFI_HANDLE ControllerHandle, +- IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL ++ IN REFIND_EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL + ) + /*++ + +@@ -114,9 +117,9 @@ EFI_STATUS + typedef + EFI_STATUS + (EFI_FUNCTION EFIAPI *EFI_DRIVER_BINDING_START) ( +- IN EFI_DRIVER_BINDING_PROTOCOL * This, ++ IN REFIND_EFI_DRIVER_BINDING_PROTOCOL * This, + IN EFI_HANDLE ControllerHandle, +- IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL ++ IN REFIND_EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL + ) + /*++ + +@@ -140,7 +143,7 @@ EFI_STATUS + typedef + EFI_STATUS + (EFI_FUNCTION EFIAPI *EFI_DRIVER_BINDING_STOP) ( +- IN EFI_DRIVER_BINDING_PROTOCOL * This, ++ IN REFIND_EFI_DRIVER_BINDING_PROTOCOL * This, + IN EFI_HANDLE ControllerHandle, + IN UINTN NumberOfChildren, + IN EFI_HANDLE * ChildHandleBuffer +@@ -167,7 +170,7 @@ EFI_STATUS + // + // Interface structure for the ControllerHandle Driver Protocol + // +-struct _EFI_DRIVER_BINDING_PROTOCOL { ++struct _REFIND_EFI_DRIVER_BINDING_PROTOCOL { + EFI_DRIVER_BINDING_SUPPORTED Supported; + EFI_DRIVER_BINDING_START Start; + EFI_DRIVER_BINDING_STOP Stop; +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 + diff --git a/sys-boot/refind/refind-0.10.7-r1.ebuild b/sys-boot/refind/refind-0.10.7-r1.ebuild new file mode 100644 index 000000000000..b77f6fc42e80 --- /dev/null +++ b/sys-boot/refind/refind-0.10.7-r1.ebuild @@ -0,0 +1,200 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit toolchain-funcs flag-o-matic versionator + +DESCRIPTION="The rEFInd UEFI Boot Manager by Rod Smith" +HOMEPAGE="http://www.rodsbooks.com/refind/" + +SRC_URI="mirror://sourceforge/project/${PN}/${PV}/${PN}-src-${PV}.tar.gz" + +LICENSE="BSD GPL-2 GPL-3 FDL-1.3" +SLOT="0" +KEYWORDS="~amd64 ~x86" +FS_USE="btrfs +ext2 +ext4 hfs +iso9660 ntfs reiserfs" +IUSE="${FS_USE} -gnuefi doc -custom-cflags" + +DEPEND="gnuefi? ( >=sys-boot/gnu-efi-3.0.2 ) + !gnuefi? ( >=sys-boot/udk-2015 )" + +DOCS="NEWS.txt README.txt docs/refind docs/Styles" + +pkg_pretend() { + if use custom-cflags; then + ewarn + ewarn "You have enabled building with USE=custom-cflags. Be aware that" + ewarn "using this can result in EFI binaries that fail to run and may" + ewarn "fail to build at all. This is strongly advised against by upstream." + ewarn + ewarn "See https://bugs.gentoo.org/598587#c3 for more information" + ewarn + fi +} + +pkg_setup() { + if use x86 ; then + export EFIARCH=ia32 + export BUILDARCH=ia32 + elif use amd64; then + export EFIARCH=x64 + export BUILDARCH=x86_64 + else + # Try to support anyway + export BUILDARCH=$( uname -m | sed s,i[3456789]86,ia32, ) + if [[ ${BUILDARCH} == "x86_64" ]] ; then + export EFIARCH=x64 + else + export EFIARCH=${ARCH} + fi + fi +} + +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 + + local f + for f in "${S}"/*/Make.tiano "${S}"/Make.common; do + sed -i -e 's/^\(include .*target.txt.*\)$/#\1/' \ + -e 's@^\(TIANO_INCLUDE_DIRS\s*=\s*-I\s*\).*$@\1/usr/include/udk \\@' \ + -e '/^\s*-I \$(EDK2BASE).*$/d' \ + "${f}" || die "Failed to patch Tianocore make file in" \ + $(basename $(dirname ${f})) + done + for f in "${S}"/*/Make.tiano; do + sed -i -e 's@^\(EFILIB\s*=\s*\).*$@\1/usr/lib@' \ + -e 's@\$(EFILIB).*/\([^/]*\).lib@-l\1@' \ + -e 's/\(--start-group\s*\$(ALL_EFILIBS)\)/-L \$(EFILIB) \1/' \ + "${f}" || die "Failed to patch Tianocore make file in" \ + $(basename $(dirname ${f})) + done + sed -i -e '/Guids/i#include "AutoGen.h"\n' "${S}/filesystems/AutoGen.c" \ + || die "Failed to patch AutoGen.c" + for f in "${S}"/*/AutoGen.c; do + cat >>"${f}" <<-EOF || die "Failed to patch AutoGen.c" + + #define _PCD_TOKEN_PcdFixedDebugPrintErrorLevel 11U + #define _PCD_SIZE_PcdFixedDebugPrintErrorLevel 4 + #define _PCD_GET_MODE_SIZE_PcdFixedDebugPrintErrorLevel _PCD_SIZE_PcdFixedDebugPrintErrorLevel + #define _PCD_VALUE_PcdFixedDebugPrintErrorLevel 0xFFFFFFFFU + GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPcd_FixedAtBuild_PcdFixedDebugPrintErrorLevel = _PCD_VALUE_PcdFixedDebugPrintErrorLevel; + extern const UINT32 _gPcd_FixedAtBuild_PcdFixedDebugPrintErrorLevel; + #define _PCD_GET_MODE_32_PcdFixedDebugPrintErrorLevel _gPcd_FixedAtBuild_PcdFixedDebugPrintErrorLevel + //#define _PCD_SET_MODE_32_PcdFixedDebugPrintErrorLevel ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD + EOF + done +} + +src_compile() { + # Prepare flags + local pecoff_header_size + [[ $EFIARCH == x64 ]] && pecoff_header_size='0x228' \ + || pecoff_header_size='0x220' + local make_flags=( + ARCH="${BUILDARCH}" + GENFW="/usr/bin/GenFw" + CC="$(tc-getCC)" + AS="$(tc-getAS)" + LD="$(tc-getLD)" + AR="$(tc-getAR)" + RANLIB="$(tc-getRANLIB)" + OBJCOPY="$(tc-getOBJCOPY)" + GNUEFI_LDFLAGS="-T \$(GNUEFI_LDSCRIPT) -shared -nostdlib -Bsymbolic \ + -L\$(EFILIB) -L\$(GNUEFILIB) \$(CRTOBJS) -znocombreloc -zdefs" + TIANO_LDSCRIPT="/usr/lib/GccBase.lds" + TIANO_LDFLAGS="-n -q --gc-sections -nostdlib \ + --script=\$(TIANO_LDSCRIPT) \ + --defsym=PECOFF_HEADER_SIZE=${pecoff_header_size} \ + --entry \$(ENTRYPOINT) -u \$(ENTRYPOINT) -m \$(LD_CODE)" + ) + + # Make main EFI + local all_target + use gnuefi && all_target="gnuefi" || all_target="tiano" + + if use custom-cflags; then + emake CFLAGS="${CFLAGS}" "${make_flags[@]}" ${all_target} + else + emake "${make_flags[@]}" ${all_target} + fi + + # Make filesystem drivers + local gnuefi_target + use gnuefi && gnuefi_target="_gnuefi" + local fs + for fs in ${FS_USE}; do + fs=${fs#+} + if use "${fs}"; then + einfo "Building ${fs} filesystem driver" + if use custom-cflags; then + emake CFLAGS="${CFLAGS}" "${make_flags[@]}" -C "${S}/filesystems" ${fs}${gnuefi_target} + else + emake "${make_flags[@]}" -C "${S}/filesystems" ${fs}${gnuefi_target} + fi + fi + done +} + +src_install() { + exeinto "/usr/share/${P}" + doexe refind-install + dosym "/usr/share/${P}/refind-install" "/usr/sbin/refind-install" + + dodoc "${S}"/{COPYING.txt,LICENSE.txt,CREDITS.txt} + if use doc; then + doman "${S}/docs/man/"* + dodoc -r ${DOCS} + fi + + insinto "/usr/share/${P}/refind" + doins "${S}/refind/refind_${EFIARCH}.efi" + doins "${S}/refind.conf-sample" + doins -r images icons fonts banners + + if [[ -d "${S}/drivers_${EFIARCH}" ]]; then + doins -r "${S}/drivers_${EFIARCH}" + fi + + insinto "/usr/share/${P}/refind/tools_${EFIARCH}" + doins "${S}/gptsync/gptsync_${EFIARCH}.efi" + + insinto "/etc/refind.d" + doins -r "${S}/keys" + + dosbin "${S}/mkrlconf" + dosbin "${S}/mvrefind" + dosbin "${S}/refind-mkdefault" +} + +pkg_postinst() { + elog "rEFInd has been built and installed into ${EROOT%/}/usr/share/${P}" + elog "You will need to use the command 'refind-install' to install" + elog "the binaries into your EFI System Partition" + elog "" + if [[ -z "${REPLACING_VERSIONS}" ]]; then + elog "refind-install requires additional packages to be fully functional:" + elog " app-crypt/sbsigntool for binary signing for use with SecureBoot" + elog " sys-boot/efibootmgr for writing to NVRAM" + elog " sys-block/parted for automatic ESP location and mount" + elog "" + elog "refind-mkdefault requires >=dev-lang/python-3" + elog "" + elog "A sample configuration can be found at" + elog "${EROOT%}/usr/share/${P}/refind/refind.conf-sample" + else + if ! version_is_at_least "0.10.3" "${REPLACING_VERSIONS}"; then + elog "The new refind-mkdefault script requires >=dev-lang/python-3" + elog "to be installed" + elog "" + fi + ewarn "Note that this installation will not update any EFI binaries" + ewarn "on your EFI System Partition - this needs to be done manually" + fi +} diff --git a/sys-boot/refind/refind-0.10.7.ebuild b/sys-boot/refind/refind-0.10.7.ebuild deleted file mode 100644 index 044b7ed7c12e..000000000000 --- a/sys-boot/refind/refind-0.10.7.ebuild +++ /dev/null @@ -1,197 +0,0 @@ -# Copyright 1999-2017 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 - -inherit toolchain-funcs flag-o-matic versionator - -DESCRIPTION="The rEFInd UEFI Boot Manager by Rod Smith" -HOMEPAGE="http://www.rodsbooks.com/refind/" - -SRC_URI="mirror://sourceforge/project/${PN}/${PV}/${PN}-src-${PV}.tar.gz" - -LICENSE="BSD GPL-2 GPL-3 FDL-1.3" -SLOT="0" -KEYWORDS="~amd64 ~x86" -FS_USE="btrfs +ext2 +ext4 hfs +iso9660 ntfs reiserfs" -IUSE="${FS_USE} -gnuefi doc -custom-cflags" - -DEPEND="gnuefi? ( >=sys-boot/gnu-efi-3.0.2 ) - !gnuefi? ( >=sys-boot/udk-2015 )" - -DOCS="NEWS.txt README.txt docs/refind docs/Styles" - -pkg_pretend() { - if use custom-cflags; then - ewarn - ewarn "You have enabled building with USE=custom-cflags. Be aware that" - ewarn "using this can result in EFI binaries that fail to run and may" - ewarn "fail to build at all. This is strongly advised against by upstream." - ewarn - ewarn "See https://bugs.gentoo.org/598587#c3 for more information" - ewarn - fi -} - -pkg_setup() { - if use x86 ; then - export EFIARCH=ia32 - export BUILDARCH=ia32 - elif use amd64; then - export EFIARCH=x64 - export BUILDARCH=x86_64 - else - # Try to support anyway - export BUILDARCH=$( uname -m | sed s,i[3456789]86,ia32, ) - if [[ ${BUILDARCH} == "x86_64" ]] ; then - export EFIARCH=x64 - else - export EFIARCH=${ARCH} - fi - fi -} - -src_prepare() { - default - - # bug 598647 - PIE not supported - sed -e 's:CFLAGS =:& -fno-PIE:' -i "${S}/Make.common" || die - - local f - for f in "${S}"/*/Make.tiano "${S}"/Make.common; do - sed -i -e 's/^\(include .*target.txt.*\)$/#\1/' \ - -e 's@^\(TIANO_INCLUDE_DIRS\s*=\s*-I\s*\).*$@\1/usr/include/udk \\@' \ - -e '/^\s*-I \$(EDK2BASE).*$/d' \ - "${f}" || die "Failed to patch Tianocore make file in" \ - $(basename $(dirname ${f})) - done - for f in "${S}"/*/Make.tiano; do - sed -i -e 's@^\(EFILIB\s*=\s*\).*$@\1/usr/lib@' \ - -e 's@\$(EFILIB).*/\([^/]*\).lib@-l\1@' \ - -e 's/\(--start-group\s*\$(ALL_EFILIBS)\)/-L \$(EFILIB) \1/' \ - "${f}" || die "Failed to patch Tianocore make file in" \ - $(basename $(dirname ${f})) - done - sed -i -e '/Guids/i#include "AutoGen.h"\n' "${S}/filesystems/AutoGen.c" \ - || die "Failed to patch AutoGen.c" - for f in "${S}"/*/AutoGen.c; do - cat >>"${f}" <<-EOF || die "Failed to patch AutoGen.c" - - #define _PCD_TOKEN_PcdFixedDebugPrintErrorLevel 11U - #define _PCD_SIZE_PcdFixedDebugPrintErrorLevel 4 - #define _PCD_GET_MODE_SIZE_PcdFixedDebugPrintErrorLevel _PCD_SIZE_PcdFixedDebugPrintErrorLevel - #define _PCD_VALUE_PcdFixedDebugPrintErrorLevel 0xFFFFFFFFU - GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPcd_FixedAtBuild_PcdFixedDebugPrintErrorLevel = _PCD_VALUE_PcdFixedDebugPrintErrorLevel; - extern const UINT32 _gPcd_FixedAtBuild_PcdFixedDebugPrintErrorLevel; - #define _PCD_GET_MODE_32_PcdFixedDebugPrintErrorLevel _gPcd_FixedAtBuild_PcdFixedDebugPrintErrorLevel - //#define _PCD_SET_MODE_32_PcdFixedDebugPrintErrorLevel ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD - EOF - done -} - -src_compile() { - # Prepare flags - local pecoff_header_size - [[ $EFIARCH == x64 ]] && pecoff_header_size='0x228' \ - || pecoff_header_size='0x220' - local make_flags=( - ARCH="${BUILDARCH}" - GENFW="/usr/bin/GenFw" - CC="$(tc-getCC)" - AS="$(tc-getAS)" - LD="$(tc-getLD)" - AR="$(tc-getAR)" - RANLIB="$(tc-getRANLIB)" - OBJCOPY="$(tc-getOBJCOPY)" - GNUEFI_LDFLAGS="-T \$(GNUEFI_LDSCRIPT) -shared -nostdlib -Bsymbolic \ - -L\$(EFILIB) -L\$(GNUEFILIB) \$(CRTOBJS) -znocombreloc -zdefs" - TIANO_LDSCRIPT="/usr/lib/GccBase.lds" - TIANO_LDFLAGS="-n -q --gc-sections -nostdlib \ - --script=\$(TIANO_LDSCRIPT) \ - --defsym=PECOFF_HEADER_SIZE=${pecoff_header_size} \ - --entry \$(ENTRYPOINT) -u \$(ENTRYPOINT) -m \$(LD_CODE)" - ) - - # Make main EFI - local all_target - use gnuefi && all_target="gnuefi" || all_target="tiano" - - if use custom-cflags; then - emake CFLAGS="${CFLAGS}" "${make_flags[@]}" ${all_target} - else - emake "${make_flags[@]}" ${all_target} - fi - - # Make filesystem drivers - local gnuefi_target - use gnuefi && gnuefi_target="_gnuefi" - local fs - for fs in ${FS_USE}; do - fs=${fs#+} - if use "${fs}"; then - einfo "Building ${fs} filesystem driver" - if use custom-cflags; then - emake CFLAGS="${CFLAGS}" "${make_flags[@]}" -C "${S}/filesystems" ${fs}${gnuefi_target} - else - emake "${make_flags[@]}" -C "${S}/filesystems" ${fs}${gnuefi_target} - fi - fi - done -} - -src_install() { - exeinto "/usr/share/${P}" - doexe refind-install - dosym "/usr/share/${P}/refind-install" "/usr/sbin/refind-install" - - dodoc "${S}"/{COPYING.txt,LICENSE.txt,CREDITS.txt} - if use doc; then - doman "${S}/docs/man/"* - dodoc -r ${DOCS} - fi - - insinto "/usr/share/${P}/refind" - doins "${S}/refind/refind_${EFIARCH}.efi" - doins "${S}/refind.conf-sample" - doins -r images icons fonts banners - - if [[ -d "${S}/drivers_${EFIARCH}" ]]; then - doins -r "${S}/drivers_${EFIARCH}" - fi - - insinto "/usr/share/${P}/refind/tools_${EFIARCH}" - doins "${S}/gptsync/gptsync_${EFIARCH}.efi" - - insinto "/etc/refind.d" - doins -r "${S}/keys" - - dosbin "${S}/mkrlconf" - dosbin "${S}/mvrefind" - dosbin "${S}/refind-mkdefault" -} - -pkg_postinst() { - elog "rEFInd has been built and installed into ${EROOT%/}/usr/share/${P}" - elog "You will need to use the command 'refind-install' to install" - elog "the binaries into your EFI System Partition" - elog "" - if [[ -z "${REPLACING_VERSIONS}" ]]; then - elog "refind-install requires additional packages to be fully functional:" - elog " app-crypt/sbsigntool for binary signing for use with SecureBoot" - elog " sys-boot/efibootmgr for writing to NVRAM" - elog " sys-block/parted for automatic ESP location and mount" - elog "" - elog "refind-mkdefault requires >=dev-lang/python-3" - elog "" - elog "A sample configuration can be found at" - elog "${EROOT%}/usr/share/${P}/refind/refind.conf-sample" - else - if ! version_is_at_least "0.10.3" "${REPLACING_VERSIONS}"; then - elog "The new refind-mkdefault script requires >=dev-lang/python-3" - elog "to be installed" - elog "" - fi - ewarn "Note that this installation will not update any EFI binaries" - ewarn "on your EFI System Partition - this needs to be done manually" - fi -} -- cgit v1.2.3