Code Monkey home page Code Monkey logo

ocquirks's Introduction

OcQuirks

OcQuirks is a drop in replacement EFI driver for Clover that replaces AptioMemoryFix and all OsxAptioFix variants. It is built against the OpenCore source tree, and supports OpenCore's quirks model.

Prerequisites

The OcQuirks EFI driver has a dependency on OpenRuntime.efi, and they must be installed together in the CLOVER EFI drivers directory. OpenRuntime.efi can be found in the release zip and is built along with OcQuirks.

Installation

To install OcQuirks, download the latest release or build it using the instructions below and then install it into your EFI replacing any existing memory fix driver.

  • Mount your EFI volume.
  • Back your EFI volume up to a bootable USB drive and verify that it works.
  • Remove AptioMemoryFix, and any OsxAptioFix variants from the Clover drivers folder on your EFI volume.
  • Add OcQuirks.efi, OpenRuntime.efi, and OcQuirks.plist to the Clover drivers folder on your EFI volume.
  • Reboot.

If your system has trouble booting, use your USB stick to boot back into macOS and revert by reversing the process. Inspect the parameters below and configure OcQuirks.plist with parameters that better match your system.

Default settings are based on AptioMemoryFix and are designed with new Intel systems in mind. Your system may require custom settings, (e.g., Z390 may need DevirtualiseMmio+ProtectUefiServices, Older 100-200 series might need EnableWriteUnprotector). It is also assumed that all slides are valid (no slide=X).

Configuration

The parameters listed below can be changed by dropping in OcQuirks.plist into your Clover drivers folder. This can be found in either the release zip or the root of the OcQuirks repository. If no plist is found, then the defaults below are used.

Quirk Default Value Description
AvoidRuntimeDefrag True Fix UEFI runtime services support on many firmwares.
DevirtualiseMmio False Reduce stolen memory footprint from memory map, incompatible with some systems
DisableSingleUser False A security option to ignore single user mode arguments.
DisableVariableWrite False A security option to protect macOS NVRAM write access.
DiscardHibernateMap False A legacy parameter to work around buggy memory maps. Preserves runtime memory size and location after wake from S4 sleep.
EnableSafeModeSlide True Patch the bootloader to enable KASLR in safe mode.
EnableWriteUnprotector False Permits write access to UEFI runtime services code. Use RebuildAppleMemoryMap if possible.
ForceExitBootServices True Ensures that calls to ExitBootServices succeed even with an outdated MemoryMap key.
MmioWhitelist Array Designed to be filled with plist dict values, describing addresses critical for particular firmware functioning when DevirtualiseMmio quirk is in use.
ProtectMemoryRegions False Protect memory regions from incorrect access. Only needed by very old firmwares.
ProtectSecureBoot False Protect UEFI Secure Boot variables from being written.
ProtectUefiServices False Protect UEFI services from being overridden by the firmware.
ProvideConsoleGopEnable True Install Graphics Output Protocol if missing from the console handle.
ProvideCustomSlide True Force macOS to use a pseudorandom value among available slide values.
ProvideMaxSlide 0 Overrides the maximum slide instead of 256 when ProvideCustomSlide is enabled.
RebuildAppleMemoryMap True Generate Memory Map compatible with macOS.
SetupVirtualMap True Workaround issues in some firmwares that access memory after SetVirtualAddress calls often resulting in boot crashes.
SignalAppleOS False This quirk is useful on Mac firmwares, which behave differently in different OS.
SyncRuntimePermissions True Update memory permissions for runtime environment.

For a more indepth description of quirks, review the OpenCore Configuration Manual.

Building

Building OcQuirks is simple, you just need macOS and time. You do not need to configure OcQuirks before building now, so all you need to do is follow the process below to build.

Clone the Repository

$ git clone https://github.com/ReddestDream/OcQuirks.git
$ cd OcQuirks

Build OcQuirks

Now build OcQuirks using the macbuild tool. You may be prompted to install additional tools before compilation begins.

