choose other volume root

Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
SergeySlice 2022-03-08 21:57:31 +03:00
parent 5f9f7072a3
commit 9598d7ec94
4 changed files with 29 additions and 15 deletions

View File

@ -594,7 +594,7 @@
}
MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
#MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
#MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
CloverEFI/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
#MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
@ -618,7 +618,7 @@
<LibraryClasses>
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
}
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
#MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
CloverEFI/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
#UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
#UefiCpuPkg/CpuDxe/CpuDxe.inf

View File

@ -91,7 +91,7 @@ INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
#INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
#INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
INF CloverEFI/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
@ -102,7 +102,7 @@ INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
INF CloverEFI/OsxSmbiosGenDxe/SmbiosGen.inf
#INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
INF CloverEFI/OsxBdsDxe/BdsDxe.inf
INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
#INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF CloverEFI/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
#INF UefiCpuPkg/CpuDxe/CpuDxe.inf

View File

@ -147,9 +147,9 @@ XStringW LOADER_ENTRY::getKextPlist(const EFI_FILE* Root, const XStringW& dirPat
}
TempName = SWPrintf("%ls\\%ls", FullName.wc_str(), L"Contents\\Info.plist");
#ifndef LESS_DEBUG
//#ifndef LESS_DEBUG
MsgLog("info plist path: %ls\n", TempName.wc_str());
#endif
//#endif
if (!FileExists(Root, TempName)) {
//try to find a planar kext, without Contents
TempName = SWPrintf("%ls\\%ls", FullName.wc_str(), L"Info.plist");

View File

@ -1114,6 +1114,7 @@ void LOADER_ENTRY::StartLoader()
//CFBundleExecutable
XBool NoContents = false;
XStringW infoPlistPath = getKextPlist(&self.getCloverDir(), dirPath, KextEntry.FileName, &NoContents); //it will be fullPath, including dir
DBG("InfoPlistPath=%ls\n", infoPlistPath.wc_str());
TagDict* dict = getInfoPlist(&self.getCloverDir(), infoPlistPath);
// XBool inject = checkOSBundleRequired(dict);
XBool inject = true;
@ -1162,7 +1163,7 @@ void LOADER_ENTRY::StartLoader()
mOpenCoreConfiguration.Kernel.Force.Values = (OC_KERNEL_ADD_ENTRY**)malloc(valuesSize); // sizeof(OC_KERNEL_FORCE_ENTRY*) == sizeof(ptr)
memset(mOpenCoreConfiguration.Kernel.Force.Values, 0, valuesSize);
const XStringW empty;
// empty.setEmpty();
for (size_t kextIdx = 0 ; kextIdx < KernelAndKextPatches.ForceKextsToLoad.size() ; kextIdx++ )
{
@ -1185,18 +1186,31 @@ void LOADER_ENTRY::StartLoader()
XBool NoContents = false;
REFIT_VOLUME * SystemVolume = Volume;
EFI_FILE* SysRoot = Volume->RootDir;
if (Volume->ApfsRole == APPLE_APFS_VOLUME_ROLE_PREBOOT) {
DBG("boot from Preboot, index=%llu\n", Volume->Index);
SystemVolume = &Volumes[Volume->Index+1];
DBG("next volume has role=%d\n", SystemVolume->ApfsRole);
DBG("boot from Preboot, index=%llu\n", Volume->Index);
int numbers = Volumes.size();
int sysIndex;
for (sysIndex=Volume->Index; sysIndex<numbers; sysIndex++) {
SystemVolume = &Volumes[sysIndex];
SysRoot = SystemVolume->RootDir;
if (FileExists(SysRoot, forceKext.wc_str())) break;
SysRoot = NULL;
}
if (SysRoot != NULL) {
DBG("next volume has role=%d\n", SystemVolume->ApfsRole);
} else {
SysRoot = Volume->RootDir;
DBG("failed to find sysroot\n");
}
}
XStringW infoPlistPath = getKextPlist(SystemVolume->RootDir, empty, forceKext, &NoContents); //it will be fullPath, including dir
TagDict* dictInfo = getInfoPlist(SystemVolume->RootDir, infoPlistPath);
const XStringW empty = SWPrintf("\\");
XStringW infoPlistPath = getKextPlist(SysRoot, empty, forceKext, &NoContents); //it will be fullPath, including dir
TagDict* dictInfo = getInfoPlist(SysRoot, infoPlistPath);
if (dictInfo) {
DBG("Info.plist at %ls\n", infoPlistPath.wc_str());
DBG("Info.plist at %ls\n", infoPlistPath.wc_str());
}
XString8 execpath = getKextExecPath(SystemVolume->RootDir, empty, forceKext, dictInfo, NoContents);
XString8 execpath = getKextExecPath(SysRoot, empty, forceKext, dictInfo, NoContents);
// for kext IOAudioFamily BundlePath = System\Library\Extensions\IOAudioFamily.kext
// ExecutablePath = Contents/MacOS/IOAudioFamily