From f92a7032373fc63e9d8946574d4fb42464d1c916 Mon Sep 17 00:00:00 2001 From: srs5694 Date: Sat, 4 Jul 2015 18:17:21 -0400 Subject: [PATCH] Added feature to detect the root (/) Linux filesystem based on freedesktop.org's Discoverable Partitions Spec (http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/). --- NEWS.txt | 12 ++++++- docs/refind/bootmode.html | 2 ++ docs/refind/configfile.html | 2 ++ docs/refind/drivers.html | 2 ++ docs/refind/features.html | 2 ++ docs/refind/getting.html | 2 ++ docs/refind/index.html | 2 ++ docs/refind/installing.html | 8 +++++ docs/refind/linux.html | 2 ++ docs/refind/revisions.html | 2 ++ docs/refind/secureboot.html | 2 ++ docs/refind/themes.html | 2 ++ docs/refind/todo.html | 2 ++ docs/refind/using.html | 2 ++ docs/refind/yosemite.html | 2 ++ refind/config.c | 47 ++++++++++++++++++++++++-- refind/global.h | 66 +++++++++++++++++++------------------ refind/gpt.c | 41 +++++++++++++++++++---- refind/gpt.h | 3 +- refind/lib.c | 36 ++++++++++++++++---- refind/lib.h | 3 ++ refind/main.c | 13 +++++--- 22 files changed, 202 insertions(+), 53 deletions(-) diff --git a/NEWS.txt b/NEWS.txt index 98030ac..a71278f 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -1,6 +1,16 @@ -0.8.8 (3/??/2015): +0.8.8 (6/??/2015): ------------------ +- Added new Linux root (/) partition auto-discovery feature, based on + Freedesktop.org's Discoverable Partitions Spec (DPS) + (http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/): + If no refind_linux.conf file or /etc/fstab file is found, and if a + partition with the correct DPS type code for the system architecture is + found, rEFInd adds "ro root=/dev/disk/by-partuuid/{GUID}" to the kernel + options. This will not help on LVM setups, and will get it right for only + one installation on systems with multiple Linux installations, but it may + help some users, if/when the DPS type codes become more common. + - Fixed bug that caused a rEFInd crash if an empty refind_linux.conf file was encountered. diff --git a/docs/refind/bootmode.html b/docs/refind/bootmode.html index 03fbd13..3d48620 100644 --- a/docs/refind/bootmode.html +++ b/docs/refind/bootmode.html @@ -8,6 +8,8 @@ + +

The rEFInd Boot Manager:
What's Your Boot Mode?

diff --git a/docs/refind/configfile.html b/docs/refind/configfile.html index 410d7ce..dc5cff4 100644 --- a/docs/refind/configfile.html +++ b/docs/refind/configfile.html @@ -8,6 +8,8 @@ + +

The rEFInd Boot Manager:
Configuring the Boot Manager

diff --git a/docs/refind/drivers.html b/docs/refind/drivers.html index ec67702..0a86376 100644 --- a/docs/refind/drivers.html +++ b/docs/refind/drivers.html @@ -8,6 +8,8 @@ + +

The rEFInd Boot Manager:
Using EFI Drivers

diff --git a/docs/refind/features.html b/docs/refind/features.html index 053cc93..3af7b06 100644 --- a/docs/refind/features.html +++ b/docs/refind/features.html @@ -8,6 +8,8 @@ + +

The rEFInd Boot Manager:
rEFInd Features

diff --git a/docs/refind/getting.html b/docs/refind/getting.html index ef5c70e..ee948b5 100644 --- a/docs/refind/getting.html +++ b/docs/refind/getting.html @@ -8,6 +8,8 @@ + +

The rEFInd Boot Manager:
Getting rEFInd

diff --git a/docs/refind/index.html b/docs/refind/index.html index 7c1c11a..8425012 100644 --- a/docs/refind/index.html +++ b/docs/refind/index.html @@ -8,6 +8,8 @@ + +

The rEFInd Boot Manager

diff --git a/docs/refind/installing.html b/docs/refind/installing.html index d58e38e..0bd039f 100644 --- a/docs/refind/installing.html +++ b/docs/refind/installing.html @@ -8,6 +8,8 @@ + +

