Fix kext path when in an OEM folder.

This commit is contained in:
jief666 2020-10-03 23:56:50 +03:00
parent b8a188382c
commit 458d071ec9
4 changed files with 17 additions and 10 deletions

@ -1 +1 @@
Subproject commit d134b6051728c0493c2f1127e586a07fe77a052f
Subproject commit 519672e7f7996f308d11c81c9438aa9c18ccaee4

View File

@ -24,7 +24,7 @@ protected:
EFI_DEVICE_PATH* m_CloverDirFullDevicePath; // full path, including device, to this efi.
EFI_FILE* m_CloverDir; // opened m_SelfDirPath
XStringW m_CloverDirPathAsXStringW; // full path, including device, to this efi.
XStringW m_CloverDirPath; // dirname containing this efi (contains just the dir, not the device path)
// XStringW m_CloverDirPath; // dirname containing this efi (contains just the dir, not the device path)
// bool m_OemDirExists;
// EFI_FILE *m_OemDir;
@ -38,7 +38,7 @@ protected:
public:
Self () : m_SelfImageHandle(NULL), m_SelfLoadedImage(NULL), m_SelfDevicePath(NULL), m_SelfDevicePathAsXStringW(),
m_SelfSimpleVolume(NULL), m_SelfRootDir(NULL),
m_CloverDirFullDevicePath(NULL), m_CloverDir(NULL), m_CloverDirPathAsXStringW(), m_CloverDirPath(), m_ThemesDirExists(false), m_ThemesDir(0) {};
m_CloverDirFullDevicePath(NULL), m_CloverDir(NULL), m_CloverDirPathAsXStringW()/*, m_CloverDirPath()*/, m_ThemesDirExists(false), m_ThemesDir(0) {};
Self(const Self&) = delete;
Self& operator = (const Self&) = delete;
@ -61,7 +61,7 @@ public:
const EFI_DEVICE_PATH& getCloverDirFullDevicePath() { return *m_CloverDirFullDevicePath; }
const EFI_FILE& getCloverDir() { return *m_CloverDir; }
const XStringW& getCloverDirPathAsXStringW() { return m_CloverDirPathAsXStringW; }
const XStringW& getCloverDirPath() { return m_CloverDirPath; } // returns path containing this efi. Like \\EFI\\CLOVER
// const XStringW& getCloverDirPath() { return m_CloverDirPath; } // returns path containing this efi. Like \\EFI\\CLOVER
// bool oemDirExists() { return m_OemDirExists; }
// const EFI_FILE& getOemDir() { return *m_OemDir; } // Oem dir name under SelfDir. Like "OEM\\MyBoard"

View File

@ -1959,10 +1959,10 @@ void REFIT_MENU_SCREEN::DrawTextCorner(UINTN TextC, UINT8 Align)
case TEXT_CORNER_REVISION:
// Display Clover boot volume
if (SelfVolume->VolLabel.notEmpty() && SelfVolume->VolLabel[0] != L'#') {
Text = SWPrintf("%ls, booted from %ls", gFirmwareRevision, SelfVolume->VolLabel.wc_str());
Text = SWPrintf("%ls, booted from %ls %ls", gFirmwareRevision, SelfVolume->VolLabel.wc_str(), self.getCloverDirPathAsXStringW().wc_str());
}
if (Text.isEmpty()) {
Text = SWPrintf("%ls %ls", gFirmwareRevision, SelfVolume->VolName.wc_str());
Text = SWPrintf("%ls %ls %ls", gFirmwareRevision, SelfVolume->VolName.wc_str(), self.getCloverDirPathAsXStringW().wc_str());
}
break;
case TEXT_CORNER_HELP:

View File

@ -1035,15 +1035,22 @@ DBG("Beginning OC\n");
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Add.Values[kextIdx]->MaxKernel, "");
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Add.Values[kextIdx]->MinKernel, "");
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Add.Values[kextIdx]->Identifier, "");
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Add.Values[kextIdx]->BundlePath, S8Printf("%ls\\%ls", KextEntry.KextDirNameUnderOEMPath.wc_str(), KextEntry.FileName.wc_str()).c_str()); // do NOT delete kextArray, or make a copy.
XString8 bundlePath = S8Printf("%ls\\%ls\\%ls", selfOem.getKextsPathRelToSelfDir().wc_str(), KextEntry.KextDirNameUnderOEMPath.wc_str(), KextEntry.FileName.wc_str());
if ( FileExists(&self.getCloverDir(), bundlePath) ) {
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Add.Values[kextIdx]->BundlePath, bundlePath.c_str());
}else{
DBG("Cannot find kext bundlePath at '%s'\n", bundlePath.c_str());
}
XStringW execpath = S8Printf("Contents\\MacOS\\%ls", KextEntry.FileName.subString(0, KextEntry.FileName.rindexOf(".")).wc_str());
XStringW fullPath = SWPrintf("%s\\%ls", OC_BLOB_GET(&mOpenCoreConfiguration.Kernel.Add.Values[kextIdx]->BundlePath), execpath.wc_str());
if ( FileExists(&selfOem.getKextsDir(), fullPath) ) {
if ( FileExists(&self.getCloverDir(), fullPath) ) {
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Add.Values[kextIdx]->ExecutablePath, S8Printf("Contents\\MacOS\\%ls", KextEntry.FileName.subString(0, KextEntry.FileName.rindexOf(".")).wc_str()).c_str());
}
XStringW infoPlistPath = SWPrintf("%s\\Contents\\Info.plist", OC_BLOB_GET(&mOpenCoreConfiguration.Kernel.Add.Values[kextIdx]->BundlePath));
if ( FileExists(&selfOem.getKextsDir(), infoPlistPath) ) {
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Add.Values[kextIdx]->PlistPath, "Contents/Info.plist"); // TODO : is always Contents/Info.plist ?
if ( FileExists(&self.getCloverDir(), infoPlistPath) ) {
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Add.Values[kextIdx]->PlistPath, "Contents/Info.plist"); // TODO : is always Contents/Info.plist ?
}else{
DBG("Cannot find kext info.plist at '%ls'\n", infoPlistPath.wc_str());
}