xcodemacosiokitkernel-extension

How to create a codeless kernel extension?


I know how to load the driver in KEXT, and I know how to use xcode. The problem is, how do I create a codeless kext?

Assume I already have a text file and I can save it as a PLIST file? then what? how can I convert it (PLIST file) to a .KEXT file? using Xcode? or from command line? I am looking for step-by-step guidance.


Solution

  • A codeless kext is pretty much just a bunch of directories containing an Info.plist and from OS X 10.9 onwards, a cryptographic signature.

    YourKextName.kext/
     + Contents/
        + Info.plist - Your plist file
        + _CodeSignature/ - The 'codesign' tool will create and fill this appropriately
    

    You might also have some localisation data, but I don't know what use this would be in a codeless kext.

    To create it, you have 2 options:

    Manually create codeless kext

    You can create an "Aggregate" target in Xcode and place all these commands (apart from the first) in the "Run Script" build phase of the target, if you'd like it as part of your Xcode build.

    The Xcode way

    If you want Xcode to pre-process your Info.plist as you'd have it do for a regular kext, you can also get Xcode to do the whole thing for you, no custom scripts required:

    Codeless kext Info.plist tips

    Your Info.plist is similar to any other I/O Kit kext's Info.plist, except: