Jump to content
3205 posts in this topic

Recommended Posts

Latest Updated to  r3575 at r3578

 

Clover EFI

v2.3k r3575:3578  
 
Why two revision in one Package ???
 
================= Post =================
[bUILD] Post
### /Applications/Xcode.app/Contents/Developer/usr/bin/Rez - SysError -37 during create of "sym/Clover_v2.3k_r3575:3578.pkg".
### /Applications/Xcode.app/Contents/Developer/usr/bin/Rez - Fatal error trying to open the resource file "sym/Clover_v2.3k_r3575:3578.pkg" for writing.
Fatal Error!
### /Applications/Xcode.app/Contents/Developer/usr/bin/Rez - Fatal Error, can't recover.
### /Applications/Xcode.app/Contents/Developer/usr/bin/Rez - Since errors occurred, sym/Clover_v2.3k_r3575:3578.pkg's resource fork was not completely updated.
### /Applications/Xcode.app/Contents/Developer/usr/bin/Rez - SysError -43 during set file info.
 
 --------------------------
 Building process complete!
 --------------------------
 
 Build info.
 ===========
  Package name: Clover_v2.3k_r3575:3578.pkg
  MD5:          da7e508297e3d86180758ffe3ac7fde3
  Version:      v2.3k
  Stage:        v2.3k
  Date/Time:    2016-06-26 11:11:24
  Built by:     chris
  Copyright     2012
 
edit*****  SOLVED
Now I am going to try a completed new Build!
 
Solved with a completed new Build!

 

To my seems more simple to create a key (supportedOSes) as string where you can write the supported OSes in a component separated by the "," char inside each KextsToPatch dictionary:

supportedOSes = 10.11,10.12,10.11.7

just an idea.

Clover should create an array by split the components separated by "," as supported Os for the relative patch. So can be dinamically applied  when the OS version match.

 

Another good idea.

But more complicate to release.

These way we can edit OS specific settings in GUI, in more huge GUI.

 

Very good, but it can't be applied to Clover sources without some refactoring.

#include <string.h> is impossible in the project. All string functions must be replaced by analogous. And I seems have no analog for strtok()

 

Hi Slice I have a working solution (made my own functions):

Platform.h.zip

Settings.c.zip

 

Only, I don't know where to keep the OSVersion, as you can see at line 1121 (Settings.c):

struct MatchOSes currOStoc; GetStrArraySeparatedByChar("10.11.6" /* need GetOSversion here */, '.',  &currOStoc);

..I had to do it manually and must be changed.

 

Usage:

 

MatchOS = 10.10.5,10.7,10.11.6,10.12.x

a string contains the OSes  separated by commas intrested for the KextsToPatch to be enabled. Can also be a sigle OS (w/o comma(s) in this case)

                       <dict>
				<key>MatchOS</key>
				<string>10.7.x,10.8.x,10.9.x,10.10.x,10.11.x</string>
				<key>Comment</key>
				<string>Zeroing 11d41983 codec (patched by AppleHDA Patcher.app)</string>
				<key>Find</key>
				<data>gxnUEQ==</data>
				<key>Name</key>
				<string>AppleHDA</string>
				<key>Replace</key>
				<data>AAAAAA==</data>
			</dict>
			<dict>
				<key>Comment</key>
				<string>Zeroing 11d4198a codec (patched by AppleHDA Patcher.app)</string>
				<key>MatchOS</key>
				<string>10.12.x</string>
				<key>Find</key>
				<data>ihnUEQ==</data>
				<key>Name</key>
				<string>AppleHDA</string>
				<key>Replace</key>
				<data>AAAAAA==</data>
			</dict> 

format like 10.12.x or 10.7.x means that all revisions of 10.12 or 10.7 are good to run the patch. Specific component like 10.11.6 mean that this patch will be activated only for 10.11.6 (not for 10.11.5 for example).

 

Limits:

MatchOS string should not begin or end with the separator (',') otherwise the patch will be disabled. In the event it would be a user error.

 

struct MatchOSes {

    UINTN   count;

    CHAR8  * array[100];

} MatchOSes;

 

the array is actually set to 100 components.. edit if you want a bigger/smaller capacity.

 

