Merge branch 'opencore_integration' of https://github.com/CloverHackyColor/CloverBootloader into opencore_integration

This commit is contained in:
SergeySlice 2020-09-18 16:29:34 +03:00
commit 9f65c910dc
12 changed files with 348 additions and 69 deletions

View File

@ -148,12 +148,14 @@
!ifdef DEBUG_ON_SERIAL_PORT
BaseSerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
!else
BaseSerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
!endif
BaseDebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
DebugLib|OpenCorePkg/Library/OcDebugLogLib/OcDebugLogLib.inf
#DebugLib|OpenCorePkg/Library/OcDebugLogLib/OcDebugLogLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
@ -185,7 +187,6 @@
OcConsoleLib|OpenCorePkg/Library/OcConsoleLib/OcConsoleLib.inf
OcCpuLib|OpenCorePkg/Library/OcCpuLib/OcCpuLib.inf
OcCryptoLib|OpenCorePkg/Library/OcCryptoLib/OcCryptoLib.inf
OcDebugLogLib|OpenCorePkg/Library/OcDebugLogLib/OcDebugLogLib.inf
OcDevicePathLib|OpenCorePkg/Library/OcDevicePathLib/OcDevicePathLib.inf
OcFileLib|OpenCorePkg/Library/OcFileLib/OcFileLib.inf
OcMemoryLib|OpenCorePkg/Library/OcMemoryLib/OcMemoryLib.inf
@ -199,7 +200,6 @@
OcTemplateLib|OpenCorePkg/Library/OcTemplateLib/OcTemplateLib.inf
OcXmlLib|OpenCorePkg/Library/OcXmlLib/OcXmlLib.inf
OcDeviceTreeLib|OpenCorePkg/Library/OcDeviceTreeLib/OcDeviceTreeLib.inf
OcDebugLogLib|OpenCorePkg/Library/OcDebugLogLib/OcDebugLogLib.inf
OcDataHubLib|OpenCorePkg/Library/OcDataHubLib/OcDataHubLib.inf
OcAppleImg4Lib|OpenCorePkg/Library/OcAppleImg4Lib/OcAppleImg4Lib.inf
OcAppleKernelLib|OpenCorePkg/Library/OcAppleKernelLib/OcAppleKernelLib.inf
@ -210,7 +210,7 @@
OcAppleSecureBootLib|OpenCorePkg/Library/OcAppleSecureBootLib/OcAppleSecureBootLib.inf
OcAppleImageVerificationLib|OpenCorePkg/Library/OcAppleImageVerificationLib/OcAppleImageVerificationLib.inf
OcDriverConnectionLib|OpenCorePkg/Library/OcDriverConnectionLib/OcDriverConnectionLib.inf
OcDebugLogLib|OpenCorePkg/Library/OcDebugLogLib/OcDebugLogLib.inf
#OcDebugLogLib|OpenCorePkg/Library/OcDebugLogLib/OcDebugLogLib.inf
OcAcpiLib|OpenCorePkg/Library/OcAcpiLib/OcAcpiLib.inf
OcAppleEventLib|OpenCorePkg/Library/OcAppleEventLib/OcAppleEventLib.inf
#OcAppleImageConversionLib|OpenCorePkg/Library/OcAppleImageConversionLib/OcAppleImageConversionLib.inf
@ -228,6 +228,7 @@
#OcPngLib|OpenCorePkg/Library/OcPngLib/OcPngLib.inf
OpenCoreLib|OpenCorePkg/Platform/OpenCore/OpenCoreLib.inf
OcDebugLogLibOc2Clover|OpenCorePkg/Library/OcDebugLogLibOc2Clover/OcDebugLogLibOc2Clover.inf
#MachoLib|Library/MachoLib/MachoLib.inf
@ -282,6 +283,216 @@
#
###################################################################################################
[Components]
OpenCorePkg/Platform/OpenCore/OpenCoreLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcGuardLib/OcGuardLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcAfterBootCompatLib/OcAfterBootCompatLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcAppleBootPolicyLib/OcAppleBootPolicyLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcAppleChunklistLib/OcAppleChunklistLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcAppleDiskImageLib/OcAppleDiskImageLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcAppleKeyMapLib/OcAppleKeyMapLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcAppleKeysLib/OcAppleKeysLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcAppleRamDiskLib/OcAppleRamDiskLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcBootManagementLib/OcBootManagementLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcCompressionLib/OcCompressionLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcConsoleLib/OcConsoleLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcCpuLib/OcCpuLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcCryptoLib/OcCryptoLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcDevicePathLib/OcDevicePathLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcFileLib/OcFileLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcMemoryLib/OcMemoryLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcMiscLib/OcMiscLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcOSInfoLib/OcOSInfoLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcRngLib/OcRngLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcRtcLib/OcRtcLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcSerializeLib/OcSerializeLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcStringLib/OcStringLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcStorageLib/OcStorageLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcTemplateLib/OcTemplateLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcXmlLib/OcXmlLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcDeviceTreeLib/OcDeviceTreeLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcDataHubLib/OcDataHubLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcAppleImg4Lib/OcAppleImg4Lib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcAppleKernelLib/OcAppleKernelLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcMachoLib/OcMachoLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcVirtualFsLib/OcVirtualFsLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcMacInfoLib/OcMacInfoLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcApfsLib/OcApfsLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcAppleSecureBootLib/OcAppleSecureBootLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcAppleImageVerificationLib/OcAppleImageVerificationLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcDriverConnectionLib/OcDriverConnectionLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
#OcDebugLogLib|OpenCorePkg/Library/OcDebugLogLib/OcDebugLogLib.inf
OpenCorePkg/Library/OcAcpiLib/OcAcpiLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcAppleEventLib/OcAppleEventLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
#OcAppleImageConversionLib|OpenCorePkg/Library/OcAppleImageConversionLib/OcAppleImageConversionLib.inf
OpenCorePkg/Library/OcAudioLib/OcAudioLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcInputLib/OcInputLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcAppleUserInterfaceThemeLib/OcAppleUserInterfaceThemeLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcConfigurationLib/OcConfigurationLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcDevicePropertyLib/OcDevicePropertyLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcFirmwareVolumeLib/OcFirmwareVolumeLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcHashServicesLib/OcHashServicesLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcSmbiosLib/OcSmbiosLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcSmcLib/OcSmcLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcUnicodeCollationEngLib/OcUnicodeCollationEngGenericLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
OpenCorePkg/Library/OcPeCoffLib/OcPeCoffLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
#OcPngLib|OpenCorePkg/Library/OcPngLib/OcPngLib.inf
OpenCorePkg/Platform/OpenCore/OpenCoreLib.inf {
<BuildOptions>
*_*_*_CC_FLAGS = -include OpenCoreFromClover.h
}
#DuetPkg/BootSector/BootSector.inf
#DuetPkg/DxeIpl/DxeIpl.inf {
@ -552,8 +763,7 @@
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x07
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0xFFFFFFFF
<LibraryClasses>
DebugLib|OpenCorePkg/Library/OcDebugLogLib/OcDebugLogLib.inf
#DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
}
@ -641,8 +851,7 @@
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0xFFFFFFFF
<LibraryClasses>
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
DebugLib|OpenCorePkg/Library/OcDebugLogLib/OcDebugLogLib.inf
#DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
}
!else
@ -671,8 +880,7 @@
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0xFFFFFFFF
<LibraryClasses>
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
DebugLib|OpenCorePkg/Library/OcDebugLogLib/OcDebugLogLib.inf
#DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
}
!else
@ -748,7 +956,7 @@ DEFINE EXIT_USBKB_FLAG = -DEXIT_USBKB
!endif
DEFINE BUILD_OPTIONS=-DCLOVER_BUILD $(VBIOS_PATCH_CLOVEREFI_FLAG) $(ONLY_SATA_0_FLAG) $(BLOCKIO_FLAG) $(NOUSB_FLAG) $(NOUDMA_FLAG) $(AMD_FLAG) $(SECURE_BOOT_FLAG) $(ANDX86_FLAG) $(PS2MOUSE_LEGACYBOOT_FLAG) $(DEBUG_ON_SERIAL_PORT_FLAG) $(EXIT_USBKB_FLAG)
DEFINE BUILD_OPTIONS=-DMDEPKG_NDEBUG -DCLOVER_BUILD $(VBIOS_PATCH_CLOVEREFI_FLAG) $(ONLY_SATA_0_FLAG) $(BLOCKIO_FLAG) $(NOUSB_FLAG) $(NOUDMA_FLAG) $(AMD_FLAG) $(SECURE_BOOT_FLAG) $(ANDX86_FLAG) $(PS2MOUSE_LEGACYBOOT_FLAG) $(DEBUG_ON_SERIAL_PORT_FLAG) $(EXIT_USBKB_FLAG)
#MSFT:*_*_*_CC_FLAGS = /FAcs /FR$(@R).SBR /wd4701 /wd4703 $(BUILD_OPTIONS)
MSFT:*_*_*_CC_FLAGS = /FAcs $(BUILD_OPTIONS) -Dinline=__inline /Zi -D DISABLE_NEW_DEPRECATED_INTERFACES -D OC_TARGET_DEBUG