The rEFInd Boot Manager:
Installing rEFInd

@@ -610,6 +612,10 @@ $ ioreg -l -p IODeviceTree | grep firmware-abi +

I know relatively little about Windows EFI management tools; however, I do know that at least two relevant tools exist: the standard bcdedit and the third-party EasyUEFI.

+ +

The EasyUEFI tool is a free (as in beer) GUI tool for managing EFI boot programs. I've only tried it once, and it seemed fairly intuitive and easy to use, but I don't have detailed instructions on how to use it. If you want to use EasyUEFI, you'll have to use it in place of bcdedit at the end of the following procedure.

+

Attempt this method of installation only on a UEFI-based PC; this method will not work on Windows that's installed on a Mac in BIOS/CSM/legacy mode. To install rEFInd under Windows, you must first find a way to access the ESP, which Windows normally hides from view. One way to accomplish this goal, and to proceed forward once the ESP is accessible, is as follows:

    @@ -630,6 +636,8 @@ $ ioreg -l -p IODeviceTree | grep firmware-abi
  1. Type rename refind.conf-sample refind.conf to rename rEFInd's configuration file.
  2. + +
  3. Type bcdedit /set {bootmgr} path \EFI\refind\refind_x64.efi to set rEFInd as the default EFI boot program. Note that {bootmgr} is entered as such; that's not a notation for a variable. Also, change refind_x64.efi to refind_ia32.efi on systems with 32-bit EFIs. Such computers are rare, and most of them are tablets. Check your Windows bit depth to determine which binary you should use.
  4. If you like, type bcdedit /set {bootmgr} description "rEFInd description" to set a description (change rEFInd description as you see fit).
  5. diff --git a/docs/refind/linux.html b/docs/refind/linux.html index 8fa6b8e..9ce4ee9 100644 --- a/docs/refind/linux.html +++ b/docs/refind/linux.html @@ -8,6 +8,8 @@ + +

    The rEFInd Boot Manager:
    Methods of Booting Linux

    diff --git a/docs/refind/revisions.html b/docs/refind/revisions.html index c709f96..20d5221 100644 --- a/docs/refind/revisions.html +++ b/docs/refind/revisions.html @@ -8,6 +8,8 @@ + +

    The rEFInd Boot Manager:
    Revisions

    diff --git a/docs/refind/secureboot.html b/docs/refind/secureboot.html index 1def632..38e4334 100644 --- a/docs/refind/secureboot.html +++ b/docs/refind/secureboot.html @@ -8,6 +8,8 @@ + +

    The rEFInd Boot Manager:
    Managing Secure Boot

    diff --git a/docs/refind/themes.html b/docs/refind/themes.html index 91e2c0a..a72018b 100644 --- a/docs/refind/themes.html +++ b/docs/refind/themes.html @@ -8,6 +8,8 @@ + +

    The rEFInd Boot Manager:
    Theming rEFInd

    diff --git a/docs/refind/todo.html b/docs/refind/todo.html index 7fe5b1b..76a3c55 100644 --- a/docs/refind/todo.html +++ b/docs/refind/todo.html @@ -8,6 +8,8 @@ + +

    The rEFInd Boot Manager:
    The Future of rEFInd

    diff --git a/docs/refind/using.html b/docs/refind/using.html index c9943cf..cb4a8a8 100644 --- a/docs/refind/using.html +++ b/docs/refind/using.html @@ -8,6 +8,8 @@ + +

    The rEFInd Boot Manager:
    Using rEFInd

    diff --git a/docs/refind/yosemite.html b/docs/refind/yosemite.html index 3cf7d15..14ea693 100644 --- a/docs/refind/yosemite.html +++ b/docs/refind/yosemite.html @@ -8,6 +8,8 @@ + +

    The rEFInd Boot Manager:
    rEFInd and Yosemite

    diff --git a/refind/config.c b/refind/config.c index fa1d9a6..4abd48b 100644 --- a/refind/config.c +++ b/refind/config.c @@ -1018,6 +1018,44 @@ static REFIT_FILE * GenerateOptionsFromEtcFstab(REFIT_VOLUME *Volume) { return Options; } // GenerateOptionsFromEtcFstab() +// Create options from partition type codes. Specifically, if the earlier +// partition scan found a partition with a type code corresponding to a root +// filesystem according to the Freedesktop.org Discoverable Partitions Spec +// (http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/), +// this function returns an appropriate file with two lines, one with +// "ro root=PARTUUID={GUID}" and the other with that plus "single". +// Note that this function returns the LAST partition found with the +// appropriate type code, so this will work poorly on dual-boot systems or +// if the type code is set incorrectly. +static REFIT_FILE * GenerateOptionsFromPartTypes(VOID) { + REFIT_FILE *Options = NULL; + CHAR16 *Line, *GuidString; + + if (GlobalConfig.DiscoveredRoot) { + Options = AllocateZeroPool(sizeof(REFIT_FILE)); + if (Options) { + Options->Encoding = ENCODING_UTF16_LE; + GuidString = GuidAsString(&(GlobalConfig.DiscoveredRoot->PartGuid)); + ToLower(GuidString); + if (GuidString) { + Line = PoolPrint(L"\"Boot with normal options\" \"ro root=/dev/disk/by-partuuid/%s\"\n", GuidString); + MergeStrings((CHAR16 **) &(Options->Buffer), Line, 0); + MyFreePool(Line); + Line = PoolPrint(L"\"Boot into single-user mode\" \"ro root=/dev/disk/by-partuuid/%s single\"\n", GuidString); + MergeStrings((CHAR16**) &(Options->Buffer), Line, 0); + MyFreePool(Line); + MyFreePool(GuidString); + } // if (GuidString) + Options->BufferSize = StrLen((CHAR16*) Options->Buffer) * sizeof(CHAR16); + + Options->Current8Ptr = (CHAR8 *)Options->Buffer; + Options->End8Ptr = Options->Current8Ptr + Options->BufferSize; + Options->Current16Ptr = (CHAR16 *)Options->Buffer; + Options->End16Ptr = Options->Current16Ptr + (Options->BufferSize >> 1); + } // if (Options allocated OK) + } // if (partition has root GUID) + return Options; +} // REFIT_FILE * GenerateOptionsFromPartTypes() // Read a Linux kernel options file for a Linux boot loader into memory. The LoaderPath // and Volume variables identify the location of the options file, but not its name -- @@ -1062,12 +1100,17 @@ REFIT_FILE * ReadLinuxOptionsFile(IN CHAR16 *LoaderPath, IN REFIT_VOLUME *Volume } else { // a filename string is NULL GoOn = FALSE; } // if/else - if (!FileFound) - File = GenerateOptionsFromEtcFstab(Volume); MyFreePool(OptionsFilename); MyFreePool(FullFilename); OptionsFilename = FullFilename = NULL; } while (GoOn); + if (!FileFound) { + // No refind_linux.conf file; look for /etc/fstab and try to pull values from there.... + File = GenerateOptionsFromEtcFstab(Volume); + // If still no joy, try to use Freedesktop.org Discoverable Partitions Spec.... + if (!File) + File = GenerateOptionsFromPartTypes(); + } // if return (File); } // static REFIT_FILE * ReadLinuxOptionsFile() diff --git a/refind/global.h b/refind/global.h index b0f10ed..33087c2 100644 --- a/refind/global.h +++ b/refind/global.h @@ -205,6 +205,7 @@ typedef struct { CHAR16 *PartName; EFI_GUID VolUuid; EFI_GUID PartGuid; + EFI_GUID PartTypeGuid; UINTN VolNumber; EG_IMAGE *VolIconImage; EG_IMAGE *VolBadgeImage; @@ -270,38 +271,39 @@ typedef struct { } LEGACY_ENTRY; typedef struct { - BOOLEAN TextOnly; - BOOLEAN ScanAllLinux; - BOOLEAN DeepLegacyScan; - BOOLEAN EnableAndLockVMX; - UINTN RequestedScreenWidth; - UINTN RequestedScreenHeight; - UINTN BannerBottomEdge; - UINTN RequestedTextMode; - UINTN Timeout; - UINTN HideUIFlags; - UINTN MaxTags; // max. number of OS entries to show simultaneously in graphics mode - UINTN GraphicsFor; - UINTN LegacyType; - UINTN ScanDelay; - UINTN ScreensaverTime; - UINTN IconSizes[3]; - UINTN BannerScale; - CHAR16 *BannerFileName; - EG_IMAGE *ScreenBackground; - CHAR16 *ConfigFilename; - CHAR16 *SelectionSmallFileName; - CHAR16 *SelectionBigFileName; - CHAR16 *DefaultSelection; - CHAR16 *AlsoScan; - CHAR16 *DontScanVolumes; - CHAR16 *DontScanDirs; - CHAR16 *DontScanFiles; - CHAR16 *WindowsRecoveryFiles; - CHAR16 *DriverDirs; - CHAR16 *IconsDir; - UINTN ShowTools[NUM_TOOLS]; - CHAR8 ScanFor[NUM_SCAN_OPTIONS]; // codes of types of loaders for which to scan + BOOLEAN TextOnly; + BOOLEAN ScanAllLinux; + BOOLEAN DeepLegacyScan; + BOOLEAN EnableAndLockVMX; + UINTN RequestedScreenWidth; + UINTN RequestedScreenHeight; + UINTN BannerBottomEdge; + UINTN RequestedTextMode; + UINTN Timeout; + UINTN HideUIFlags; + UINTN MaxTags; // max. number of OS entries to show simultaneously in graphics mode + UINTN GraphicsFor; + UINTN LegacyType; + UINTN ScanDelay; + UINTN ScreensaverTime; + UINTN IconSizes[3]; + UINTN BannerScale; + REFIT_VOLUME *DiscoveredRoot; + CHAR16 *BannerFileName; + EG_IMAGE *ScreenBackground; + CHAR16 *ConfigFilename; + CHAR16 *SelectionSmallFileName; + CHAR16 *SelectionBigFileName; + CHAR16 *DefaultSelection; + CHAR16 *AlsoScan; + CHAR16 *DontScanVolumes; + CHAR16 *DontScanDirs; + CHAR16 *DontScanFiles; + CHAR16 *WindowsRecoveryFiles; + CHAR16 *DriverDirs; + CHAR16 *IconsDir; + UINTN ShowTools[NUM_TOOLS]; + CHAR8 ScanFor[NUM_SCAN_OPTIONS]; // codes of types of loaders for which to scan } REFIT_CONFIG; // Global variables diff --git a/refind/gpt.c b/refind/gpt.c index de93317..60da3bb 100644 --- a/refind/gpt.c +++ b/refind/gpt.c @@ -185,12 +185,37 @@ EFI_STATUS ReadGptData(REFIT_VOLUME *Volume, GPT_DATA **Data) { return Status; } // EFI_STATUS ReadGptData() +// // Look in gPartitions for a partition with the specified Guid. If found, return +// // a pointer to that partition's name string. If not found, return a NULL pointer. +// // The calling function is responsible for freeing the returned memory. +// CHAR16 * PartNameFromGuid(EFI_GUID *Guid) { +// UINTN i; +// CHAR16 *Found = NULL; +// GPT_DATA *GptData; +// +// if ((Guid == NULL) || (gPartitions == NULL)) +// return NULL; +// +// GptData = gPartitions; +// while ((GptData != NULL) && (!Found)) { +// i = 0; +// while ((i < GptData->Header->entry_count) && (!Found)) { +// if (GuidsAreEqual((EFI_GUID*) &(GptData->Entries[i].partition_guid), Guid)) +// Found = StrDuplicate(GptData->Entries[i].name); +// else +// i++; +// } // while(scanning entries) +// GptData = GptData->NextEntry; +// } // while(scanning GPTs) +// return Found; +// } // CHAR16 * PartNameFromGuid() + // Look in gPartitions for a partition with the specified Guid. If found, return -// a pointer to that partition's name string. If not found, return a NULL pointer. +// a pointer to that partition's data. If not found, return a NULL pointer. // The calling function is responsible for freeing the returned memory. -CHAR16 * PartNameFromGuid(EFI_GUID *Guid) { +GPT_ENTRY * FindPartWithGuid(EFI_GUID *Guid) { UINTN i; - CHAR16 *Found = NULL; + GPT_ENTRY *Found = NULL; GPT_DATA *GptData; if ((Guid == NULL) || (gPartitions == NULL)) @@ -200,15 +225,17 @@ CHAR16 * PartNameFromGuid(EFI_GUID *Guid) { while ((GptData != NULL) && (!Found)) { i = 0; while ((i < GptData->Header->entry_count) && (!Found)) { - if (GuidsAreEqual((EFI_GUID*) &(GptData->Entries[i].partition_guid), Guid)) - Found = StrDuplicate(GptData->Entries[i].name); - else + if (GuidsAreEqual((EFI_GUID*) &(GptData->Entries[i].partition_guid), Guid)) { + Found = AllocateZeroPool(sizeof(GPT_ENTRY)); + CopyMem(Found, &GptData->Entries[i], sizeof(GPT_ENTRY)); + } else { i++; + } // if/else } // while(scanning entries) GptData = GptData->NextEntry; } // while(scanning GPTs) return Found; -} // CHAR16 * PartNameFromGuid() +} // GPT_ENTRY * FindPartWithGuid() // Erase the gPartitions linked-list data structure VOID ForgetPartitionTables(VOID) { diff --git a/refind/gpt.h b/refind/gpt.h index 0ce6724..28a495b 100644 --- a/refind/gpt.h +++ b/refind/gpt.h @@ -82,7 +82,8 @@ typedef struct _gpt_data { VOID ClearGptData(GPT_DATA *Data); EFI_STATUS ReadGptData(REFIT_VOLUME *Volume, GPT_DATA **Data); -CHAR16 * PartNameFromGuid(EFI_GUID *Guid); +// CHAR16 * PartNameFromGuid(EFI_GUID *Guid); +GPT_ENTRY * FindPartWithGuid(EFI_GUID *Guid); VOID ForgetPartitionTables(VOID); VOID AddPartitionTable(REFIT_VOLUME *Volume); diff --git a/refind/lib.c b/refind/lib.c index 7075630..7d2a573 100644 --- a/refind/lib.c +++ b/refind/lib.c @@ -861,20 +861,30 @@ static CHAR16 *GetVolumeName(REFIT_VOLUME *Volume) { return FoundName; } // static CHAR16 *GetVolumeName() -// Determine the unique GUID and name of the volume and store them. +// Determine the unique GUID, type code GUID, and name of the volume and store them. static VOID SetPartGuidAndName(REFIT_VOLUME *Volume, EFI_DEVICE_PATH_PROTOCOL *DevicePath) { HARDDRIVE_DEVICE_PATH *HdDevicePath; + GPT_ENTRY *PartInfo; - if (Volume == NULL) + if ((Volume == NULL) || (DevicePath == NULL)) return; if ((DevicePath->Type == MEDIA_DEVICE_PATH) && (DevicePath->SubType == MEDIA_HARDDRIVE_DP)) { HdDevicePath = (HARDDRIVE_DEVICE_PATH*) DevicePath; if (HdDevicePath->SignatureType == SIGNATURE_TYPE_GUID) { Volume->PartGuid = *((EFI_GUID*) HdDevicePath->Signature); - Volume->PartName = PartNameFromGuid(&(Volume->PartGuid)); - } // if - } // if + PartInfo = FindPartWithGuid(&(Volume->PartGuid)); + if (PartInfo) { + Volume->PartName = StrDuplicate(PartInfo->name); + CopyMem(&(Volume->PartTypeGuid), PartInfo->type_guid, sizeof(EFI_GUID)); + if (GuidsAreEqual (&(Volume->PartTypeGuid), &gFreedesktopRootGuid)) { + GlobalConfig.DiscoveredRoot = Volume; + Print(L"Found match!\n"); + PauseForKey(); + } // if (GUIDs match) + } // if (PartInfo exists) + } // if (GPT disk) + } // if (disk device) } // VOID SetPartGuid() // Return TRUE if NTFS boot files are found or if Volume is unreadable, @@ -1326,6 +1336,7 @@ EFI_STATUS DirNextEntry(IN EFI_FILE *Directory, IN OUT EFI_FILE_INFO **DirEntry, LastBufferSize = BufferSize = 256; Buffer = AllocatePool(BufferSize); for (IterCount = 0; ; IterCount++) { + Print(L"In DirNextEntry(), about to call Directory->Read()\n"); Status = refit_call3_wrapper(Directory->Read, Directory, &BufferSize, Buffer); if (Status != EFI_BUFFER_TOO_SMALL || IterCount >= 4) break; @@ -1571,6 +1582,19 @@ BOOLEAN StriSubCmp(IN CHAR16 *SmallStr, IN CHAR16 *BigStr) { return (Found); } // BOOLEAN StriSubCmp() +// Convert input string to all-lowercase. +VOID ToLower(CHAR16 * MyString) { + UINTN i = 0; + + if (MyString) { + while (MyString[i] != L'\0') { + if ((MyString[i] >= L'A') && (MyString[i] <= L'Z')) + MyString[i] = MyString[i] - L'A' + L'a'; + i++; + } // while + } // if +} // VOID ToLower() + // Merges two strings, creating a new one and returning a pointer to it. // If AddChar != 0, the specified character is placed between the two original // strings (unless the first string is NULL or empty). The original input @@ -2188,5 +2212,5 @@ EFI_GUID StringAsGuid(CHAR16 * InString) { // Returns TRUE if the two GUIDs are equal, FALSE otherwise BOOLEAN GuidsAreEqual(EFI_GUID *Guid1, EFI_GUID *Guid2) { return (CompareMem(Guid1, Guid2, 16) == 0); -} // BOOLEAN CompareGuids() +} // BOOLEAN GuidsAreEqual() diff --git a/refind/lib.h b/refind/lib.h index c908c11..93a2ea4 100644 --- a/refind/lib.h +++ b/refind/lib.h @@ -82,6 +82,8 @@ typedef struct { // Partition names to be ignored when setting volume name #define IGNORE_PARTITION_NAMES L"Microsoft basic data,Linux filesystem,Apple HFS/HFS+" +extern EFI_GUID gFreedesktopRootGuid; + EFI_STATUS InitRefitLib(IN EFI_HANDLE ImageHandle); VOID UninitRefitLib(VOID); EFI_STATUS ReinitRefitLib(VOID); @@ -114,6 +116,7 @@ INTN FindMem(IN VOID *Buffer, IN UINTN BufferLength, IN VOID *SearchString, IN U VOID ReinitVolumes(VOID); BOOLEAN StriSubCmp(IN CHAR16 *TargetStr, IN CHAR16 *BigStr); +VOID ToLower(CHAR16 * MyString); VOID MergeStrings(IN OUT CHAR16 **First, IN CHAR16 *Second, CHAR16 AddChar); CHAR16 *FindExtension(IN CHAR16 *Path); CHAR16 *FindLastDirName(IN CHAR16 *Path); diff --git a/refind/main.c b/refind/main.c index c107fa4..fc31005 100644 --- a/refind/main.c +++ b/refind/main.c @@ -87,6 +87,7 @@ #define FALLBACK_FULLNAME L"EFI\\BOOT\\bootx64.efi" #define FALLBACK_BASENAME L"bootx64.efi" #define EFI_STUB_ARCH 0x8664 +EFI_GUID gFreedesktopRootGuid = { 0x4f68bce3, 0xe8cd, 0x4db1, { 0x96, 0xe7, 0xfb, 0xca, 0xf9, 0x84, 0xb7, 0x09 }}; #elif defined (EFI32) #define SHELL_NAMES L"\\EFI\\tools\\shell.efi,\\EFI\\tools\\shellia32.efi,\\shell.efi,\\shellia32.efi" #define GPTSYNC_NAMES L"\\EFI\\tools\\gptsync.efi,\\EFI\\tools\\gptsync_ia32.efi" @@ -97,6 +98,7 @@ #define FALLBACK_FULLNAME L"EFI\\BOOT\\bootia32.efi" #define FALLBACK_BASENAME L"bootia32.efi" #define EFI_STUB_ARCH 0x014c +EFI_GUID gFreedesktopRootGuid = { 0x44479540, 0xf297, 0x41b2, { 0x9a, 0xf7, 0xd1, 0x31, 0xd5, 0xf0, 0x45, 0x8a }}; #else #define SHELL_NAMES L"\\EFI\\tools\\shell.efi,\\shell.efi" #define GPTSYNC_NAMES L"\\EFI\\tools\\gptsync.efi" @@ -106,6 +108,8 @@ #define DRIVER_DIRS L"drivers" #define FALLBACK_FULLNAME L"EFI\\BOOT\\boot.efi" /* Not really correct */ #define FALLBACK_BASENAME L"boot.efi" /* Not really correct */ +// Below is GUID for ARM64 +EFI_GUID gFreedesktopRootGuid = { 0xb921b045, 0x1df0, 0x41c3, { 0xaf, 0x44, 0x4c, 0x6f, 0x28, 0x0d, 0x3f, 0xae }}; #endif #define FAT_ARCH 0x0ef1fab9 /* ID for Apple "fat" binary */ @@ -138,7 +142,7 @@ static REFIT_MENU_SCREEN AboutMenu = { L"About", NULL, 0, NULL, 0, NULL, 0, REFIT_CONFIG GlobalConfig = { FALSE, TRUE, FALSE, FALSE, 0, 0, 0, DONT_CHANGE_TEXT_MODE, 20, 0, 0, GRAPHICS_FOR_OSX, LEGACY_TYPE_MAC, 0, 0, { DEFAULT_BIG_ICON_SIZE / 4, DEFAULT_SMALL_ICON_SIZE, DEFAULT_BIG_ICON_SIZE }, BANNER_NOSCALE, - NULL, NULL, CONFIG_FILE_NAME, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, CONFIG_FILE_NAME, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, { TAG_SHELL, TAG_MEMTEST, TAG_GDISK, TAG_APPLE_RECOVERY, TAG_WINDOWS_RECOVERY, TAG_MOK_TOOL, TAG_ABOUT, TAG_SHUTDOWN, TAG_REBOOT, TAG_FIRMWARE, 0, 0, 0, 0, 0, 0, 0, 0 } }; @@ -166,7 +170,7 @@ static VOID AboutrEFInd(VOID) if (AboutMenu.EntryCount == 0) { AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT); - AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.8.7.4"); + AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.8.7.12"); AddMenuInfoLine(&AboutMenu, L""); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer"); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012-2015 Roderick W. Smith"); @@ -1410,7 +1414,7 @@ static VOID ScanEfiFiles(REFIT_VOLUME *Volume) { BOOLEAN ScanFallbackLoader = TRUE; BOOLEAN FoundBRBackup = FALSE; - if ((Volume->RootDir != NULL) && (Volume->VolName != NULL) && (Volume->IsReadable)) { + if (Volume && (Volume->RootDir != NULL) && (Volume->VolName != NULL) && (Volume->IsReadable)) { MatchPatterns = StrDuplicate(LOADER_MATCH_PATTERNS); if (GlobalConfig.ScanAllLinux) MergeStrings(&MatchPatterns, LINUX_MATCH_PATTERNS, L','); @@ -1444,7 +1448,8 @@ static VOID ScanEfiFiles(REFIT_VOLUME *Volume) { ScanFallbackLoader = FALSE; } StrCpy(FileName, L"EFI\\Microsoft\\Boot\\bootmgfw.efi"); - if (FileExists(Volume->RootDir, FileName) && !FilenameIn(Volume, L"EFI\\Microsoft\\Boot", L"bootmgfw.efi", GlobalConfig.DontScanFiles)) { + if (FileExists(Volume->RootDir, FileName) && + !FilenameIn(Volume, L"EFI\\Microsoft\\Boot", L"bootmgfw.efi", GlobalConfig.DontScanFiles)) { if (FoundBRBackup) AddLoaderEntry(FileName, L"Supposed Microsoft EFI boot (probably GRUB)", Volume); else -- 2.39.2