$ ./macbuild.tool

Installation

Follow the installation procedures found earlier in the documentation, using the newly compiled version of OcQuirks which can be found in the OcQuirks/Binaries/RELEASE folder.

Credits

ocquirks's People

Contributors

1revenger1 avatar andrewwyatt avatar mhaeuser avatar reddestdream avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ocquirks's Issues

apfs volumes booting stuck on ++++

I have LG 17 Gram laptop 17z990. I can boot it with almost everything but can't boot apfs volumes. Of cause these apfs volumes are bootable. I can boot easily from those apfs volumes on my desktop system.
I tried different versions of clover and ocquirks, tried playing with ocquirks setting but nothing works.
It always stuck like this:

...
Start FinalizeBootStruct
Start RandomSeed
End RandomSeed
++++++++++++++++++++++++++++++++++++++++++++

The working config that boots everything including windows, linux and macos 10.15.3 is based on clover 5112, ocquirks 22 and this qcquirks.plist:
AvoidRuntimeDefrag true
DevirtualiseMmio true
DisableSingleUser false
DisableVariableWrite false
DiscardHibernateMap false
EnableSafeModeSlide true
EnableWriteUnprotector true
ForceExitBootServices true
MmioWhitelist array
ProtectMemoryRegions false
ProtectSecureBoot false
ProtectUefiServices true
ProvideConsoleGopEnable true
ProvideCustomSlide true
RebuildAppleMemoryMap false
SetupVirtualMap true
SignalAppleOS false
SyncRuntimePermissions true

Can't boot Allocating error

I tried almost every AptioMemoryFix efi's but cant boot; I tried this and getting this error;

ERROR allocating 0x119e1 pages at 0x0000000006257000 alloc type 2
Couldn't allocate runtime area
Boot failed: will sleep for 10 seconds before exiting...

If I used AptioMemoryFix.efi this time I am getting this error;

AMF: No slide values are usable! Falling back to 0 with 0x17771000 bytes!
ERROR allocating 0x119e1 pages at 0x0000000006257000 alloc type 2
Couldn't allocate runtime area
Boot failed: will sleep for 10 seconds before exiting...

Can't build

Hi

I can't build OcQuirks again (Mojave - Xcode 11.3.1). The error message below:

`Processing meta-data .Architecture(s) = X64
Build target = DEBUG
Toolchain = XCODE5

Active Platform = /Users/mathieu/OcQuirks/UDK/OcQuirks/OcQuirks.dsc

build.py...
/Users/mathieu/OcQuirks/UDK/OcQuirks/OcQuirks.dsc(...): error 4000: Instance of library class [TimerLib] is not found
in [/Users/mathieu/OcQuirks/UDK/OpenCorePkg/Library/OcBootManagementLib/OcBootManagementLib.inf] [X64]
consumed by module [/Users/mathieu/OcQuirks/UDK/OcQuirks/Platform/OcQuirks/OcQuirks.inf]

  • Failed -`

Git pull issue

Hi

Thanks for your work.

I've a issue with git pull: I can't update OcQuirks.dsc and OcQuirks.h

Can you help me. Please.

Kernel Panic with same Booter Quirks setting from OpenCore Bootloader

Screen Shot 2019-12-23 at 19 46 43
I have set same configuration OcQuirks.plist with my working Config.plist of OpenCore Bootloader.

I can boot normally with OpenCore Bootloader but fail and ended with kernel panic with OcQuirks.efi + FwRuntimeService.efi.

Here is the picture of Kernel Panic
IMG_3968

Just for Info my computer specifications
Proc : Intel Core i7 6700
Motherboard : Gigabyte Z170X Gaming 7
GPU : MSI Armor RX 580 4GB
Ram : 16GB

But thanks for your work, i use OcQuirks.efi + FwRuntimeServices.efi in my Dell E5450 with Clover r5101 and working normally (with same booter Quirks config from OpenCore bootloader).

I don't know why it's kernel panic in my PC,, i try to set ShrinkMemoryMap=Yes or ProvideCustomSlide = Yes or ProtectCsmRegion = Yes or ForceExitBootServices = Yes and other but still get Kernel Panic. In my OC Configuration i just need to set "AvoidRuntimeDefrag + EnableWriteUnprotector + SetupVirtualMap = YES".

Thanks you

rev22 crashes 10.15.4 z270XP-SLI

I'm running Clover 5107 (and have also tried 5109).

Using latest Weg, Lilu, AppleALC. FakeSMC.kext, XHCI-unsupported.kext, USBInjectAll.kext (as verified by Hackintool) and custom .aml for USB.

UEFI drivers (besides OcQuirks):
ApfsDriverLoader.efi, FSInject.efi, VBoxHfs.efi all dated 2/16/20

After Clover SSD selected, it starts for about 2 seconds and reboots 100%.

If I go back to rev 20, it doesn't reboot and I have no issues.

Great tools, had zero problem before this!! If there's some debug log I can get you, let me know?

i5-1035G1 using ERROR

Thank you for your hard work~! My laptop is Lenovo S740 with i5-1035G1. I have used all the "OsxAptioFix~" and "AptioMemoryFix~" as wll as OcQuirks. However, I never succeed in entering install interface and I got "ERROR allocating 0x83368 pages at 0x000000000fd53000 alloc type 2".Only when using OcQuirks the "0x000000000fd53000" would change every reboot, though the "OsxAptioFix" or "AptioMemoryFix" show the same value every reboot. What should I do? T_T

OcSupportPkg compatibility

Hello,

We made some internal changes in regards to OpenCore โ†โ†’ FwRuntimeServices compatibility. Since FwRuntimeServices is very close to OpenCore and OcSupportPkg, OcAppleBootCompatLib in particular, we moved FwRuntimeServices to be part of OcSupportPkg. From now on we will release FwRuntimeServices with OpenCore.

For your project this means that it is best to do the same, and distribute your own version of FwRuntimeServices with OcQuirks. Such approach should ensure compatibility between the drivers.

Also, while this is unrelated, we plan to perform further in AppleSupportPkg projects to improve integration with OpenCore. That means that some drivers will become OcSupportPkg libraries, and for those who want to use them in third-party projects, OcQuirks-like approach will be best. It will be great if you continue such work if you feel interested.

Best wishes,
Vit

Add support for MmioWhitelist.

MmioWhitelist was added to OcAppleBootCompatLib.h here:

acidanthera/OcSupportPkg@62d8899

It provides useful features allowing for more control over what addresses are devirtualized by DevirtualiseMMIO.

Rather than being a BOOLEAN value like all of the other Booter quirk settings, this one seems to parse an array.

acidanthera/OpenCorePkg@04186d0

Adding support for this will probably require the addition of something that can parse settings from a config file at runtime for OcQuirks, as has been suggested/requested by users. I will be looking into this myself, but I am also seeking any additional assistance with this addition/revision to OcQuirks. In addition, I'm looking for testers as my hardware does not require the DevirtualiseMMIO quirk at all. Thanks!

nasm error?

Hi, I am trying to create a new OCQuirck. Getting this error; It doesnt allow me to install nasm.

Screen Shot 2019-12-27 at 06 19 26

BlackScreen on Bios with aptio fixes

Hi, I have weird issue since final release of catalina. My Nvram works with osxaptio 1, 3, osxaptio2-wtf and aptioinput aswell but after catalina if I boot even once with these drivers, I cant access bios. When I try it hang out in black screen. If I use osxaptio2 all the time I can access bios but mlb and rom values becaming 0. Also if I get blackscreen once only way to revert that reflashing nvram with amibios tool. I have also tried OpenCore it has same issue as well. I have never experianced that kind of issue before on mojave.
Then I find that thread modified QcQuirks but only way to keep bios alive disabling mac's access to nvram "DisableVariableWrite" in that way nvram becoming meaningless("Nvram can't keep brightness value that way").