View File

@ -194,6 +194,9 @@
## Include/Protocol/OcAudio.h
gOcAudioProtocolGuid = {0x4B228577, 0x6274, 0x4A48, {0x82, 0xAE, 0x07, 0x13, 0xA1, 0x17, 0x19, 0x87}}
gEfiDataHubProtocolGuid = { 0xAE80D021, 0x618E, 0x11D4, { 0xBC, 0xD7, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }}
gEfiProcessorSubClassGuid = { 0x26fdeb7e, 0xb8af, 0x4ccf, { 0xaa, 0x97, 0x02, 0x63, 0x3c, 0xe4, 0x8c, 0xa7 }}

View File

@ -58,6 +58,8 @@
gEfiDiskIoProtocolGuid
gEfiDiskIo2ProtocolGuid
gEfiGraphicsOutputProtocolGuid
gEfiDataHubProtocolGuid ## PRODUCES
gEfiProcessorSubClassGuid
[Depex]

@ -1 +1 @@
Subproject commit d17192301a02083188e358cec281a072729a1d5e
Subproject commit bc0b403c614504c083c28c89f6a85494d5b492fd

View File

@ -67,7 +67,7 @@
BaseLib
UefiLib
UefiDriverEntryPoint
#OcDataHubLib
OcDataHubLib
[Protocols]

