Understanding Kexts

Over the time , I’ve been getting tons on questions via e-mail (okay at most is 1 a day) and via IRC on what are kexts and how to identify how they work and what its used for. I’ll briefly explain on what is kernel and what are kernel extensions

Kernel is actually the heart of OS , it basically the one that gets your OSX. So do be friend with the kernel. You can read complete explanation on what is a kernel here (Wikipedia). Now kexts (or also known as Kernel Extensions – thats how it got its name from Kernel + Extensions) , are actually drivers on macOS . Its analogous to linux modules !. I wouldn’t’ say drivers but something to extend the functionality of a kernel , as kernel is very basic. So it takes it to another level. Of course for simplicity sake , one may call it as drivers. However its not the right term. Suffice to say, if you want to playParty poker , use PhotoShop or pretty much anything we take for granted on our computers, you need a kext. They are added power.

Understanding the naming of kext and its usage

This is pretty much a basic guide on figuring out which kext is for what !

This is pretty tricky. Here I’ll share it to you on how to understand (or to give you a rough idea) on the purpose of each kext by looking for its name.

Screen shot 2009-09-10 at 6.38.18 PM

In this case , I would be examining OSvKernDSPLib.kext (you may check it out over at /System/Library/Extensions ). At first glance you may have no idea what is used for.  Lets take a closer look. Now lets break it up , OS obviosuly stands for Operting System , vKern stands for Kernel ; DSP stands for Digital Sound Processing ; Lib stands for Library. So it makes sense after translating it to English. This goes the same for just about other kext. You’ll have to do a bit of googling if you don’t get its abbreviation right.

Understanding fundamentals of a kext !

In this part , we’ll be talking about what a kext consist of , what are dependencies and how to find details about a kext !

You may ask , ‘well whats this kext is used for and why its there”. Now to answer this question , we can actually find out more about the kexts by opening it up. No don’t worry , its not going to hurt your PC. By opening a kext up , we could gather additional information. You may have done this in editing kext , for instance to add your device IDs and Vendor IDs to a kext , so that your graphics/sound/network card would work. Its actually the same . Simply right click a kext and select Show Package Contents.

Then click Contents and take a quick look at it. You’ll have several folders such as MacOS (the main binary file of the kernel) , Resources (Language Translation , the one that is in charging of naming and other things) , PlugIns (contains another kexts for instance inside IONetworkingfamily.kext , you have individual drivers that make up IONetworkingFamily.kext. Think of it as several cells which would form a tissue. Its something like Biology). Now , our main concern is about Info.plist. Open it up with your favourite text editor and have a look at it .

Do take a look at couple of things within the info.plist. It will generally tell you details bout the kext such as its build version , who made and it , so on and so forth. Its the place whereby you can edit your device id and to include it if its not there. I’m not going to explain all those as I believe that you’re able to handle that part. Now lets take a look at dependices. Just like if someone wants to produce a baby (yes , a baby – you’ll be needing a man and a woman. A man and a woman in this case  are call dependencies). A kext behaves this way. I’ll give you an excerpt for dependencies on what AppleHDA.kext need in order for it to work

Screen shot 2009-09-10 at 7.18.08 PMIn order for AppleHDA.kext to work , we’ll be needing IOAudioFamily.kext and IOHDAFamily.kext and as well as a mach_kernel version of 8.00b3. Thats how its read. iokit ,libkern and mach are actually kexts within the kernel itself . If you don’t believe me , take a look at your Extensions folder you may notice that you do have these kexts within your extension folder. Open em up the same way you did and you’ll notice that these kexts do depend on other kexts in order for it to work !

Thats about it. Thats how you understand a kext. Don’t worry , OSX will create a cache by default will be tuned and optimised for your hardware. This way kexts don’t have to be reloaded every time you load OSX , a cache of it would be loaded , thus saving your precious boot time !

Credits : russo (thanks pal)

2 thoughts on “Understanding Kexts”

  1. thanks, good and quick explanation! your analogies kinda suck though =(
    still, found it helpful!

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge