LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   What/where are kernel header files? (https://www.linuxquestions.org/questions/linux-general-1/what-where-are-kernel-header-files-98314/)

Toker 09-29-2003 02:25 PM

What/where are kernel header files?
 
I need to set the path to the directory containing the kernel header files that should be used when I compile the NVIDIA kernel module. Both of the default directories the installer uses do not exist on my system. The two paths is searches by are:

/lib/modules/2.4.21-0.13mdk/build/include (the only directory I have in 2.4.21-0.13mdk is "kernel")

and:

/usr/src/linux/include (under src/ I only have alsa and rpm)

Since I'm very new to nix, I'm not really sure what a header file even is, let alone where they are. Any help on what I need here? This is using Mandrake 9.1

Thanks!

LooseCanon 09-29-2003 04:00 PM

Kernel header files (a.k.a. "kernel source" files) are a set of pre-compiled binary files reflecting your currently running kernel. Essentially the kernel headers are simply a "raw" mirror image of the kernel that's running your computer. You need kernel headers (or kernel source) files in order to make drivers, fix things etc..

The kernel headers are stored in /usr/src and usually appear as a directory reflecting the version of the currently running kernel. You can check that (currently running kernel version) by typing uname -r.


Keep in mind that there's a big difference between "kernel source" files and "source kernel" files.

-> Kernel source (i.e. kernel headers) is what I described above. Kernel source (header) files are pre-compiled set of binaries (inlcuding bug fixes and patches) that reflect the kernel that's running your system. These files are named in the following manner: "kernel-source-<version>.rpm"

--> Source kernel files are simply the source file for making a kernel. If you plan to make (compile) your own kernel (the core of linux) then you must use the "source" files - as you would with some programs... obtain the source and then compile your own program based on the "source files". These are normally named: "kernel-<version>.src.rpm"


Do a quick search on this in the forums and you'll get a better understanding for these terms that way.

Toker 09-29-2003 05:44 PM

Well, it's definately the kernel source files that I'm looking for. However, I don't have a directory in /usr/src/ with the current kernel (2.4.21-0.13mdk.) I do have that directory in /lib/modules/ though. The only directories in /usr/src/ are alsa and RPM in RPM, there is BUILD, RPMS, SOURCES, SPECS and SRPMS.

Is there a command that will show the path to the current kernel source files?

LooseCanon 09-29-2003 07:56 PM

If you can find the "kernel-source-<version>.rpm" file on ftp.mandrake-linux.com that matches the version of your kernel then download it and install the kernel-source file (rpm). If yours is an install off the Mandrake CD's then the "kernel-source-<version>.rpm" file will be on one of the CD's. You can just copy it from there and install it.

Use "rpm -ihv kernel-source-<version>.rpm" to install it (kernel-source) while logged in as root. The installation then creates the appropriate kernel headers as well as all the directories where those are housed.

The stuff you have in your /usr/src/ directory is good - all that is needed too in order to make drivers and programs....

Toker 09-29-2003 08:04 PM

Thank you LooseCannon! :jawa: It's somewhere on one of those cd's.... :D

I'm off to play this for a while!

Toker 09-29-2003 11:16 PM

post deleted - please ignore.


All times are GMT -5. The time now is 01:38 AM.