Log:

0:137  0:000  KextsToPatch: 6 requested
0:137  0:000  KextsToPatch 0: IOAHCIBlockStorage (Enable TRIM for SSD) (no MatchOS)
0:137  0:000   Kext bin patch, data len: 11
0:137  0:000  KextsToPatch 1: AppleUSBXHCIPCI (remove usb limit) (no MatchOS)
0:137  0:000   Kext bin patch, data len: 7
0:137  0:000  KextsToPatch 2: AppleHDA (Zeroing 11d41983 codec) (enabled by MatchOS)
0:137  0:000   Kext bin patch, data len: 4
0:137  0:000  KextsToPatch 3: AppleHDA (Zeroing 11d4198a codec (patched by AppleHDA Patcher.app)) (disabled by MatchOS)
0:137  0:000  KextsToPatch 4: AppleHDA (Zeroing 11d41984 codec (patched by AppleHDA Patcher.app)) (no MatchOS)
0:137  0:000   Kext bin patch, data len: 4
0:137  0:000  KextsToPatch 5: AppleHDA (Patching 11d4198b with 111d76e0 codec (patched by AppleHDA Patcher.app)) (no MatchOS)
0:137  0:000   Kext bin patch, data len: 4 

KextsToPatch 2 enabled and KextsToPatch 3 disabled because running in 10.11.6, all others have no "MatchOS" set and are working as usual  :D

This is an example, but the Scenario is cool because patching new Sierra's AppleHDA (for example) I need to zeroing one codec, instead in El Capitan another one.... like can be for other kexts :lol:

 

Need to be well tested but hope you like it  :)

  • Like 9

Usage:

 

MatchOS = 10.10.5,10.7,10.11.6,10.12.x

a string contains the OSes  separated by commas intrested for the KextsToPatch to be enabled. Can also be a sigle OS (w/o comma(s) in this case)

 

format like 10.12.x or 10.7.x means that all revisions of 10.12 or 10.7 are good to run the patch. Specific component like 10.11.6 mean that this patch will be activated only for 10.11.6 (not for 10.11.5 for example).

 

Limits:

MatchOS string should not begin or end with the separator (',') otherwise the patch will be disabled. In the event it would be a user error.

 

the array is actually set to 100 components..