View File

@ -39,6 +39,11 @@ then
fi
> ./serial0_qemu_out.log # empty file without erasing it. Useful for editor for refreshing and reloading.
if ! [ -f "$SCRIPT_DIR"/disk_image_gpt.img ]
then
unzip -o "$SCRIPT_DIR"/disk_image_gpt.img.zip
rm -rf "$SCRIPT_DIR"/__MACOSX
fi
hdiutil attach ./disk_image_gpt.img || exit 1
shopt -s nocasematch
@ -67,6 +72,7 @@ then
-device VGA,vgamem_mb=64,edid=on,xres=1024,yres=768 \
-device ahci,id=ahi \
-drive format=raw,id=hda,file=./disk_image_gpt.img \
-cdrom "/JiefLand/3.Infos/3.Infos-Mac/MacOs/11.0.20A5343j Big Sur/BigSurInstall.iso" \
-usb \
-device usb-mouse,bus=usb-bus.0,port=2 \
-device usb-kbd,bus=usb-bus.0,port=1 \

View File

@ -57,7 +57,7 @@ PrintBytes(IN VOID *Bytes, IN UINTN Number)
}
}
static EFI_FILE_PROTOCOL* gLogFile = NULL;
EFI_FILE_PROTOCOL* GetDebugLogFile()
{
@ -66,6 +66,8 @@ EFI_FILE_PROTOCOL* GetDebugLogFile()
EFI_FILE_PROTOCOL *RootDir;
EFI_FILE_PROTOCOL *LogFile;
if ( gLogFile ) return gLogFile;
// get RootDir from device we are loaded from
Status = gBS->HandleProtocol(gImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);
if (EFI_ERROR(Status)) {
@ -77,13 +79,21 @@ EFI_FILE_PROTOCOL* GetDebugLogFile()
}
// Open log file from current root
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG,
EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
if ( GlobalConfig.ScratchDebugLogAtStart && Status == EFI_SUCCESS)
{
EFI_STATUS StatusDelete;
StatusDelete = LogFile->Delete(LogFile);
if ( StatusDelete == EFI_SUCCESS) {
Status = EFI_NOT_FOUND; // to get it created next.
}else{
DebugLog(1, "Cannot delete log file %ls from current root : %s\n", DEBUG_LOG, efiStrError(StatusDelete));
}
}
// If the log file is not found try to create it
if (Status == EFI_NOT_FOUND) {
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG,
EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
}
RootDir->Close(RootDir);
RootDir = NULL;
@ -92,12 +102,20 @@ EFI_FILE_PROTOCOL* GetDebugLogFile()
// try on first EFI partition
Status = egFindESP(&RootDir);
if (!EFI_ERROR(Status)) {
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG,
EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
if ( GlobalConfig.ScratchDebugLogAtStart && Status == EFI_SUCCESS)
{
EFI_STATUS StatusDelete;
StatusDelete = LogFile->Delete(LogFile);
if ( StatusDelete == EFI_SUCCESS) {
Status = EFI_NOT_FOUND; // to get it created next.
}else{
DebugLog(1, "Cannot delete log file %ls from 1st EFI partition : %s\n", DEBUG_LOG, efiStrError(StatusDelete));
}
}
// If the log file is not found try to create it
if (Status == EFI_NOT_FOUND) {
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG,
EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
}
RootDir->Close(RootDir);
RootDir = NULL;
@ -108,12 +126,14 @@ EFI_FILE_PROTOCOL* GetDebugLogFile()
LogFile = NULL;
}
gLogFile = LogFile;
return LogFile;
}
VOID SaveMessageToDebugLogFile(IN CHAR8 *LastMessage)
{
EFI_STATUS Status;
STATIC BOOLEAN FirstTimeSave = TRUE;
// STATIC UINTN Position = 0;
CHAR8 *MemLogBuffer;
@ -134,7 +154,7 @@ VOID SaveMessageToDebugLogFile(IN CHAR8 *LastMessage)
// Advance to the EOF so we append
EFI_FILE_INFO *Info = EfiLibFileInfo(LogFile);
if (Info) {
LogFile->SetPosition(LogFile, Info->FileSize);
Status = LogFile->SetPosition(LogFile, Info->FileSize);
// If we haven't had root before this write out whole log
if (FirstTimeSave) {
Text = MemLogBuffer;
@ -142,9 +162,11 @@ VOID SaveMessageToDebugLogFile(IN CHAR8 *LastMessage)
FirstTimeSave = FALSE;
}
// Write out this message
LogFile->Write(LogFile, &TextLen, Text);
Status = LogFile->Write(LogFile, &TextLen, Text);
Status = LogFile->Flush(LogFile);
(void)Status;
}
LogFile->Close(LogFile);
// LogFile->Close(LogFile);
}
}
@ -228,3 +250,25 @@ EFI_STATUS SaveBooterLog(IN EFI_FILE_HANDLE BaseDir OPTIONAL, IN CONST CHAR16 *F
return egSaveFile(BaseDir, FileName, (UINT8*)MemLogBuffer, MemLogLen);
}
/*
* Redirection of OpenCore log to Clover Log.
*/
/*
* This function is called from OpenCore when there is a DEBUG ((expression))
* Mapping from DEBUG to DebugLogForOC is made in OpenCoreFromClover.h
*/
VOID EFIAPI DebugLogForOC(IN INTN DebugLevel, IN CONST CHAR8 *FormatString, ...)
{
VA_LIST Marker;
if (FormatString == NULL ) return;
// Print message to log buffer
VA_START(Marker, FormatString);
MemLogVA(TRUE, 1, FormatString, Marker);
VA_END(Marker);
}

