Steve Folly's link is accurate, but to have it here:
Create a plist file (which is just a plain text XML document) named something like com.domain.identifier.plist in /Library/LaunchDaemons with contents similar to this:
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<false/>
<key>Label</key>
<string>com.domain.identifier</string>
<key>ProgramArguments</key>
<array>
<string>/sbin/kextload</string>
<string>/System/Library/Extensions/MyExtension.kext</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/dev/null</string>
<key>StandardOutPath</key>
<string>/dev/null</string>
<key>UserName</key>
<string>root</string>
</dict>
</plist>
(There's a manpage, launchd.plist(5) that specifies the syntax of LaunchDaemon plist files.)
I then converted it to a binary plist file just for some trivial syntax checking:
plutil -convert binary1 com.domain.identifier.plist
Then activate the LaunchDaemon to run at startup:
launchctl load -w /Library/LaunchDaemons/com.domain.identifier.plist
And check to make sure that it's in there:
launchctl list | grep com.domain.identifier
The LaunchDaemon should run at startup and load the kext.
kext
to/Library/Extensions
, set the permissions to 755 and the owner/group to root:wheel, and rebuild the kernel cache after loading it?