I would like to see a regular expression library added to Clover (such as the one at https://github.com/cesanta/slre). It could be used in so many places to match strings in config.plist. In this case you're MatchOS string could look like this:

<key>MatchOS</key>
<string>^10\.(7|8|9|10|11)\..*</string>
In a more general case example, for "Arbitrary" properties, the "PciAddr" string could be replaced by a regular expression that can match to any properties of a device which Clover can concatenate into a larger string. Clover can construct a string using a known format containing the PciAddr, device id, vendor id, class code, name, device path, etc. Then the match string can be a regular expression that matches to any combination of those properties. This could make matching even more capable than Apple's info.plist IOKitPersonalities matches.

 

The regular expression could contain capture strings that could be used in subsequent regular expressions. For example, "Find", then "Replace".

 

A benefit of a regular expression is that it could be used to make a config setting applicable to more systems without modification. In the above PciAddr example, matching to a device id and vendor id might be more compatible (system independent) than a hard coded PciAddr (system dependent). In another case, a patch to rename an ACPI device could apply to multiple DSDTs if the Find string could be a regular expression containing all the source possibilities; example: Find "(AZAL|HDAS)" Replace: "HDEF".

  • Like 1

 

 

 

Hi Slice I have a working solution (made my own functions):

attachicon.gifPlatform.h.zip

attachicon.gifSettings.c.zip

 

Only, I don't know where to keep the OSVersion, as you can see at line 1121 (Settings.c):

struct MatchOSes currOStoc; GetStrArraySeparatedByChar("10.11.6" /* need GetOSversion here */, '.',  &currOStoc);

..I had to do it manually and must be changed.

 

Usage:

 

MatchOS = 10.10.5,10.7,10.11.6,10.12.x

a string contains the OSes  separated by commas intrested for the KextsToPatch to be enabled. Can also be a sigle OS (w/o comma(s) in this case)

                       <dict>
				<key>MatchOS</key>
				<string>10.7.x,10.8.x,10.9.x,10.10.x,10.11.x</string>
				<key>Comment</key>
				<string>Zeroing 11d41983 codec (patched by AppleHDA Patcher.app)</string>
				<key>Find</key>
				<data>gxnUEQ==</data>
				<key>Name</key>
				<string>AppleHDA</string>
				<key>Replace</key>
				<data>AAAAAA==</data>
			</dict>
			<dict>
				<key>Comment</key>
				<string>Zeroing 11d4198a codec (patched by AppleHDA Patcher.app)</string>
				<key>MatchOS</key>
				<string>10.12.x</string>
				<key>Find</key>
				<data>ihnUEQ==</data>
				<key>Name</key>
				<string>AppleHDA</string>
				<key>Replace</key>
				<data>AAAAAA==</data>
			</dict> 

format like 10.12.x or 10.7.x means that all revisions of 10.12 or 10.7 are good to run the patch. Specific component like 10.11.6 mean that this patch will be activated only for 10.11.6 (not for 10.11.5 for example).

 

Limits:

MatchOS string should not begin or end with the separator (',') otherwise the patch will be disabled. In the event it would be a user error.

 

struct MatchOSes {

    UINTN   count;

    CHAR8  * array[100];

} MatchOSes;

 

the array is actually set to 100 components.. edit if you want a bigger/smaller capacity.

 

Log:

0:137  0:000  KextsToPatch: 6 requested
0:137  0:000  KextsToPatch 0: IOAHCIBlockStorage (Enable TRIM for SSD) (no MatchOS)
0:137  0:000   Kext bin patch, data len: 11
0:137  0:000  KextsToPatch 1: AppleUSBXHCIPCI (remove usb limit) (no MatchOS)
0:137  0:000   Kext bin patch, data len: 7
0:137  0:000  KextsToPatch 2: AppleHDA (Zeroing 11d41983 codec) (enabled by MatchOS)
0:137  0:000   Kext bin patch, data len: 4
0:137  0:000  KextsToPatch 3: AppleHDA (Zeroing 11d4198a codec (patched by AppleHDA Patcher.app)) (disabled by MatchOS)
0:137  0:000  KextsToPatch 4: AppleHDA (Zeroing 11d41984 codec (patched by AppleHDA Patcher.app)) (no MatchOS)
0:137  0:000   Kext bin patch, data len: 4
0:137  0:000  KextsToPatch 5: AppleHDA (Patching 11d4198b with 111d76e0 codec (patched by AppleHDA Patcher.app)) (no MatchOS)
0:137  0:000   Kext bin patch, data len: 4 

KextsToPatch 2 enabled and KextsToPatch 3 disabled because running in 10.11.6, all others have no "MatchOS" set and are working as usual  :D

This is an example, but the Scenario is cool because patching new Sierra's AppleHDA (for example) I need to zeroing one codec, instead in El Capitan another one.... like can be for other kexts :lol:

 

Need to be well tested but hope you like it  :)

 

Interesting, but in addition to what @joevt said, you're missing the whole point of a structure. The structures in C were created in order to bypass the limitation of a predetermined array.

 

Try to solve the below problem and you'll understand what I mean.

http://cdn.cs50.net/2016/x/psets/5/pset5/pset5.html

Anyway, good try.  :) 

 

Best regards.

 

  • Like 1

 

 

 

Hi Slice I have a working solution (made my own functions):

attachicon.gifPlatform.h.zip

attachicon.gifSettings.c.zip

 

Only, I don't know where to keep the OSVersion, as you can see at line 1121 (Settings.c):

struct MatchOSes currOStoc; GetStrArraySeparatedByChar("10.11.6" /* need GetOSversion here */, '.',  &currOStoc);

..I had to do it manually and must be changed.

 

 

 

This is very significant note as OS version is not available at the time of reading config.plist.

But I like this idea and rework it using these procedures.

So, when reading config.plist we just remember what patch for a what and show this in debug.log.

When starting a Mac OS we determine its version and then apply patches if they allowed.

Some reformatting to Teano Code Style and some security improvements.

Revision 3580.

  • Like 1

I just built 3580 because I could really use this OS-specific patching to tidy things up.

 

However, it's not applying patches that are shared between OS versions. So if I'm booting 10.10.5 and have a patch that's valid for 10.10.x and 10.11.x it gets skipped. It will only apply patches that have MatchOS set to 10.10.x.

 

In bdmesg it shows the matched OSes for the patches so I'm guessing I have the syntax right for the MatchOS line (10.10.x,10.11.x,10.12.x).

  • Like 1

I just built 3580 because I could really use this OS-specific patching to tidy things up.

 

However, it's not applying patches that are shared between OS versions. So if I'm booting 10.10.5 and have a patch that's valid for 10.10.x and 10.11.x it gets skipped. It will only apply patches that have MatchOS set to 10.10.x.

 

In bdmesg it shows the matched OSes for the patches so I'm guessing I have the syntax right for the MatchOS line (10.10.x,10.11.x,10.12.x).

Please set

	<key>KernelAndKextPatches</key>
	<dict>
		<key>Debug</key>
		<true/>

and look on the screen what is happen.

 

Micky1979

 

Support 10.6 too.

Thanks

should work with all supported OS by Clover

 

Interesting, but in addition to what @joevt said, you're missing the whole point of a structure. The structures in C were created in order to bypass the limitation of a predetermined array.

 

Try to solve the below problem and you'll understand what I mean.

http://cdn.cs50.net/2016/x/psets/5/pset5/pset5.html

Anyway, good try.   :) 

 

Best regards.

 

Thanks. In truth the struct must have a fixed size known at compile time otherwise we have to use malloc to dinamically allocate space for it and then free it as soon as possible/where it possible. And no one can stop Slice to make it this way, I just thought this is really enough, to handle the new key. (I guess users don't make their thesis there ha ha)

Thanks also for the link that refear to some Academic stuff. Just 4 days ago I had my last "High School" diploma exam (explain my Thesis) as "Accountant"  programmers branch (chose that instead of commerce branch after the first two years) and now I need to think about college, but really do not know if it will have to deal with softwares since I'm already an active Dev on the Apple Store since last years (I'm selling softwares  :hysterical: ) What I mean is that also today I receive a small amount from "Payments and Finacial Reports" on Itunes, but Its not enough. Maybe I will look to maintain the interests of the family, but it requires a degree in Mechanical Engineering.. (90%)

