take into account custom entry may point to apfs partition

Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
SergeySlice 2020-12-01 22:09:30 +03:00
parent dc4a2617ff
commit 349e56a68a
4 changed files with 36 additions and 32 deletions

View File

@ -1211,7 +1211,7 @@ FindStartupDiskVolume (
// case insensitive cmp
if ( LoaderPath.equalIC(gEfiBootLoaderPath) ) {
// that's the one
DBG(" - found entry %lld. '%ls', Volume '%ls', '%ls'\n", Index, LoaderEntry.Title.s(), Volume->VolName.wc_str(), LoaderPath.wc_str());
DBG(" - found entry %lld. '%ls', Volume '%ls', '%ls'\n", Index, LoaderEntry.Title.s(), Volume->VolName.wc_str(), LoaderPath.wc_str());
return Index;
}
}

View File

@ -949,6 +949,7 @@ void GetCPUProperties (void)
break;
case 0x17: //Bronya: For AMD Family 17h Ryzen ! //
case 0x19: // and 19h Ryzen
{
// CoreCOF = (Core::X86::Msr::PStateDef[CpuFid[7:0]]/Core::X86::Msr::PStateDef[CpuDfsId])*200

View File

@ -48,6 +48,7 @@
#include "../gui/REFIT_MENU_SCREEN.h"
#include "Self.h"
#include "../include/OsType.h"
#include "../Platform/BootOptions.h"
#ifndef DEBUG_ALL
#define DEBUG_SCAN_LOADER 1
@ -1870,40 +1871,43 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex,
continue;
}
if (Volume->Hidden) {
DBG("skipped because volume is hidden\n");
continue;
}
// Check for exact volume matches (devicepath / volumelabel)
if (Custom->Volume.notEmpty()) {
if ((StrStr(Volume->DevicePathString.wc_str(), Custom->Volume.wc_str()) == NULL) &&
((Volume->VolName.isEmpty()) || (StrStr(Volume->VolName.wc_str(), Custom->Volume.wc_str()) == NULL))) {
DBG("skipped because volume does not match\n");
continue;
}
// NOTE: Sothor - We dont care about legacy OS type // Check if the volume should be of certain os type
//if ((Custom->Type != 0) && (Volume->OSType != 0) && !OSTYPE_COMPARE(OSType, Volume->OSType)) {
// DBG("skipped because wrong type (%d != %d)\n", OSType, Volume->OSType);
// continue;
//}
//} else if ((Custom->Type != 0) && (Volume->OSType != 0) && !OSTYPE_COMPARE(OSType, Volume->OSType)) {
//DBG("skipped because wrong type (%d != %d)\n", OSType, Volume->OSType);
//continue;
}
// Check the volume is readable and the entry exists on the volume
if (Volume->RootDir == NULL) {
DBG("skipped because filesystem is not readable\n");
continue;
}
/*
if (StriCmp(CustomPath, MACOSX_LOADER_PATH) == 0 && FileExists(Volume->RootDir, L"\\.IAPhysicalMedia")) {
DBG("skipped standard macOS path because volume is 2nd stage Install Media\n");
if (Volume->Hidden) {
DBG("skipped because volume is hidden\n");
continue;
}
*/
// Check for exact volume matches (devicepath / volumelabel)
if (Custom->Volume.notEmpty()) {
if ((StrStr(Volume->DevicePathString.wc_str(), Custom->Volume.wc_str()) == NULL) &&
((Volume->VolName.isEmpty()) || (StrStr(Volume->VolName.wc_str(), Custom->Volume.wc_str()) == NULL))) {
bool CustomEntryFound = false;
//..\VenMedia(BE74FCF7-0B7C-49F3-9147-01F4042E6842,E97E25EA28F4DF46AAD44CC3F12E28D3)
EFI_DEVICE_PATH *MediaPath = Clover_FindDevicePathNodeWithType(Volume->DevicePath, MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP);
if (MediaPath) {
EFI_GUID *MediaPathGuid = (EFI_GUID *)&((VENDOR_DEVICE_PATH_WITH_DATA*)MediaPath)->VendorDefinedData;
XStringW MediaPathGuidStr = GuidLEToXStringW(*MediaPathGuid);
// DBG(" checking '%ls'\n", MediaPathGuidStr.wc_str());
if (StrStr(Custom->Volume.wc_str(), MediaPathGuidStr.wc_str())) {
DBG(" - found entry for volume '%ls', '%ls'\n", Custom->Volume.wc_str(), MediaPathGuidStr.wc_str());
CustomEntryFound = true;
} else {
DBG(" - search volume '%ls', but MediaPath '%ls' \n", Custom->Volume.wc_str(), MediaPathGuidStr.wc_str());
}
}
if (!CustomEntryFound) {
DBG("skipped because volume does not match\n");
continue;
}
}
}
Guid = FindGPTPartitionGuidInDevicePath(Volume->DevicePath);
if (FindCustomPath) {

View File

@ -1247,7 +1247,7 @@ DBG("Beginning OC\n");
strncmp(InstallerVersion, "10.14", 5) &&
strncmp(InstallerVersion, "10.15", 5) &&
strncmp(InstallerVersion, "10.16", 5) &&
strncmp(InstallerVersion, "11.0", 4)) {
strncmp(InstallerVersion, "11.", 3)) {
InstallerVersion = NULL; // flag known version was not found
}
if (InstallerVersion != NULL) { // known version was found in image
@ -1256,7 +1256,6 @@ DBG("Beginning OC\n");
}
}
}
BuildVersion.setEmpty();
}
@ -1392,13 +1391,13 @@ DBG("Beginning OC\n");
// apianti - only block console output if using graphics
// but don't block custom boot logo
if (LoadOptions.containsIC("-v")) {
Flags = OSFLAG_UNSET(Flags, OSFLAG_USEGRAPHICS);
Flags = OSFLAG_UNSET(Flags, OSFLAG_USEGRAPHICS);
}
}
else if (OSTYPE_IS_WINDOWS(LoaderType)) {
if (AudioIo) {
AudioIo->StopPlayback(AudioIo);
AudioIo->StopPlayback(AudioIo);
}
DBG("Closing events for Windows\n");