On Mon, 18 May 2009, Daniel Baluta wrote: > On Mon, May 18, 2009 at 10:54 PM, Vipul Jain <vipulsj@xxxxxxxxx> wrote: > > Hello Everybody, > > > > I am having issues in compiling my kernel module please help me in this. > > I am attaching my sampledrv.c and Makefile. > > > > > > Error I am getting: > > > > make -C /lib/modules/2.6.28-11-generic/build M=/home/vipul/linux/ucsc/ldd > > modules > > make[1]: Entering directory `/usr/src/linux-headers-2.6.28-11-generic' > > CC [M] /home/vipul/linux/ucsc/ldd/sampledrv.o > > In file included from include/linux/gfp.h:4, > > from include/linux/kmod.h:22, > > from include/linux/module.h:13, > > from /home/vipul/linux/ucsc/ldd/sampledrv.c:8: > > include/linux/mmzone.h:18:26: error: linux/bounds.h: No such file or > > directory > > include/linux/mmzone.h:256:5: warning: "MAX_NR_ZONES" is not defined > > In file included from include/linux/gfp.h:4, > > from include/linux/kmod.h:22, > > from include/linux/module.h:13, > > from /home/vipul/linux/ucsc/ldd/sampledrv.c:8: > > include/linux/mmzone.h:277: error: ‘MAX_NR_ZONES’ undeclared here (not in a > > function) > > make[2]: *** [/home/vipul/linux/ucsc/ldd/sampledrv.o] Error 1 > > make[1]: *** [_module_/home/vipul/linux/ucsc/ldd] Error 2 > > make[1]: Leaving directory `/usr/src/linux-headers-2.6.28-11-generic' > > make: *** [all] Error 2 > > Hi, > > First do "make prepare" in your kernel source directory. if you're building a module out-of-tree, what you really want to do is "make modules_prepare". http://www.crashcourse.ca/wiki/index.php/Writing_your_first_kernel_module rday -- ======================================================================== Robert P. J. Day Waterloo, Ontario, CANADA Linux Consulting, Training and Annoying Kernel Pedantry. Web page: http://crashcourse.ca Linked In: http://www.linkedin.com/in/rpjday Twitter: http://twitter.com/rpjday ========================================================================