Re: Linux module compilation problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am using Ubuntu 9.0.4 and currently building out of the source tree, infact I am using the existing Ubuntu hearder files to build my sample driver. Do I really need to get the source tree for building modules? Secondly, I am not sure
where to run make prepare_modules can you please specify the exact location.

1. Kernel Module build location: my local directory (/home/vipul/linux/ucsc/ldd/)
2. uname -r:  2.6.28-11-generic
3. root@ubuntu:/usr/src# ls
    linux-headers-2.6.28-11  linux-headers-2.6.28-11-generic  nvidia-180.44



Regards,
Vipul.


On Mon, May 18, 2009 at 1:45 PM, Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> wrote:
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
========================================================================


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux