I had an earlier message which hasn't shown up. Perhaps it wasn't posted.
You could have the source located outside of the kernel source. Then you can write your own ./configuration file and Makefile.
The nvidia driver and ndiswrapper driver are installed this way. The kernal module is compiled, modprobe scripts are modified as needed, libraries are copied if needed, and depmod -a and ldconfig are run as part of the "make install" target.
Official patches and drivers have configuration items defined in the .config file for the kernel. The #ifdefs in module source will reference these values.
You could also have tests based on whether standard linux definitions exists.
In other words, perform an indirect test to make the same determination. An indirect test for a definition, that only a Linux kernel would have, could be placed in one of your header files and result in defining LINUX then.
Also, if you study several of the text and docbook docs in /usr/source/kernel-<version>/Documentation/ you should get a good grasp on how kernel module developement is done. You may need to install a kernel-doc package, if the kernel source you have was installed from a package.
Last edited by jschiwal; 02-15-2006 at 07:35 PM.