“To be frank you do not need a full source tree in order to just compile or build module against the running kernel; i.e. an exploded source tree is not required to build kernel drivers or modules. Developers and power users will benefit immensely from the instructions outlined below.”
Please note that you do not need the entire kernel source tree to do this, but you do need the kernel headers installed. If you don’t have the kernel-headers, this won’t work.
On Ubuntu, sudo apt-get install linux-kernel-headers will do it for you.
This is useful for small projects, like a driver with 10-15 source files. However, hacking Makefiles is arduous if the project you want to compile is very large. Take, for example, vmware server. I had a pretty tough time installing it WITH the kernel sources.
Developers and power users will will benefit immensely from the instructions outlined below.
one will is enough
since the “API” is in the kernel headerfiles, u need them indeed.
but are these kernel headerfiles exactly the same as the ones provided _with_ the full kernel sources, or are these the “sanitized” ones (whatever that may be)?
Debian has a very useful script called “module-assistant” that makes compiling modules from source a snap. “module-assistant a-i module-name” will build and install a deb for you. Works here, anyway, and a lot more sussed than on my rpm distro (SuSE). Although I haven’t checked, I’m sure this nifty script must also be available on Ubuntu?
It is, but stupidly it’s in the Universe repository rather than in Main.
Isn’t that the whole point of the kernel headers? It seems like you shouldn’t have to modify anything to use them in any half-way compliant source code.