Contribute
Register

[Guide] Using Clover to "hotpatch" ACPI

People working on hotpatching may find my utilities useful. https://github.com/gfoury/clover-config-plist-tools

check-dsdt-patches.py checks how many times a patch applies (zero is bad). It also can produce the results of hot-patching DSDT.aml, so you can examine them in iASL or in a hex editor. Run this to just check the current DSDT and config.plist:

Code:
$ check-dsdt-patches.py DSDT.aml

I have a similar script I use myself, although it actually applies all config.plist/DSDT/ACPI/Patches to an entire set of DSDT.aml+SSDT*.aml (intended to be used on ACPI/origin). That way you can disassemble the result (iasl -da -dl DSDT.aml SSDT*.aml) to verify the result of the hotpatch disassembles cleanly (no duplicates).

Note that zero patch matches are sometimes expected (config.plist files that are used on multiple models, such as my Probook github).

check-kext-patches.py does the same thing, except checking Clover config.plist kext patches against the current /System/Library and /Library. (This is a little tricky because of plugins.)

Does it deal with MatchOS?

Just for RehabMan, these utilities have a "short data" mode, where elements are placed on the same line:

Code:
                   <key>Find</key>
                   <data>QUJDAA==</data>

For Xcode users really... compatible with how Xcode writes plists.
 
I have a similar script I use myself, although it actually applies all config.plist/DSDT/ACPI/Patches to an entire set of DSDT.aml+SSDT*.aml (intended to be used on ACPI/origin). That way you can disassemble the result (iasl -da -dl DSDT.aml SSDT*.aml) to verify the result of the hotpatch disassembles cleanly (no duplicates).
Yeah, you can specify multiple .aml files to check-dsdt-patches.py, and it dumps them all separately to a destination directory if the directory is given.

Note that zero patch matches are sometimes expected (config.plist files that are used on multiple models, such as my Probook github).

Agreed. I still think people who are building config.plists for multiple machines are probably focusing on one machine at a time; I was. So I included Expect:1 clauses in that process. If I had another ASUS UX30xXX machine around, I'd probably comment out the Expects for a universal patch.

Does it deal with MatchOS?

...no...after its time. Will fix.

For Xcode users really... compatible with how Xcode writes plists.

Grr. I mean, I think it's superior, but it's not the canonical form as spit out by plutil -convert xml1 -o - config.plist. Sometimes the documentation is stricter, such as the Configurator certificate payload:
Code:
PayloadContent:  Data
Mandatory. The base64 representation of the payload with a line length of 52.

I haven't checked if mobileconfig clients accept the Xcode style.
 
I haven't checked if mobileconfig clients accept the Xcode style.

Any decent XML parser should ignore whitespace outside tags.
 
Introduction

Patching ACPI is always necessary to enable (near) full functionality when installing OS X on non-Apple hardware.

There is a complete guide here: http://www.tonymacx86.com/threads/guide-patching-laptop-dsdt-ssdts.152573/

[/ QUOTE]
Excuse me if you might not recommend fixing SSDTs? Keep DropOEM = False, so how to balance rename? Add a custom configuration set SSDT file to match DSDT? If you use DropOEM = ture, SSDT-Plugintype1 when using SSDT-CpuPM and SSDT-Cpu0Ist lost is not included in CLOVER \ ACPI \ patched? To keep the original loading order to place SSDT-Plugintype1.aml in that position? If it is the use of ssdtPRGen.sh generated SSDT.aml where the loading position and where is correct?
Patchmatic validation repair can be properly dismantled, compiled. Can go to the clover boot -V mode can see the error!

Please help me look at how to repair Thank you
 

Attachments

  • CLOVER.zip
    1.3 MB · Views: 85
  • MacBook Air.ioreg
    6.3 MB · Views: 120
  • extract.zip
    48.5 KB · Views: 82
  • reboot.jpg
    reboot.jpg
    266.9 KB · Views: 126
  • system.log.zip
    86.2 KB · Views: 82
If DropOEM = true, load CLOVER \ ACPI's AML. If you discard only CpuPM, Cpu0lst, custom *.aml, and what is the difference between loading sequence and priority execution?
patchmatic -extract There is no error in extracting the compilation validation

localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> Method parse/execution failed
2017-08-28 10:06:07.203704+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> Method parse/execution failed
2017-08-28 10:06:07.203706+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> [\_SB_.PCI0.BAT0._BIF] (Node ffffff801685ef90)
2017-08-28 10:06:07.203707+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> [\_SB_.PCI0.BAT0._BIF] (Node ffffff801685ef90)
2017-08-28 10:06:07.203718+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> , AE_BAD_PARAMETER
2017-08-28 10:06:07.203718+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> , AE_BAD_PARAMETER
2017-08-28 10:06:07.203720+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> (20140828/psparse-270)
2017-08-28 10:06:07.203721+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> (20140828/psparse-270)
2017-08-28 10:06:07.203724+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> ACPI Error:
2017-08-28 10:06:07.203725+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> ACPI Error:
2017-08-28 10:06:07.203726+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> Method parse/execution failed
2017-08-28 10:06:07.203727+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> Method parse/execution failed
2017-08-28 10:06:07.203729+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> [\_SB_.PCI0.BAT0._BIX] (Node ffffff801685f750)
2017-08-28 10:06:07.203731+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> [\_SB_.PCI0.BAT0._BIX] (Node ffffff801685f750)
2017-08-28 10:06:07.203732+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> , AE_BAD_PARAMETER
2017-08-28 10:06:07.203733+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> , AE_BAD_PARAMETER
2017-08-28 10:06:07.203735+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> (20140828/psparse-270)
2017-08-28 10:06:07.203736+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> (20140828/psparse-270)
2017-08-28 10:06:08.207029+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> ACPI Exception: AE_BAD_PARAMETER,
2017-08-28 10:06:08.207032+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> ACPI Exception: AE_BAD_PARAMETER,
2017-08-28 10:06:08.207035+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> Returned by Handler for [EmbeddedControl]
2017-08-28 10:06:08.207037+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> Returned by Handler for [EmbeddedControl]
2017-08-28 10:06:08.207041+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> (20140828/evregion-170)
2017-08-28 10:06:08.207042+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> (20140828/evregion-170)
2017-08-28 10:06:08.207047+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> ACPI Error:
2017-08-28 10:06:08.207048+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> ACPI Error:
2017-08-28 10:06:08.207052+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> Method parse/execution failed
2017-08-28 10:06:08.207054+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> Method parse/execution failed
2017-08-28 10:06:08.207057+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> [\_SB_.PCI0.LPCB.EC__.SMBR] (Node ffffff8016866b50)
2017-08-28 10:06:08.207060+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> [\_SB_.PCI0.LPCB.EC__.SMBR] (Node ffffff8016866b50)
2017-08-28 10:06:08.207062+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> , AE_BAD_PARAMETER
2017-08-28 10:06:08.207064+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> , AE_BAD_PARAMETER
2017-08-28 10:06:08.207066+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> (20140828/psparse-270)
2017-08-28 10:06:08.207068+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> (20140828/psparse-270)
2017-08-28 10:06:08.207076+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> ACPI Error:
2017-08-28 10:06:08.207078+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> ACPI Error:
2017-08-28 10:06:08.207080+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> Method parse/execution failed
2017-08-28 10:06:08.207082+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> Method parse/execution failed
2017-08-28 10:06:08.207086+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> [\_SB_.PCI0.LPCB.EC__.BIF9] (Node ffffff801685f850)
2017-08-28 10:06:08.207088+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> [\_SB_.PCI0.LPCB.EC__.BIF9] (Node ffffff801685f850)
2017-08-28 10:06:08.207090+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> , AE_BAD_PARAMETER
2017-08-28 10:06:08.207091+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> , AE_BAD_PARAMETER
2017-08-28 10:06:08.207094+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> (20140828/psparse-270)
2017-08-28 10:06:08.207096+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> (20140828/psparse-270)
2017-08-28 10:06:08.207101+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> ACPI Error:
2017-08-28 10:06:08.207102+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> ACPI Error:
2017-08-28 10:06:08.207105+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> Method parse/execution failed
2017-08-28 10:06:08.207106+0800 localhost kernel[0]: (AppleACPIPlatform) <AppleACPIPlatform`AcpiOsVprintf> Method parse/execution failed
 
If DropOEM = true, load CLOVER \ ACPI's AML. If you discard only CpuPM, Cpu0lst, custom *.aml, and what is the difference between loading sequence and priority execution?
patchmatic -extract There is no error in extracting the compilation validation

For the hardware in your profile you should not drop any SSDTs, CPU related or otherwise.
If you use DropOem=true (because you need to patch SSDTs statically), you should include all of them in ACPI/patched.

Of course, this guide is the hotpatch guide, so really your question is off-topic. With hotpatch, we patch everything with config.plist, therefore there are no SSDTs in ACPI/patched (and no DSDT.aml either), therefore DropOem is always false for hotpatch scenarios.
 
Tips for complex Rename and Replace
General procedure:
- start with native ACPI
....

- for the EC fields, create another EC OperationRegion (use a name that is different from the original) and Field definition as a sort of "overlay" which contains only the EC fields you need to patch
- to create the EC overlay, you can use the patched Field/OperationRegion in the patched DSDT, then eliminate unpatched fields
- use External to allow the replacement methods in the SSDT to access the fields defined elsewhere in the ACPI set (usually DSDT)
- let the compiler point out where you need to use External
- watch out for symbols with duplicate names in different scopes

Let's look at an example.... <todo: left off here: later, use u430 example>
Hi,I try to patch battery "hotpatch" into the ssdt-battery.dsl,I find out the EC fields and patched them.but stop when doing "create the EC overlay/use External to allow the replacement methods in the SSDT".if I paste relate method into dsl file, MACiASL show "syntax error, unexpected PARSEOP_METHOD, expecting $end and premature End-Of-File."unexpected PARSEOP_METHOD mate cause by missing relate External,but I can't find out what cause expecting $end and premature End-Of-File.this patch for Laptop: Dell 7559 i5.
 

Attachments

  • origin.zip
    56 KB · Views: 80
  • relate_methon.zip
    1.8 KB · Views: 69
  • ssdt-battery.dsl.zip
    2.1 KB · Views: 87
  • patched_DSDT.aml
    102.6 KB · Views: 78
Hi,I try to patch battery "hotpatch" into the ssdt-battery.dsl,I find out the EC fields and patched them.but stop when doing "create the EC overlay/use External to allow the replacement methods in the SSDT".if I paste relate method into dsl file, MACiASL show "syntax error, unexpected PARSEOP_METHOD, expecting $end and premature End-Of-File."unexpected PARSEOP_METHOD mate cause by missing relate External,but I can't find out what cause expecting $end and premature End-Of-File.this patch for Laptop: Dell 7559 i5.

Fix your sloppy indenting and you will see your close braces are not balanced.
 
Huh?
kextcache output shows the unsigned/patched kexts you have installed (and whether they are installed correctly).
It is an important diagnosis tool.
Hint: You should have already done it before asking for help.

Note: This guide is for advanced users that know what they are doing.

sorry, that was meant to be a joke..

my bad.
 
Back
Top