In order to build a kernel module outside of a kernel source tree,
I understand it is necessary to set up a makefile containing
lines such as
...
obj-m:=driver.o
...
and quote the KERNELDIR directory to the make system
(e.g. see O'Reilly book on Linux device drivers)
However, doing this with Centos either 'as-is', or even after doing a
yum remove kernel-devel-<version> then yum upgrade kernel-devel,
(to cause a reinstall of the latest version)
leads to a series of error messages, e.g.:
In file included from include/asm/smp.h:18,
from include/linux/smp.h:96,
from include/linux/sched.h:23,
from include/linux/module.h:10,
from /home/fred/appbuild/mydriver/mydriver.c:22:
include/asm/mpspec.h:6:25: mach_mpspec.h: No such file or directory
although I am not set up for SMP !
These errors are 'fixed' if I add to the make's CFLAGS,
-I$(KERNELDIR)/include/asm-386/mach-default
but I would guess that this should really happen by means of some symlink
trickery, which was set up when the package gets installed.
I do not think that everything else is correct if I do this !
Am I missing another installation step ?
Thanks.
MikeW