Rouki
Rouki

Reputation: 2345

Building xnu & using it @ Xcode

I'm currently developing a driver in osx and i'm having problem using XNU files in my Xcode project. I built XNU according to the instructions here: http://shantonu.blogspot.co.il/2013/10/building-xnu-for-os-x-109-mavericks.html

It successfully builds.

Should I install it in a specific directory for XCODE to find the library and header files?

thanks.

Upvotes: 1

Views: 650

Answers (1)

pmdj
pmdj

Reputation: 23428

For developing kernel extensions to use with regular OSX kernels, you shouldn't be using a self-compiled kernel, but use the Kernel.framework that Apple supplies with Xcode and the bundled OS X SDK. If you're using Xcode for your build process anyway, the easiest way is to use one of the kext target templates (I/O Kit driver or generic kext) to set up the build system and include the kernel.framework.

If you have an existing Xcode project to which you want to add a kext build, open it and create a new target, then choose one of the kext templates under "system plugin". You get the same choice when you create a new project altogether.

As for choosing between the two templates:

  • Generic kext is mainly useful if your userspace application will explicitly load the kext.
  • I/O kit kexts can be loaded automatically on device hotplug or on system boot, so they are usually the most useful if your kext doesn't have some kind of userspace trigger.

Upvotes: 1

Related Questions