LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   compiling raw source code of device driver (https://www.linuxquestions.org/questions/linux-hardware-18/compiling-raw-source-code-of-device-driver-432941/)

bishalpoudyal 04-08-2006 02:47 AM

compiling raw source code of device driver
 
I have a device driver's(ethernet card)source code in "driver.c" i have to compile it and convert it to "driver.o" how to compile please help.After compiling it i can easily insert to the kernel module but i could not compile it.

jschiwal 04-08-2006 03:09 AM

You will need to provide more information. Such as which NIC card the driver is for, your distribution, the version of the kernel (ver 2.4 vs 2.6). I doubt that you have just a driver.c program. You probably started with a tarball, and need to read the README file for full instructions.

"driver" is too generic of a name, so if the target is driver.o, it will probably be linked into the final driver-name.ko kernel module.

One of the things you will need to do is install the kernel-source.
If your distro is RPM based, there will probably be a package named kernel-source-<version>.rpm, however for Fedora Core, it will be a source rpm that you need to install.
The version of the rpm file should match the version displayed by the "uname -r" command.

You will also need the GCC compiler package if it isn't already.

The exact steps for producing a kernel module differs between 2.4 and 2.6 version kernels. If you are using the kernel-source from your distro, there will also be a Readme file with the distro detailing the steps you need to perform. There may be a makefile which performs the steps needed. This is usually the case for 3rd party drivers that aren't part of the kernel tree. One example is ndiswrapper, which compiles a ndiswrapper.ko kernel module and installs it.

-------
By the way, the personal pronoun "I" should be capitalized.


All times are GMT -5. The time now is 07:58 AM.