View File

@ -10,12 +10,9 @@ extern "C" {
#endif
#include <Uefi/UefiBaseType.h>
#include <Protocol/SimpleFileSystem.h> // for EFI_FILE_HANDLE
#ifdef __cplusplus
} // extern "C"
#endif
//#define SAFE_LOG_SIZE 80
//#define MSG_LOG_SIZE (256 * 1024)
@ -60,4 +57,18 @@ PrintBytes (
IN UINTN Number
);
/*
* OpenCore
*/
// This use the EDK format
VOID EFIAPI DebugLogForOC(IN INTN DebugLevel, IN CONST CHAR8 *FormatString, ...);
#ifdef __cplusplus
} // extern "C"
#endif
#endif

View File

@ -852,7 +852,11 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
Prop = DictPointer->propertyForKey("OcKernelCache");
if (Prop != NULL || gBootChanged) {
if ( Prop->isString() ) {
Patches->OcKernelCache = Prop->getString()->stringValue();
if ( Prop->getString()->stringValue().notEmpty() ) {
Patches->OcKernelCache = Prop->getString()->stringValue();
}else{
Patches->OcKernelCache = "Auto"_XS8;
}
}else{
MsgLog("MALFORMED PLIST : KernelAndKextPatches/KernelCache must be a string");
Patches->OcKernelCache = "Auto"_XS8;
@ -861,9 +865,11 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
{
const TagDict* OcQuirksDict = DictPointer->dictPropertyForKey("OcQuirks");
if ( !OcQuirksDict ) panic("Cannot find OcQuirks under KernelAndKextPatches (OC kernel quirks)");
if ( OcQuirksDict )
{
Prop = OcQuirksDict->propertyForKey("AppleCpuPmCfgLock");
if ( !Prop ) panic("Cannot find AppleCpuPmCfgLock in OcQuirks under KernelAndKextPatches (OC kernel quirks)");
if (Prop != NULL || gBootChanged) {
Patches->OcKernelQuirks.AppleCpuPmCfgLock = IsPropertyNotNullAndTrue(Prop);
}
@ -2258,7 +2264,21 @@ GetEarlyUserSettings (
}
Prop = BootDict->propertyForKey("Debug");
GlobalConfig.DebugLog = IsPropertyNotNullAndTrue(Prop);
if ( Prop ) {
if ( Prop->isString() ) {
if ( Prop->getString()->stringValue().equalIC("true") ) GlobalConfig.DebugLog = true;
else if ( Prop->getString()->stringValue().equalIC("false") ) GlobalConfig.DebugLog = false;
else if ( Prop->getString()->stringValue().equalIC("scratch") ) {
GlobalConfig.DebugLog = true;
GlobalConfig.ScratchDebugLogAtStart = true;
}
else MsgLog("MALFORMED config.plist : property Boot/Debug must be true, false, or scratch\n");
}else if ( Prop->isBool() ) {
GlobalConfig.DebugLog = Prop->getBool()->boolValue();
}else{
MsgLog("MALFORMED config.plist : property Boot/Debug must be a string (true, false, or scratch) or <true/> or <false/>\n");
}
}
Prop = BootDict->propertyForKey("Fast");
GlobalConfig.FastBoot = IsPropertyNotNullAndTrue(Prop);
@ -2900,10 +2920,12 @@ GetEarlyUserSettings (
}
}
const TagDict* OcQuirksDict = CfgDict->dictPropertyForKey("Quirks");
const TagDict* OcQuirksDict = CfgDict->dictPropertyForKey("OcQuirks");
if ( !OcQuirksDict ) panic("Cannot find OcQuirks under root (OC booter quirks)");
if (OcQuirksDict != NULL) {
const TagStruct* Prop;
Prop = OcQuirksDict->propertyForKey("AvoidRuntimeDefrag");
if ( !Prop ) panic("Cannot find AvoidRuntimeDefrag in OcQuirks under root (OC booter quirks)");
gSettings.ocBooterQuirks.AvoidRuntimeDefrag = IsPropertyNotNullAndTrue(Prop);
gSettings.QuirksMask |= gSettings.ocBooterQuirks.AvoidRuntimeDefrag? QUIRK_DEFRAG:0;
Prop = OcQuirksDict->propertyForKey( "DevirtualiseMmio");

View File

@ -822,6 +822,7 @@ public:
BOOLEAN LegacyFirst;
BOOLEAN NoLegacy;
BOOLEAN DebugLog;
BOOLEAN ScratchDebugLogAtStart;
BOOLEAN FastBoot;
BOOLEAN NeverHibernate;
BOOLEAN StrictHibernate;
@ -867,7 +868,8 @@ public:
};
*
*/
REFIT_CONFIG() : Timeout(-1), DisableFlags(0), TextOnly(FALSE), Quiet(TRUE), LegacyFirst(FALSE), NoLegacy(FALSE), DebugLog(FALSE), FastBoot(FALSE), NeverHibernate(FALSE), StrictHibernate(FALSE),
REFIT_CONFIG() : Timeout(-1), DisableFlags(0), TextOnly(FALSE), Quiet(TRUE), LegacyFirst(FALSE), NoLegacy(FALSE),
DebugLog(FALSE), ScratchDebugLogAtStart(FALSE), FastBoot(FALSE), NeverHibernate(FALSE), StrictHibernate(FALSE),
RtcHibernateAware(FALSE), HibernationFixup(FALSE), SignatureFixup(FALSE), Theme(), ScreenResolution(), ConsoleMode(0), CustomIcons(FALSE), IconFormat(ICON_FORMAT_DEF), NoEarlyProgress(FALSE), Timezone(0xFF),
ShowOptimus(FALSE), Codepage(0xC0), CodepageSize(0xC0) {};
REFIT_CONFIG(const SIDELOAD_KEXT& other) = delete; // Can be defined if needed

View File

@ -353,7 +353,8 @@
BaseDebugPrintErrorLevelLib
BaseSerialPortLib
OpenCoreLib
OcDebugLogLib
#OcDebugLogLib
OcDebugLogLibOc2Clover
[Guids]
gEfiAcpiTableGuid

View File

@ -1007,7 +1007,7 @@ extern "C" {
#include <Library/OcVirtualFsLib.h>
#include <Library/OcConfigurationLib.h>
#include <Library/OcDevicePathLib.h>
#include <Library/OcDebugLogLib.h>
extern OC_GLOBAL_CONFIG mOpenCoreConfiguration;
extern OC_STORAGE_CONTEXT mOpenCoreStorage;
extern OC_CPU_INFO mOpenCoreCpuInfo;
@ -1276,16 +1276,16 @@ VOID LOADER_ENTRY::StartLoader11()
//
DbgHeader("RestSetup macOS");
//
//// DBG("SetDevices\n");
// SetDevices(this);
//// DBG("SetFSInjection\n");
// //SetFSInjection();
// //PauseForKey(L"SetFSInjection");
//// DBG("SetVariablesForOSX\n");
// SetVariablesForOSX(this);
//// DBG("SetVariablesForOSX\n");
//// EventsInitialize(this);
//// DBG("FinalizeSmbios\n");
// DBG("SetDevices\n");
SetDevices(this);
// DBG("SetFSInjection\n");
//SetFSInjection();
//PauseForKey(L"SetFSInjection");
// DBG("SetVariablesForOSX\n");
SetVariablesForOSX(this);
// DBG("SetVariablesForOSX\n");
// EventsInitialize(this);
// DBG("FinalizeSmbios\n");
FinalizeSmbios();
//
// SetCPUProperties();
@ -1364,7 +1364,7 @@ VOID LOADER_ENTRY::StartLoader11()
// OcAppleDebugLogInstallProtocol(0);
//debugStartImageWithOC(); // ok BS_I
//debugStartImageWithOC();
DBG("Beginning OC\n");
UINT64 CPUFrequencyFromART;
@ -1396,9 +1396,9 @@ DBG("Beginning OC\n");
if ( GlobalConfig.DebugLog ) {
mOpenCoreConfiguration.Misc.Debug.AppleDebug = true;
mOpenCoreConfiguration.Misc.Debug.ApplePanic = true;
mOpenCoreConfiguration.Misc.Debug.DisableWatchDog = true;
mOpenCoreConfiguration.Misc.Debug.DisplayLevel = 2151678018;
mOpenCoreConfiguration.Misc.Debug.Target = 65;
// mOpenCoreConfiguration.Misc.Debug.DisableWatchDog = true; // already done by Clover ?
mOpenCoreConfiguration.Misc.Debug.DisplayLevel = 0x80400042;
mOpenCoreConfiguration.Misc.Debug.Target = 0x41;
}
OC_STRING_ASSIGN(mOpenCoreConfiguration.Misc.Security.SecureBootModel, "Disabled");
@ -2424,26 +2424,6 @@ RefitMain (IN EFI_HANDLE ImageHandle,
construct_globals_objects(gImageHandle); // do this after SelfLoadedImage is initialized
// UINT64 CPUFrequencyFromART;
// InternalCalculateARTFrequencyIntel(&CPUFrequencyFromART, NULL, 1);
//
// EFI_LOADED_IMAGE* OcLoadedImage;
// Status = gBS->HandleProtocol(gImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &OcLoadedImage);
// EFI_SIMPLE_FILE_SYSTEM_PROTOCOL* FileSystem = LocateFileSystem(OcLoadedImage->DeviceHandle, OcLoadedImage->FilePath);
// Status = OcStorageInitFromFs(&mOpenCoreStorage, FileSystem, L"EFI\\CLOVER", NULL);
//
// OcConfigureLogProtocol (
// 9,
// 0,
// 2151678018,
// 2147483648,
// OPEN_CORE_LOG_PREFIX_PATH,
// mOpenCoreStorage.FileSystem
// );
// DEBUG ((DEBUG_INFO, "OC: Log initialized...\n"));
// OcAppleDebugLogInstallProtocol(0);
#ifdef JIEF_DEBUG
// all_tests();