Hardware .kext Patching List
In a nutshell, kexts are the drivers in the Mac OS X world.
The base Mac OS X has several kernel extensions, known as .kext, which are compatible with more than the device IDs they are programmed with. First and foremost, a .kext is not a file, but a directory of files and subfolders which together create a working kernel extension.
Here's a list of the default kernel extensions with their behaviour.
 .kext Patching Procedure
If we say patching kexts, we mean, that we add the PNPID number of our device to a kext. The PNPID is a unique identifer for the device. (Think of it as a model number.) As a result, OSX will try to use the patched kext on our device.
quote by zhell:
- Some KEXTs use the "device-id" of devices attached to the PCI bus to decide (i) whether to start and (ii) to tweak their behavior depending on the specific device.
- This allows some but far from all KEXTs to be tricked into believing that you have hardware that is used by Apple and thus enjoying support from Apple's drivers.
In some cases, a release of OS X, 10.4.1 or 10.4.3 for example, may have a working .kext for your hardware, but the version you are using does not. Generally speaking, a .kext from an older release of the OS usually can run without any changes when put into proper place in your current Operating System.
In other cases, an Info.plist file inside a .kext needs to have some information added. Usually this information comes in the form of a Plug-And-Play (PNP) device ID code. The following information is adapted from the entry for Audio, because the procedure fits most any kext changes involving PNP ID.
This guide assumes you have a working OS X system with limited functionality (e.g., Ethernet or audio not working) that you wish to patch. This guide relies on a patch table (at the end) which must be contributed to by readers, to help smooth the road to OS X functionality for those who follow. Please contribute to the Hardware .kext Patching List#Patch Table if you have discovered something that belongs there.
If you are simply copying an extension from some other drive or disc, you can proceed with Hardware .kext Patching List#Repairing permissions in part 2.
 Find IDs
You need to find the PNPID for your device. The PNPID consists of the Device ID + the Vendor ID of your device. By the way, the PCIID is the PNPID in reverse order (VendorID and DeviceID have changed positions), Vendor ID+Device ID. So you have to find the Vendor ID and Device ID for your device.
PNPID = DeviceID+VendorID
Windows users may
1) find the Device id in Windows Device Manager (Control Panel > System > Hardware > Device Manager) Right Click the device > Properties > Details > Compatible Ids. It will be in the form "PCI\VEN_[here is the Vendor ID]&DEV_[here is the Device ID]&..."
2) use DXdiag (Start > Run > dxdiag) can give you Device ID from the "device" panel (upper left) of whatever tab pertains to your device. Note that devices that either do not install in Windows or are not used by DirectX cannot be learned about in this fashion.
3) Software like the free Unknown Devices program can list all PNP devices in your system, and when you expand details, you'll get chip information (useful for finding who really makes the guts of the product, and a possible lead to a manufacturer's driver site), and as well the PNP ID itself.
No matter how you get this long string you will find a pattern like VEN_ABCD&DEV_DEF0 - though not necessarily in that order, and definitely not exactly matching this example. The 4 characters that follow "VEN_" are the Vendor ID (telling us whether this comes from Intel, nVidia, Rockwell, whomever) and the 4 characters that follow "DEV_" are the Device ID. The two together form a PNP ID that for this example would be expressed as 0xDEF0ABCD. First you put a 0x (indicating the code is a hexadecimal, or binary-representative code), then the 4 characters (0-9, A-F) for the Device first, then the 4 characters for the vendor second.
Linux users can use lspci. The listing for a peripheral will look like "0000:00:04.0 0401: 10de:0059 (revsomething)" 10de would be the Vendor ID, and 0059 would be the Device ID.
See also: Linux PCI ID Repository
 Run in native mode
Run OSX in NATIVE MODE. These procedures may have additional gotchas or drawbacks if you are running under VMware. However, the basic procedure is the same - just that results under VMware can be misleading.
 Start Terminal
Run the Terminal program found in the Applications/Utilities folder.
 Login as root
Get root access. (sudo -s is a secure method.) You will need to know an administrator password. If you are the only user set up for OS X, the password you created for your account should work.
sudo -s .
 Enter the target directory
For this example, we will show modifying the Apple AC97 (audio) kernel extension. Note that the pattern of directories and subdirectories tends to be the same, only the "AppleAC97" parts (both) would change when patching some other kext. Note that this example regards changing a PlugIn that is inside the kext. This tends to be the most common form of patching. However, sometimes the Contents of the kernel extension are what need changing.
 Change permissions
chmod 644 Info.plist is the typical procedure, as most patches to a PlugIn require you edit the contents of the Info.plist file.
 Edit your patch file
nano Info.plist is the simple editor for text files. Most new users can understand its use quickly. Mind you that anything you do has no harmful effect until you actually save your work. Therefore if you make an error, you can quit without saving and try again. In some instances, files other than Info.plist need to be changed. The Patch Table should indicate this. Assume Info.plist if there is no contrary instruction.
 Insert your ID
Scroll down until you see
<key>Device Name</key> in the text file. The Device Name here should be a human-readable device description, like "Intel ICH6 Audio" or "Realtek 81xx Ethernet". The Patch Table should indicate what Device Name to look for. You will see a part below this that says
<string>0xABCD0EFF</string>. This is the PNP ID string. Multiple IDs can appear between the
</string> separated by a space. Enter yours in so it looks like
<string>0x11470090 0xABCD0EFF</string>. Generally speaking, listing your PNP ID first in this region is the way to go. Comments in the Patch Table should indicate otherwise. In some cases, you need to overwrite the old information and only leave your pertinent information in its place.
 Save changes
If you believe you have made a successful edit to the file, press Ctrl+O to save it and then Ctrl+X to quit nano.
 Testing your new .kext
You often can try out a kernel extension after patching. You change to the directory where the specific PlugIn you changed exists (example follows), and then kextload (example follows):
 Check functionality
The plugin should be loaded - check your terminal screen for any error messages. Most plugins will affect the system in some way, e.g. add or change the behavior of an icon in System Preferences. Here it's up to you to decide whether you can (or need to) make more changes.
Clean your extensions cache:
rm /System/Library/Extensions.kextcache rm /System/Library/Extensions.mkext
(You may also just drag these two to the trash and give your password.)
Setup file permissions
chown -R 0:0 /System/Library/Extensions/YourExtension.kext chmod -R 755 /System/Library/Extensions/YourExtension.kext
kextcache -k /System/Library/Extensions
Now you may reboot!
 Patch Table
|Device Name||PNP ID||kext / PlugIn Name||Comments|
|nVidia AC97 Audio||varies||AppleAC97Audio, AudioIntelICH PlugIn||Add your PNP ID to the list. Will work with nForce 3/4.|
|Realtek 8139 Ethernet||0x813910ec 0x13001186 0x12111113||IONetworkingFamily.kext||Unsure Info.plist is in Contents, or need a PlugIn selection. Browse around for yourself.|
|nVidia nForce Ethernet||0x10DE07DC||nForceLAN.kext (incorrectly patched)||Add your PNPID to the list and remove the other ones.|
|ATI x700 PCIe||0x56531002||ATIRadeon9700.kext||Add your ID to the Info.plist and HEX modify.|
|ATI (Sapphire) x800 PCIe||0x554f1002||ATIRadeon9700.kext||Add your ID to the Info.plist and HEX modify.|
|ATI (Powercolor) 9550 AGP 256Mb||0x41531002||ATIRadeon9700.kext||Add your ID to the Info.plist. CI, DVD, Quartz|
|ATI (Sapphire) 9600XT AGP 256MB||0x41521002||ATIRadeon9700.kext||Add ID to Info.plist|
|Belkin F5D 5083||0x815C050D||RT2870USBWirelessDriver.kext|
|Maxtor 6Y120M0 (120 GB SATA)||0x00E310DE||AppleVIAATA.kext||Add your ID to the Info.plist.|
|Broadcom NetXtreme 57xx Gigabit Controller||0x167714E4|
- The app IORegistryExplorer from the Xcode package can be useful (IOPCIPrimaryMatch is the device id)
- DPCIManager show the device id
This page was last modified on 2 May 2014, at 05:30.
This page has been accessed 364,567 times.