Re: compile problems

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

 



-DMODVERSIONS is certainly for module versioning. Here is the explanation:
If you have a module and you want to work over many Linux kernels (2.4.18,
2.4.19, 2.4.20 etc). You have two ways of doing this. First is that, you
compile your module with header files of each kernel (you have to compile
every time, you work with a new kernel). Another way is to compile
with -DMODVERSIONS. When you compile with -DMODVERSIONS, all functions of
module (as well as kernel, which has module versioning support) are appended
with a suffix (which a hash calculated over the function prototype). So as
long as your module function name(with hash) and kernel api name (with hash)
are matching, your module will be inserted. If API does not match (then hash
will differ) and kernel will refuse to load the module. This way you can
make your module to work over multiple kernel without recompiling (as long
as kernel API hash is matching with module`s one).

Regards
Mohanlal

----- Original Message -----
From: "LinuxTyro" <linuxtyro@yahoo.com>
To: <kernelnewbies@nl.linux.org>
Sent: Thursday, April 15, 2004 7:31 AM
Subject: Re: compile problems


> thanks! it compiled. However I have got to look into
> what -DMODVERSIONS is used for. I am sure it is for
> versioning but am not quite sure what its
> functionality is.
>
> Also I had to include slab.h instead of malloc.h for
> it to compile correctly. Is this the way its going to
> be for all modules of v 2.4 and later?
>
> thanks
>
> Ranjan
>
>
>
> --- mohanlal jangir <mohanlal@samsung.com> wrote:
> > Why don't you give a try without -DMODVERSIONS and
> > -include
> > /usr/src/linux-2.4.20-8/include/linux/modversion.h
> >
> > Regards
> > Mohanlal
> >
> > ----- Original Message -----
> > From: "LinuxTyro" <linuxtyro@yahoo.com>
> > To: <kernelnewbies@nl.linux.org>
> > Sent: Wednesday, April 14, 2004 8:15 AM
> > Subject: compile problems
> >
> >
> > > Hi everyone,
> > >
> > > This is my first shot at kernel programming so
> > please
> > > bear with me.
> > > I am using Rubini's Device Driver book (2nd ed)as
> > a
> > > guide and trying to compile one of the sample
> > device
> > > drivers (scull). However I get tons of errors &
> > > warnings when trying to compile and all of them
> > point
> > > to errors in the kernel sources. I have specified
> > my
> > > KERNELDIR(=/usr/src/linux-2.4.20-8) in the make
> > > command line arguments.  Here is a sample of the
> > > output the make command that I get when I do a
> > make
> > > KERNELDIR(=/usr/src/linux-2.4.20-8) .I havent
> > included
> > > all the errors as it is huge.
> > >
> > >               ***************
> > > gcc -D__KERNEL__ -DMODULE
> > > -I/usr/src/linux-2.4.20-8/include -DMODVERSIONS
> > > -include
> > >
> > /usr/src/linux-2.4.20-8/include/linux/modversions.h
> > > -O2 -I..   -c -o main.o main.c
> > > In file included from
> > >
> > /usr/src/linux-2.4.20-8/include/linux/prefetch.h:13,
> > >                  from
> > > /usr/src/linux-2.4.20-8/include/linux/list.h:6,
> > >                  from
> > > /usr/src/linux-2.4.20-8/include/linux/module.h:12,
> > >                  from main.c:25:
> > >
> > /usr/src/linux-2.4.20-8/include/asm/processor.h:60:
> > > warning: parameter names (without types) in
> > function
> > > declaration
> > >
> > /usr/src/linux-2.4.20-8/include/asm/processor.h:60:
> > > field `loops_per_jiffy_R_ver_str' declared as a
> > > function
> > >
> > /usr/src/linux-2.4.20-8/include/asm/processor.h:82:
> > > invalid suffix on integer constant
> > >
> > /usr/src/linux-2.4.20-8/include/asm/processor.h:82:
> > > parse error before numeric constant
> > >
> > /usr/src/linux-2.4.20-8/include/asm/processor.h:265:
> > > invalid suffix on integer constant
> > >                **************
> > > The program  exits with an Error 1.
> > > I have compiled and loaded a simple helloworld
> > module
> > > in this same kernel. I am not sure what I am doing
> > > wrong.
> > > Can anyone give me some direction?
> > >
> > > Thanks for your help
> > >
> > > R S
> > >
> > >
> > >
> > >
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > Yahoo! Tax Center - File online by April 15th
> > > http://taxes.yahoo.com/filing.html
> > >
> > > --
> > > Kernelnewbies: Help each other learn about the
> > Linux kernel.
> > > Archive:
> > http://mail.nl.linux.org/kernelnewbies/
> > > FAQ:           http://kernelnewbies.org/faq/
> > >
> > >
> >
> >
> > --
> > Kernelnewbies: Help each other learn about the Linux
> > kernel.
> > Archive:
> > http://mail.nl.linux.org/kernelnewbies/
> > FAQ:           http://kernelnewbies.org/faq/
> >
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - File online by April 15th
> http://taxes.yahoo.com/filing.html
>
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
>
>


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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