Device: Asus FX553VD i-7700hq.

OcQuirks.efi Revision 7 not working with latest FwRuntimeservices.efi

I'm trying to boot as you described in the ReadMe file in your repository, and I had no issues since the previous latest release of AppleSupportPkg: https://github.com/acidanthera/AppleSupportPkg/releases/tag/2.1.2

Now with the latest release https://github.com/acidanthera/AppleSupportPkg/releases/tag/2.1.4 I cannot use OcQuirks Rev7 with the latest FwRuntimeservices from Acidanthera, the system restarts even before loading the kernel probably because of NVRAM management in the latest release of FwRuntimeServices. Please let us know when a new version of OcQuirks.efi will support the latest FwRuntimeservices 2.1.4

Thank you

No boot after upgrade to build 22

Have updated ocquirks to 22 and now my os does not boot. And even better - it does not boot after I used usb flash drive with previously working efi and after I restored my efi to the previously working version (I always make a backup before any changes). Tried to reset nvram, checked and found it completely clear and empty. Still able to boot to the recovery or installer with the same efi. Clover 5108

IMG_3971
IMG_3972
IMG_3970

Another fix compilation need

Hi

I try to build OcQuirks without success this morning. I don't understand why. Please help me.

Building ... /Users/mathieu/OcQuirks/UDK/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf [X64] make: *** No rule to make target /Users/mathieu/OcQuirks/UDK/EfiPkg/Include/Protocol/DataHub.h', needed by `/Users/mathieu/OcQuirks/UDK/Build/OcQuirks/DEBUG_XCODE5/X64/OpenCorePkg/Library/OcDataHubLib/OcDataHubLib/OUTPUT/DataHub.obj'. Stop.

build.py...
: error 7000: Failed to execute command
make tbuild [/Users/mathieu/OcQuirks/UDK/Build/OcQuirks/DEBUG_XCODE5/X64/OpenCorePkg/Library/OcDataHubLib/OcDataHubLib]

build.py...
: error F002: Failed to build module
/Users/mathieu/OcQuirks/UDK/OpenCorePkg/Library/OcDataHubLib/OcDataHubLib.inf [X64, XCODE5, DEBUG]

  • Failed -
    Build end time: 07:52:25, May.26 2020
    Build total time: 00:00:02

