What's are kernel headers / source-tree?
I am wondering what are kernel headers, and a kernel source tree exactly> Is the source tree the same as just a regular kernel source? Also, if one wanted to compile a kernel or add a module to a kernel, one usually needs the kernel source, but with the kernel headers do?
|
The kernel headers are the C language .h files relevant to the kernel, i.e. those used to build the kernel and those used when compiling programs (or more likely, drivers) that use aspects of the kernel. They are NOT enough to build a new kernel. For that you will need the kernel source (which is the same as the source tree) as this contains not only the headers, but the actual C source files containing the code used to compile into a kernel.
If you want a completely up to date kernel then kernel.org is the place to go. If your distro heavily patches their kernel then you might just want to use their source which is usually available on the install CD. |
Quote:
|
The kernel headers should be the ones in /usr/src/linux-*/include
Some glibc packages (specially rpm ones) install linux headers in /usr/include/linux in a very improper way that could cause problems if you install +1 kernels, worse if one is 2.4 and another 2.6 So the correct way would be to use uname(1) and use /usr/src/linux-`uname -r`/include instead of <linux/version.h> These days, some RPM distributions have a script named kheader that just solves this problem for /usr/src/linux/include/version.h and autoconf.h The proper way would be to handle the linux symlink in /usr/src and /usr/include/linux entirely |
hi, can anyone point me to a howto where it shows how to make a kernel headers package??
i wanna recompile my kernel and stuff, but IIRC the nvidia installer will complian if the headers you have at compile time aren't the same version of your current kernel (which is kinda odd, no?)... so i would like to make a new kernel-headers package when i recompile the kernel (using the latest 2.4 prepatch), then i would recompile glibc with the new headers, and then i would do the nvidia install, etc... i've made a kernel headers package before but i seem to have forgotten how it's done... :) any pointers would be greatly appreciated... thanks... |
after looking at the contents of the official slackware kernel-headers i'm starting to think it's just a matter of packaging the contents of $SRC/include/linux and $SRC/include/asm-i386 (to /usr/include), where $SRC is the source code you just compiled your kernel with...
does that sound about right, or am i trippin'?? |
Just copy /usr/src/linux-$VERSION/include/{linux,asm-i386} $PKG/usr/include
ln -sf $PKG/usr/include/asm-i386 $PKG/usr/include/asm That's pretty much it... Code:
#!/bin/sh |
Quote:
|
Quote:
Actually, the nvidia driver looks at /lib/modules/$(uname -r)/build and not /usr/src/linux... But yea, same idea. I was wondering myself why you want to upgrade kernel-headers before a new glibc compile when the existing headers on slack are not even a version number away. Doesn't seem to be a point in it. If the 2.4.32-rc1 patch doesn't touch the header files, then you would be replacing the stock slack header package with an exact duplicate.... :-) |
Quote:
Quote:
Quote:
BTW, i should mention that i will be recompiling glibc (or attempting to ;)) with the new .32-rc1 headers: http://www.linuxquestions.org/questi...postid=1889331 thanks for all the great replies people!!! |
All times are GMT -5. The time now is 11:17 AM. |