I am attempting to write a kernel extension (kext) that uses some parts of the Kernel framework.
I added Kernel.framework to the list of Frameworks and Libraries in the target settings.
However, when I try to build my kext and link against it, Xcode refuses to do this and claims to not be able to find the framework, even though it had shown up in the list of available frameworks.
Am I doing this wrong? Is it not possible to use this framework even for kexts?
Edit: I am aware of the user space alternatives to kexts but these don't fulfill my needs.
The
Kernel.framework
is a header-only "framework". Kext linking is fundamentally different from user space executable linking, as there's nodyld
. You don't need to link against any libraries at build time, but you must specify the KPIs to link against in theInfo.plist
file'sOSBundleLibraries
dictionary.You can generate a draft of this dictionary using the following command:
If using any unsupported KPIs, you'll also want to specify
-unsupported
. If it's complaining about symbols not being found, adding the-undef-symbols
option will help with debugging.