./macbuild.tool: line 67: 5532 Terminated: 15 pingme $! build "$@"
logout`

Stuck at "AMF: Only 55/255 slide values are useable"

Hi, I was doing some tests on SMBIOS choices for my Skylake laptop. For a long time, I had been using clover with SMBIOS for MBP14,1 because it will boot only with this choice while opting for MBP13,1 or others will be stuck at boot.

In OC, I am able to boot with SMBIOS 13,1. No problem.

But with SMBIOS 13,1, I am not able to boot with Clover using aptiomemoryfix+FWruntimeservices.

If there is a way for me to assist, do guide me through the process of gathering debug files.

No audio from AudioDxe.efi during boot

Okay, this might be a small thing. But ever since I got audiodxe.efi working with bootchime.efi I have had the pleasure of hearing a boot chime (which I like very much).

Can't say this is worth your time, but it would be nice if it worked, just as it works in Clover (with AMF) and just as it works in OC (yes, even with 0.5.2, it works). I am also working the latest AudioDxe.efi and latest efi files I can from Clover (5098).

But having said that, all I can offer is praise for what you are doing. I hope you keep doing it! Thanks.

Unable to build on 10.15.7

Following your instructions, I have no luck to build the needed binaries on macOS Catalina 10.15.7

Building ... /tmp/OcQuirks/UDK/OcQuirks/Platform/OcQuirks/OcQuirks.inf [X64]
make: Nothing to be done for `tbuild'.
"clang" -MMD -MF /tmp/OcQuirks/UDK/Build/OcQuirks/DEBUG_XCODE5/X64/OcQuirks/Platform/OcQuirks/OcQuirks/OUTPUT/OcQuirks.obj.deps -target x86_64-pc-win32-macho -c -g -gdwarf -Os -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -Wno-varargs -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -D NO_MSABI_VA_FUNCS  -D OC_TARGET_DEBUG=1 -o /tmp/OcQuirks/UDK/Build/OcQuirks/DEBUG_XCODE5/X64/OcQuirks/Platform/OcQuirks/OcQuirks/OUTPUT/./OcQuirks.obj -I/tmp/OcQuirks/UDK/OcQuirks/Platform/OcQuirks -I/tmp/OcQuirks/UDK/Build/OcQuirks/DEBUG_XCODE5/X64/OcQuirks/Platform/OcQuirks/OcQuirks/DEBUG -I/tmp/OcQuirks/UDK/MdeModulePkg -I/tmp/OcQuirks/UDK/MdeModulePkg/Include -I/tmp/OcQuirks/UDK/MdePkg -I/tmp/OcQuirks/UDK/MdePkg/Include -I/tmp/OcQuirks/UDK/MdePkg/Test/UnitTest/Include -I/tmp/OcQuirks/UDK/MdePkg/Include/X64 -I/tmp/OcQuirks/UDK/OpenCorePkg -I/tmp/OcQuirks/UDK/OpenCorePkg/Include/AMI -I/tmp/OcQuirks/UDK/OpenCorePkg/Include/Acidanthera -I/tmp/OcQuirks/UDK/OpenCorePkg/Include/Apple -I/tmp/OcQuirks/UDK/OpenCorePkg/Include/Generic -I/tmp/OcQuirks/UDK/OpenCorePkg/Include/Intel -I/tmp/OcQuirks/UDK/OpenCorePkg/Include/Microsoft -I/tmp/OcQuirks/UDK/OpenCorePkg/Include/VMware -I/tmp/OcQuirks/UDK/OpenCorePkg/Include/Apple/X64 /tmp/OcQuirks/UDK/OcQuirks/Platform/OcQuirks/OcQuirks.c
/tmp/OcQuirks/UDK/OcQuirks/Platform/OcQuirks/OcQuirks.c:137:5: error: too few arguments to function call, expected 6, have 4
    );
    ^
/tmp/OcQuirks/UDK/OpenCorePkg/Include/Acidanthera/Library/OcStorageLib.h:117:1: note: 'OcStorageInitFromFs' declared here
EFI_STATUS
^
1 error generated.
make: *** [/tmp/OcQuirks/UDK/Build/OcQuirks/DEBUG_XCODE5/X64/OcQuirks/Platform/OcQuirks/OcQuirks/OUTPUT/OcQuirks.obj] Error 1

build.py...
 : error 7000: Failed to execute command
	make tbuild [/tmp/OcQuirks/UDK/Build/OcQuirks/DEBUG_XCODE5/X64/OcQuirks/Platform/OcQuirks/OcQuirks]

build.py...
 : error F002: Failed to build module
	/tmp/OcQuirks/UDK/OcQuirks/Platform/OcQuirks/OcQuirks.inf [X64, XCODE5, DEBUG]

- Failed -

Upstream compatibility

Hi,

In addition to just rebuilding with the latest OpenCorePkg master you will also need to fix memory range alignment in DSC: acidanthera/OpenCorePkg@f963012 and update the configuration.

Also note, that manual MmioWhitelist configuration is required on all Haswell chipsets if you want to use DevirtualiseMmio. Therefore I strongly recommend merging #18.

"Prerequisites" in readme is inaccurate

Found a small issue in the readme. The "Prerequisites" section states that FwRuntimeServices.efi needs to be downloaded separately, but it is actually already included in the release.

Thanks for this tool btw, worked fantastic for me! :)

Compile question?

This not an issue but I want to know cleary. While we compile the EFI files, we must make changes, inside the OcQuirks.c file or just in OcQuirks.plist?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.