From 47caf2854cdebec2d2c1e4d6534ee88071b4ebb8 Mon Sep 17 00:00:00 2001 From: vit9696 Date: Sun, 21 Jul 2019 14:02:11 +0300 Subject: [PATCH] OcAppleBootPolicyLib: Initial fix to multiple os --- .../OcAppleBootPolicyLib.c | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/Library/OcAppleBootPolicyLib/OcAppleBootPolicyLib.c b/Library/OcAppleBootPolicyLib/OcAppleBootPolicyLib.c index 9858f4fa..6ecfca95 100644 --- a/Library/OcAppleBootPolicyLib/OcAppleBootPolicyLib.c +++ b/Library/OcAppleBootPolicyLib/OcAppleBootPolicyLib.c @@ -924,6 +924,7 @@ BootPolicyGetBootFileEx ( ) { EFI_STATUS Status; + EFI_STATUS TmpStatus; EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem; EFI_FILE_PROTOCOL *Root; @@ -953,19 +954,24 @@ BootPolicyGetBootFileEx ( if (!EFI_ERROR (Status)) { Status = EFI_NOT_FOUND; if ((VolumeInfo->Role & APPLE_APFS_VOLUME_ROLE_PREBOOT) != 0) { - Status = InternalGetBooterFromBlessedSystemFilePath (Root, FilePath); - if (EFI_ERROR (Status)) { - Status = InternalGetBooterFromBlessedSystemFolderPath (Device, Root, FilePath); - if (EFI_ERROR (Status)) { - Status = InternalGetBooterFromApfsPredefinedNameList ( - Device, - Root, - &ContainerInfo->Uuid, - NULL, - FilePath, - NULL - ); - } + TmpStatus = InternalGetBooterFromBlessedSystemFilePath (Root, FilePath); + if (EFI_ERROR (TmpStatus)) { + TmpStatus = InternalGetBooterFromBlessedSystemFolderPath (Device, Root, FilePath); + } + + // + // Blessed entry is always first, and subsequent entries are added with deduplication. + // + Status = InternalGetBooterFromApfsPredefinedNameList ( + Device, + Root, + &ContainerInfo->Uuid, + NULL, + FilePath, + NULL + ); + if (!EFI_ERROR (TmpStatus)) { + Status = TmpStatus; } }