Re: kext doesnot gets loaded for the first time!
Re: kext doesnot gets loaded for the first time!
- Subject: Re: kext doesnot gets loaded for the first time!
- From: Dean Reece <email@hidden>
- Date: Wed, 13 Sep 2006 09:21:56 -0700
On Sep 13, 2006, at 06:19, rohit dhamija wrote:
I have developed a kernel extension module for my USB bulk device
for Mac OS X 10.4.7 ppc G5 and Intel Mac 10.4.7
I am encountering a strange issue of loading the kext and wanted
your expert guidance to resolve the same.
Issue: My kext doesnot gets loaded if I donot attach my USB bulk
device while loading the kext.
Pre-requisite: Always take the fresh Mac OS X 10.4.7 ppc G5/ Intel
machine.
Step to reproduce:
Step 1. I "DO NOT" attach my USB bulk device and then perform Step 2.
Step 2. Now I try to load my kext using following commands:
sudo cp -r MyUSBDevice.kext /System/Library/Extensions
sudo touch /System/Library/Extensions
sudo kextload -v MyUSBDevice.kext
Step 3. Do kextstat, the kext is not loaded. This is probably
because the device corresponding to it is not attached. So the
kernel module is not in memory.
Step 4. After 2-3 minute, now I attach my USB bulk device.
Result: The kext doesnot gets loaded even now!!! I verified it
using kextstat command. Also the LED of my USB device doesnot
gets ON which is a clear indication that the kext doesnot got loaded.
Now, on the other hand, if I attach the keys are perform the
Step2-4, the kext gets loaded immediately.
This scenerio only happens on the machine in which we are
installing the kext for the first time. After that if we try to
uninstall and install and then perform all the steps, the issue
never comes!!
Can anybody please let me know why this issue is coming and the way
to resolve the same ??
Have a look at <http://developer.apple.com/qa/qa2001/qa1319.html>
What you are encountering is expected behavior. Just copying a kext
into /S/L/E does not make kextd aware of it's presence until after
the next reboot when it discovers the mod date of the /S/L/E folder
has changed and rescans for new kexts. Prior to kextd discovering
the kext, the only way to get it loaded is by calling kextload
directly, as you are doing. However, if no matching hardware is
present when you kextload, then the kext will auto-unload. Since
kextd doesn't now about the kext yet, it will not auto-load it next
time the hardware appears.
Of course, once kextd discovers your kext, all is well and it behaves
as expected. Technical Q&A QA1319 referenced above will show you how
to signal kextd to rescan for kexts without requiring a reboot (short
version: SIGHUP it, but check the base OS version first!).
The reason you can later un-install and re-install the kext is that
kextd never noticed it going away, nor did it notice it coming back.
Since the kext was present at boot, kextd expects it to be there and
will attempt to load it any time matching hardware appears.
Hope this helps,
- Dean
_______________________________________________
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