Re: Parameters to KEXT at loading time???
Re: Parameters to KEXT at loading time???
- Subject: Re: Parameters to KEXT at loading time???
- From: Quinn <email@hidden>
- Date: Fri, 27 Jul 2007 14:35:51 +0100
At 2:59 -0700 27/7/07, Michael Smith wrote:
On Jul 26, 2007, at 9:59 PM, vishal shetye wrote:
I=1B$B!G=1B(Bm building a simple kext. I specify command= line
argument (say MyKext_Debug=3D0) to set the debug level.
Kexts are not generally loaded from a "command line", so it is
meaningless to specify "command line arguments" to them.
Although some thread mentions info.plist can be use= d for this
purpose, I=1B$B!G=1B(Bm not sure is it really helpful in case of
generi= c kexts.
I have no idea what you think is a "generic kext", but properties in
the Info.plist file are most practical way to supply parametric data
to your kext.
It kinda depends on whether you're building an I/O Kit KEXT or some
other form of KEXT. For an I/O Kit KEXT, you can stash these sorts
of parameters in the personality in your "Info.plist", and I/O Kit
will transfer these properties to your I/O registry entry. It's
nice, but it's not as useful as you might think. For example, your
shouldn't go modifying your "Info.plist" on a user's machine out in
the field as a matter of course. That way lies revision control
madness. Thus, these properties are typically only useful for
debugging and for setting really obscure options.
For a generic KEXT, this trick won't work. However, as Mike said,
generic KEXTs are never loaded directly by the system. Rather, you
have to create some mechanism to load them. For example, if you look
at my MFSLives VFS plug-in, I load the VFS plug-in KEXT from my mount
tool. As you're already creating this mechanism, it's easy to add
code to pass whatever parameters you want to the KEXT via whatever
mechanism is appropriate. For example, for a VFS plug-in KEXT, it's
common to pass these parameters as part of your mount arguments.
However, for a networking KEXT, you might choose to use a control
socket.
Alternatively, just register a sysctl handler and then you can tweak
these parameters via the sysctl API (and an advanced user can do the
same using the sysctl tool).
Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden