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.
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:
mkdir -p "$BUILD_DIR/YourKextName.kext/Contents"
)cp "$SOURCE_DIR/Info.plist" "$BUILD_DIR/YourKextName.kext/Contents/"
)codesign -fs "Developer Id" "$BUILD_DIR/YourKextName.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.
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:
Your Info.plist is similar to any other I/O Kit kext's Info.plist, except:
CFBundleExecutable
property must not exist.OSBundleLibraries
property because there is no executable that needs linking.IOKitPersonalities
dictionary must have a CFBundleIdentifier
property identifying another kext, one containing the executable that provides whatever IOClass
you specified.