Someone at work asked me today how I stop AppleHDA.kext from breaking with (almost) every OS update. Okay. This is probably something that most of you here are interested in so let me share that here as well.
The motherboards I use require patched resource files, being layout-3.xml.zlib and Platforms.xml.zlib Nothing new you say. Right. Most people will need patched files, thanks to people like Toleda, but the neat thing is that I trick AppleHDA into loading the resources files from a dummy kext! Yeah. This is something that you won’t find anywhere else, and it took me some time to figure it out, but this is how I did it:
1) sudo cp -R /S*/L*/Extensions/AppleHDA.kext /S*/L*/Extensions/AppleHDA8Series.kext
2) cd /S*/L*/Extensions/AppleHDA8Series.kext/C*
3) sudo rm -R PlugIns
4) sudo rm -R _CodeSignature
5) sudo rm Resources/*.xml.zlib
6) sudo rm Resources/*.lproj
7) sudo rm version.plist
8) sudo cp ~/Desktop/layout-3.xml.zlib Resources/
Note: Change the path/filename so that it points to the file you need for your motherboard!
9) sudo cp ~/Desktop/Platforms.xml.zlib Resources/
Note: Change the path/filename so that it points to the file you need for your motherboard!
10) sudo ln -s /System/Library/Extensions/AppleHDA.kext/Contents/MacOS/AppleHDA MacOS/AppleHDA
11) sudo nano Info.plist (change version info from: 2.5.3 into: 9.1.1fc1)
12) sudo touch /S*/L*/Extensions
13) sudo reboot now
The trick is simple. OS X will load AppleHDA8Series.kext before AppleHDA.kext due its name and version info, and that basically stops AppleHDA.kext from loading. Then the binary, the one it finds pointed by the symbolic link, is loaded and that in turn loads the resource files from AppleHDA8Series.kext. The binary also loads/fires up the PlugIns from AppleHDA.kext (or AppleHDA8Series.kext if you prefer that).
This way the bootloader can bin-patch the AppleHDA binary on-the-fly, and when required AppleHDAController for HDMI support, or you can simply replace step 10 with:
10) sudo cp /S*/L*/Extensions/AppleHDA.kext/C*/MacOS/AppleHDA MacOS/
The next step would be to patch AppleHDA8Series.kext/Contents/MacOS/AppleHDA manually, with whatever command line tool you normally use, but please note that you probably need to change path/filename info in (Perl) scripts as it doesn’t know what to use!
People who need to bin-patch AppleHDAController, for example for HDMI support, can run the following additional terminal commands before proceeding with steps 12 and 13:
*) sudo mkdir PlugIns
*) sudo cp -R /S*/L*/Extensions/AppleHDA.kext/C*/P*/AppleHDAController.kext PlugIns/
*) sudo nano PlugIns/AppleHDAController.kext/C*/Info.plist (change version info from: 2.5.3 into: 9.1.1fc1)
Please note that this should only be required when the boot loader cannot bin-patch AppleHDAController for you!
Oh and let me know if this works for you as well. Thanks!
Update:
Oops. I completely forgot to mention that I also add the CodecData in Info.plist as well (under>IOKitPersonalities/HDA Hardware Config Resource). This way I have everything tidied up in one file ? please note that I set the layout-id property from (EFI) device-properties instead of a ACPI_DSM method.
Update-2:
Someone asked me (per e-mail) if we can use this trick for other kexts as well. But of course you can! That is the whole idea of this new concept, but since AppleHDA.kext patching is somethingeveryone has to deal with… making it a perfect candidate to show you what to do. Have fun now!