I would like to see a regular expression library added to Clover (such as the one at https://github.com/cesanta/slre). It could be used in so many places to match strings in config.plist. In this case you're MatchOS string could look like this:

<key>MatchOS</key>

<string>^10\.(7|8|9|10|11)\..*</string>

Yep the idea is cool but is less simple for noobs, powerfull for advanced user.

 

This is very significant note as OS version is not available at the time of reading config.plist.

But I like this idea and rework it using these procedures.

So, when reading config.plist we just remember what patch for a what and show this in debug.log.

When starting a Mac OS we determine its version and then apply patches if they allowed.

Some reformatting to Teano Code Style and some security improvements.

Revision 3580.

Thanks  :thumbsup_anim:

 

I just built 3580 because I could really use this OS-specific patching to tidy things up.

 

However, it's not applying patches that are shared between OS versions. So if I'm booting 10.10.5 and have a patch that's valid for 10.10.x and 10.11.x it gets skipped. It will only apply patches that have MatchOS set to 10.10.x.

 

In bdmesg it shows the matched OSes for the patches so I'm guessing I have the syntax right for the MatchOS line (10.10.x,10.11.x,10.12.x).

 

I'm at Home just now.. going to try me too..

Please set

	<key>KernelAndKextPatches</key>
	<dict>
		<key>Debug</key>
		<true/>

and look on the screen what is happen.

 

Yep, that's what I've done. This is how I can see that when booting Yosemite on my X79 it's only applying the patches where the MatchOS is "10.10.x".

 

The patches where it's "10.10.x,10.11.x" or "10.10.x,10.11.x,10.12.x" aren't being applied.

 

I've attached a screengrab of a video I recorded of the debug boot. See how patches 7, 8 and 10 are applied. But 9 is disallowed.

 

Here's the relevant patch section of bdmesg. See that patch 9 is multi-OS while 7, 8 and 10 are only for Yosemite:

 

 

0:108  0:000  KextsToPatch 7: AppleIntelCPUPowerManagement (Sandy Bridge-E patch for 10.10 (1/7))Matched OSes: 10.10.x

0:108  0:000   Kext bin patch, data len: 12

0:108  0:000  KextsToPatch 8: AppleIntelCPUPowerManagement (Sandy Bridge-E patch for 10.10 (2/7))Matched OSes: 10.10.x

0:108  0:000   Kext bin patch, data len: 3

0:108  0:000  KextsToPatch 9: AppleIntelCPUPowerManagement (Sandy Bridge-E patch for 10.10 (3/7))Matched OSes: 10.10.x,10.11.x,10.12.x

0:108  0:000   Kext bin patch, data len: 4

0:108  0:000  KextsToPatch 10: AppleIntelCPUPowerManagement (Sandy Bridge-E patch for 10.10 (4/7))Matched OSes: 10.10.x

0:108  0:000   Kext bin patch, data len: 12

0:108  0:000  KextsToPatch 11: AppleIntelCPUPowerManagement (Sandy Bridge-E patch for 10.10 (5/7))Matched OSes: 10.10.x

0:108  0:000   Kext bin patch, data len: 3

0:108  0:000  KextsToPatch 12: AppleIntelCPUPowerManagement (Sandy Bridge-E patch for 10.10 (6/7))Matched OSes: 10.10.x,10.11.x,10.12.x

0:108  0:000   Kext bin patch, data len: 5

0:108  0:000  KextsToPatch 13: AppleIntelCPUPowerManagement (Sandy Bridge-E patch for 10.10 (7/7))Matched OSes: 10.10.x,10.11.x

 

post-267996-0-66273900-1467654554_thumb.jpg

looks like a problem comparing strings with "AsciiStrCmp". Each components of the MacOS key in config are splitted and the null character added to each one. Also 'CurrOS' have it?

EDIT not this problem looking at your spoiler. But what's it show running Sierra?


Asked this because if not applied you should not see "Kext bin patch, data len: 4" because the for loop "continue" w/o apply the patch.. I'm wrong?

looks like a problem comparing strings with "AsciiStrCmp". Each components of the MacOS key in config are splitted and the null character added to each one. Also 'CurrOS' have it?

EDIT not this problem looking at your spoiler. But what's it show running Sierra?

Asked this because if not applied you should not see "Kext bin patch, data len: 4" .. I'm wrong?

 

With Sierra it only applied the three patches that had MatchOS as "10.12.x" and then panicked because it had skipped the others.

 

As for the "Kext bin patch, data len: 4", I wasn't expecting to see that either.  But it seems that Clover still runs through all the patches, it just doesn't apply the ones that don't match the target OS.

Sorry, only first chunk 10.10.5 is analysed

+BOOLEAN IsOSValid(CHAR8 *MatchOS, CHAR8 *CurrOS)
+{
+  /* example for valid matches are:
+   10.7, only 10.7 (10.7.1 will be skipped)
+   10.10.2 only 10.10.2 (10.10.1 or 10.10.5 will be skipped)
+   10.10.x (or 10.10.X), in this case is valid for all minor version of 10.10 (10.10.(0-9))
+   */
+  struct MatchOSes osToc;
+  struct MatchOSes currOStoc;
+  BOOLEAN ret = FALSE;
+  INTN i;
+  
+  if (!MatchOS || !CurrOS) {
+    return TRUE; //undefined matched corresponds to old behavior
+  }
+  
+  GetStrArraySeparatedByChar(MatchOS, '.', &osToc);

Tomorrow will rework the algo.

  • Like 3

Yep the idea is cool but is less simple for noobs, powerfull for advanced user.

Of course we wouldn't want any change to affect existing config.plist's, so adding regular expression support would require a method to determine that the match string is a regular expression. Probably the best way to do that is by using a different key name, maybe with an RE suffix.
  • Like 1

..

Try Clover attached here works re-enabling the "IsPatchEnabled" function (adding the OS version as argument)

EDIT (please :) )

BOOTIA32.efi.zip

BOOTX64.efi.zip

CLOVERIA32.efi.zip

CLOVERX64.efi.zip

I changed the "10.10.x" entries to "10.10.x,10.11.x" and none of the patches were applied.

 

This was with my earlier compile of 3580, not the one you posted here. I rolled back so I could boot into Yosemite OK without the KP from partial patching.

  • Like 1

Ok you are right. Booting into el capitan works good, but booting in Sierra sure something is not applied even though the bdmesg apperar to be good:

0:384  0:000  KextsToPatch: 6 requested
0:384  0:000  KextsToPatch 0: IOAHCIBlockStorage (Enable TRIM for SSD) Kext bin patch, data len: 11
0:384  0:000  KextsToPatch 1: AppleUSBXHCIPCI (remove usb limit) Kext bin patch, data len: 7
0:384  0:000  KextsToPatch 2: AppleHDA (Zeroing 11d41983 codec)Matched OSes: 10.7.x,10.8.x,10.9.x,10.10.x,10.11.x
0:384  0:000   Kext bin patch, data len: 4
0:384  0:000  KextsToPatch 3: AppleHDA (Zeroing 11d4198a codec (patched by AppleHDA Patcher.app))Matched OSes: 10.12.x
0:384  0:000   Kext bin patch, data len: 4
0:384  0:000  KextsToPatch 4: AppleHDA (Zeroing 11d41984 codec (patched by AppleHDA Patcher.app)) Kext bin patch, data len: 4
0:384  0:000  KextsToPatch 5: AppleHDA (Patching 11d4198b with 111d76e0 codec (patched by AppleHDA Patcher.app)) Kext bin patch, data len: 4

They are all enabled.. In El Capitan my audio still work because Clover cannot find KextsToPatch 3

Looks good

Sergeys-iMac:1 slice$ gcc test_micky.c -o test_micky
Sergeys-iMac:1 slice$ ./test_micky 10.10.x,10.7,10.6.8 10.10.1
patch 10.10.x,10.7,10.6.8 is enabled for 10.10.1End
Sergeys-iMac:1 slice$ ./test_micky 10.10.x,10.7,10.6.8 10.10.5
patch 10.10.x,10.7,10.6.8 is enabled for 10.10.5End
Sergeys-iMac:1 slice$ ./test_micky 10.10.x,10.7,10.6.8 10.8
patch 10.10.x,10.7,10.6.8 is not enabled for 10.8End
Sergeys-iMac:1 slice$ ./test_micky 10.10.x,10.7,10.6.8 10.7.5
patch 10.10.x,10.7,10.6.8 is enabled for 10.7.5End
Sergeys-iMac:1 slice$ ./test_micky 10.10.x,10.7,10.6.8 10.6.3
patch 10.10.x,10.7,10.6.8 is not enabled for 10.6.3End
Sergeys-iMac:1 slice$ 

test_micky.c.zip

Looks good

Sergeys-iMac:1 slice$ gcc test_micky.c -o test_micky
Sergeys-iMac:1 slice$ ./test_micky 10.10.x,10.7,10.6.8 10.10.1
patch 10.10.x,10.7,10.6.8 is enabled for 10.10.1End
Sergeys-iMac:1 slice$ ./test_micky 10.10.x,10.7,10.6.8 10.10.5
patch 10.10.x,10.7,10.6.8 is enabled for 10.10.5End
Sergeys-iMac:1 slice$ ./test_micky 10.10.x,10.7,10.6.8 10.8
patch 10.10.x,10.7,10.6.8 is not enabled for 10.8End
Sergeys-iMac:1 slice$ ./test_micky 10.10.x,10.7,10.6.8 10.7.5
patch 10.10.x,10.7,10.6.8 is enabled for 10.7.5End
Sergeys-iMac:1 slice$ ./test_micky 10.10.x,10.7,10.6.8 10.6.3
patch 10.10.x,10.7,10.6.8 is not enabled for 10.6.3End
Sergeys-iMac:1 slice$ 

attachicon.giftest_micky.c.zip

 

I tried 3581 but it only applied patches 9, 12 and 13 and panicked afterwards. So now it's applying the patches with multiple OSes but skipping the ones with just a single matched OS.

 

Yes appear to be good less when only one os is given:

else {
    // str contains only one component and it is our string!
    mo->array[0] = str;
  }

when  is only one "token" fails because later we call "FreePool" but  is not allocated by malloc (AllocatePool). We have to use "AllocatePool" also for that otherwise cannot be freed.  

EDIT

 

or skip it if the count == 1

  • Like 1

Why I never get this log?

This patch is not allowed for booted OS..

Here my bootlog:

 

 

 

0:100  0:100  MemLog inited, TSC freq: 3410017843
0:100  0:000 
0:100  0:000  Now is 5.7.2016,  10:18:7 (GMT+7)
0:100  0:000  Starting Clover rev 3581 on American Megatrends EFI
0:100  0:000  Build with: [Args: ./ebuild.sh -a X64 -t XCLANG | Command: build --conf=/Users/cecekpawon/src/edk2/Clover/Conf -D USE_LOW_EBDA -p Clover/Clover.dsc -a X64 -b RELEASE -t XCLANG -n 5 | OS: 10.12]
...
0:113  0:000  Custom boot CUSTOM_BOOT_DISABLED (0x0)
0:113  0:000  KextsToPatch: 8 requested
0:113  0:000  KextsToPatch 0: AppleHDA (XXX Sleep 2) :: patch disabled, skipped
0:113  0:000  KextsToPatch 1: AppleHDA (XXX ASSERTION) :: patch disabled, skipped
0:113  0:000  KextsToPatch 2: AppleUSBXHCIPCI :: patch disabled, skipped
0:113  0:000  KextsToPatch 3: AppleIntelFramebufferCapri (DP [to] HDMI) :: patch disabled, skipped
0:113  0:000  KextsToPatch 4: AppleHDA (XXX AD1988) :: patch disabled, skipped
0:113  0:000  KextsToPatch 5: IOGraphicsFamily :: patch disabled, skipped
0:113  0:000  KextsToPatch 6: AppleHDA (XXX AD1988 , AD1984)Matched OSes: 10.11.4,10.11.5
0:113  0:000   Kext bin patch, data len: 4
0:113  0:000  KextsToPatch 7: AppleHDA (Zero 892 10.12)Matched OSes: 10.12
0:113  0:000   Kext bin patch, data len: 4
0:113  0:000  Default theme: embedded
0:113  0:000  LoadDrivers() start
...
0:519  0:000  KextsToPatch: 8 requested
0:519  0:000  KextsToPatch 0: AppleHDA (XXX Sleep 2) :: patch disabled, skipped
0:519  0:000  KextsToPatch 1: AppleHDA (XXX ASSERTION) :: patch disabled, skipped
0:519  0:000  KextsToPatch 2: AppleUSBXHCIPCI :: patch disabled, skipped
0:519  0:000  KextsToPatch 3: AppleIntelFramebufferCapri (DP [to] HDMI) :: patch disabled, skipped
0:519  0:000  KextsToPatch 4: AppleHDA (XXX AD1988) :: patch disabled, skipped
0:519  0:000  KextsToPatch 5: IOGraphicsFamily :: patch disabled, skipped
0:519  0:000  KextsToPatch 6: AppleHDA (XXX AD1988 , AD1984)Matched OSes: 10.11.4,10.11.5
0:519  0:000   Kext bin patch, data len: 4
0:519  0:000  KextsToPatch 7: AppleHDA (Zero 892 10.12)Matched OSes: 10.12
0:519  0:000   Kext bin patch, data len: 4
...
0:962  0:033  GUI ready
6:362  5:400  BootOption of the entry is empty
6:362  0:000  StartLoader() start
6:362  0:000  Entry->Settings: <null string>
6:362  0:000  Finally: Bus=100000kHz CPU=3400MHz
6:362  0:000  Kernel and Kext Patches at A97FD9F8:
6:362  0:000    Allowed: y
6:362  0:000    Debug: n
6:362  0:000    KernelCpu: n
6:362  0:000    Lapic: n
6:362  0:000    Haswell-E: n
6:362  0:000    AICPUPM: n
6:362  0:000    AppleRTC: n
6:362  0:000    KernelPm: n
6:362  0:000    FakeCPUID: 0x0
6:362  0:000    ATIController: null
6:362  0:000    ATIDataLength: 0
6:362  0:000    0 Kexts to load
6:362  0:000    2 Kexts to patch
6:362  0:000      KextPatch[0]: 4 bytes, AppleHDA
6:362  0:000      KextPatch[1]: 4 bytes, AppleHDA
6:362  0:000  Loading boot.efi  status=Success
6:442  0:080  GetOSVersion: : 10.12
6:442  0:000  insert table 9 for dev 19:0
6:443  0:000  Channels: 2

 

 

 

In Setting.c, maybe we can skip (no need to append into array) any patches data while it disabled.

 

 

 

STATIC
BOOLEAN
FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
                   TagPtr DictPointer)
{
  CHAR8   *KextPatchLabel;
  
  ...

  Prop = GetProperty (DictPointer, "KextsToPatch");
  if (Prop != NULL) {
    INTN   i, Count = GetTagCount (Prop);
    //delete old and create new
    if (Patches->KextPatches) {
      Patches->NrKexts = 0;
      FreePool (Patches->KextPatches);
    }
    if (Count > 0) {
      UINTN      j = 0;
      TagPtr     Prop2 = NULL;
      TagPtr     Dict;
      KEXT_PATCH *newPatches = AllocateZeroPool ((/*Patches->NrKexts + */Count) * sizeof(KEXT_PATCH));
      CHAR8      *KextPatchLabel;

      // Patches->NrKexts = 0;
      /*      if (Patches->KextPatches != NULL) {
       CopyMem (newPatches, Patches->KextPatches, (Patches->NrKexts * sizeof(KEXT_PATCH)));
       FreePool (Patches->KextPatches);
       } */

      Patches->KextPatches = newPatches;
      DBG ("KextsToPatch: %d requested\n", Count);
      for (i = 0; i < Count; i++) {
        EFI_STATUS Status = GetElement (Prop, i, &Prop2);
        if (EFI_ERROR (Status)) {
          DBG ("error %r getting next element at index %d\n", Status, i);
          continue;
        }

        if (Prop2 == NULL) {
          break;
        }

        DBG ("KextsToPatch %d:", i);

        Dict = GetProperty (Prop2, "Name");
        if (Dict == NULL) {
          DBG(" patch without Name, skipped\n");
          continue;
        }

        KextPatchLabel = AllocateCopyPool (AsciiStrSize (Dict->string), Dict->string);
        
        Dict = GetProperty (Prop2, "Comment");
        if (Dict != NULL) {
          DBG (" %a (%a)", KextPatchLabel, Dict->string);
        } else {
          DBG (" %a", KextPatchLabel);
        }

        Dict = GetProperty (Prop2, "Disabled");
        if ((Dict != NULL) && IsPropertyTrue (Dict)) {
          DBG(" :: patch disabled, skipped\n");
          continue;
        }

        Patches->KextPatches[Patches->NrKexts].Name  = NULL;
        Patches->KextPatches[Patches->NrKexts].Data  = NULL;
        Patches->KextPatches[Patches->NrKexts].Patch = NULL;
        Patches->KextPatches[Patches->NrKexts].Name = AllocateCopyPool (AsciiStrSize (KextPatchLabel), KextPatchLabel);

        FreePool(KextPatchLabel);
        
        // check enable/disabled patch (OS based) by Micky1979
        Dict = GetProperty (Prop2, "MatchOS");
        if ((Dict != NULL) && (Dict->type == kTagTypeString)) {
          Patches->KextPatches[Patches->NrKexts].MatchOS = AllocateCopyPool (AsciiStrSize (Dict->string), Dict->string);
          DBG(" :: Matched OSes: %a\n", Patches->KextPatches[Patches->NrKexts].MatchOS);
        }
        
        // check if this is Info.plist patch or kext binary patch
        Dict = GetProperty (Prop2, "InfoPlistPatch");
        Patches->KextPatches[Patches->NrKexts].IsPlistPatch = IsPropertyTrue (Dict);

 

 

 

Have  I missed something here master?

  • Like 1
×
×
  • Create New...