Search code examples
driverwifikernel-modulefreebsd

.kmod and .ko - difference?


Have been using Ndisgen to try to generate a .ko kernel module for an rtl8192se driver for my Freebsd 9 netbook having followed instructions found on several different dev blogger sites.

Somehow, i've just not been able to generate a file with extension .ko. Instead, i keep getting a .kmod file. Question is, what is the difference between these ?

I have also attempted kldload for this .kmod file. When i check it via kldstat, ok, i see it there but, when i then check with dmesg and pciconf -lv, my realtek card is still not hooked up.

So i reckon i really need to generate the .ko file in the first place, but what am i doing wrong or missing, such that only a kmod is generated? Any pointers would be appreciated! thanks! :)

Update::

There was a message I had ignored.

My bad!

the message after conversion was :

"...Cleaning up... rm: machine: is a directory cleanup failed.Exiting"

That's all because i had pasted a copy of the "/usr/include/machine" folder with all the headers i thought was required in the path where I was converting the driver.

But i ignored it thinking, well since ndisgen had already created a .kmod file(which was what I had assumed was also a kernel module, just not in .ko form) then it was alright.

SO finally, since it's complaining that it's a directory and can't be cleaned, i then created a symbolic link to that folder instead.

Et voila! the clean was successful and now i have the .ko file! :D


Solution

  • The ndisgen script renames the .ko file to .kmod temporarily to do some cleanup.

    If that cleanup works, it should rename it back to a .ko file. See the drvgen function /usr/src/usr.sbin/ndiscvt/ndisgen.sh. I'm assuming that something goes wrong in between both renames. Do you get any error messages?

    Keep in mind that if you load the driver, it should show up as the ndis0 device!