变色龙给驱动打补丁实现USB驱动无需USBInjectAll.kext

变色龙最新版本Enoch_R2921已经有给KEXT打补丁的功能,与Clover类似,或者说是从Clover搬过来的功能。

变色龙的配置文件存放在/Extra/目录,有以下几个文件:

kernel.plist   //内核补丁配置文件
kexts.plist    //驱动补丁配置文件
org.chameleon.boot.plist //启动参数配置文件
smbios.plist   //SMBIOS机型配置文件

今天的主角是kexts.plist,利用它可以实现自动对驱动打二进制补丁和Info.plist补丁

该文件主要有几个配置项:

1.KextsPatches

这个项目下面可以添加多个驱动程序的二进制补丁,比如可以对AppleRTC,AppleHDA打补丁。

每个子项目要添加的参数有:

Comment注释内容,该内容会在启动的时候,打印到屏幕上;

MatchOS匹配的系统版本,如10.11.X,其中X表示任意数字,只有系统版本匹配才会执行补丁的内容;

Find要查找的数据,这是以Base64编码的16进制内容(建议用 plistEditor(点击下载) 查看和修改数据);

Replace替换的数据内容,当查找到上面的数据时,将其替换为以下内容,注意数据长度要保持一致;

2.ForceToLoad

这个项目下面可以添加要强制加载的驱动程序。

目前还不知道什么情况下会用到这个。

3.PersonalitiesInjector

这个项目下面可以添加驱动注入的配置,其效果相当于直接修改某个驱动的Info.plist

应该只对目标驱动程序的配置有效。

使用方法是把目标驱动程序的Info.plist里面的复制下来,粘贴到这里面。

然后修改对应的参数,比如IONameMatch,PCIMatch等等。

  1. 最后来贴上我的配置文件以作参考:
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
  <dict>
    <key>KextsPatches</key>
    <dict>
      <key>AppleRTC</key>
      <array>
        <dict>
          <key>Comment</key>
          <string>Patch AppleRTC</string>
          <key>MatchOS</key>
          <string>10.11.x</string>
          <key>Find</key>
          <data>QYnXQYn2</data>
          <key>Replace</key>
          <data>6Z8AAACQ</data>
        </dict>
      </array>
    </dict>
    <key>ForceToLoad</key>
    <array>
      <string>AppleHDA</string>
    </array>
    <key>PersonalitiesInjector</key>
    <dict>
      <key>USBInjector</key>
      <dict>
        <key>MatchOS</key>
        <string>10.11.x</string>
        <key>Comment</key>
        <string>USB EHCI Injector</string>
        <key>OSBundleRequired</key>
        <string>Root</string>
        <key>IOKitPersonalities</key>
        <dict>
          <key>MacBookPro7,1-EHC1</key>
          <dict>
            <key>CFBundleIdentifier</key>
            <string>com.apple.driver.AppleUSBMergeNub</string>
            <key>IOClass</key>
            <string>AppleUSBMergeNub</string>
            <key>IONameMatch</key>
            <string>EHC1</string>
            <key>IOProviderClass</key>
            <string>AppleUSBEHCIPCI</string>
            <key>IOProviderMergeProperties</key>
            <dict>
              <key>kUSBMuxEnabled</key>
              <true/>
            </dict>
            <key>model</key>
            <string>MacBookPro7,1</string>
          </dict>
          <key>MacBookPro7,1-EHC2</key>
          <dict>
            <key>CFBundleIdentifier</key>
            <string>com.apple.driver.AppleUSBMergeNub</string>
            <key>IOClass</key>
            <string>AppleUSBMergeNub</string>
            <key>IONameMatch</key>
            <string>EHC2</string>
            <key>IOProviderClass</key>
            <string>AppleUSBEHCIPCI</string>
            <key>IOProviderMergeProperties</key>
            <dict>
              <key>kUSBMuxEnabled</key>
              <true/>
            </dict>
            <key>model</key>
            <string>MacBookPro7,1</string>
          </dict>
        </dict>
      </dict>
    </dict>
  </dict>
</plist>