A kernel extension (or kext) is a dynamically loaded bundle of executable code that runs in kernel space. You can create a kext to perform low-level tasks that cannot be performed in user space. Kexts typically belong to one of three categories:
Low-level device drivers
This document is a primary resource for kext programming in OS X. It describes the structure of a kext and demonstrates the process for developing a kext, from creating an Xcode project to packaging your kext for distribution.
Who Should Read This Document?
This document is intended for developers who are developing a kernel extension for OS X. Because kext development has numerous pitfalls, you are encouraged to stay away from creating a kext unless you absolutely have to. Read Deciding Whether to Create a Kernel Extension to make sure a kext is the correct solution for your needs.
If you are developing a driver for a USB or FireWire device, it can and should run in user space. See USB Device Interface Guide and FireWire Device Interface Guide for details.
Organization of This Document
This document contains the following chapters:
Deciding Whether to Create a Kernel Extension explains when it is absolutely necessary to create a kext, along with safer, simpler alternatives for common issues.
The Anatomy of a Kernel Extension describes the components of a kext bundle.
Creating a Generic Kernel Extension with Xcode guides you through creating a simple generic kext.
Creating a Device Driver with Xcode guides you through creating a simple I/O Kit device driver.
Debugging a Kernel Extension with GDB guides you through debugging a kernel extension with GDB.
Command-Line Tools for Analyzing Kernel Extensions describes command-line tools you can use when working with kexts.
Packaging a Kernel Extension for Distribution and Installation guides you through using the Package Maker application to package your kext.
Info.plist Properties for Kernel Extensions describes kext-specific properties for your kext’s information property list.
Kernel Programming Guide provides fundamental high-level information about the OS X core operating-system architecture.
IOKit Fundamentals explains the terminology, concepts, architecture, and basic mechanisms of the I/O Kit.
IOKit Device Driver Design Guidelines describes common tasks to perform when creating an I/O Kit driver.