Re: how to build .ko on linux

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

 





On 12/29/05, Fawad Lateef <fawadlateef@xxxxxxxxx> wrote:
On 12/29/05, kishore <kishore@xxxxxxxxxxxxxxxxxxx> wrote:
>
>        In kernel version 2.6.9-16.EL, the loadable modules will have an
> extension .ko rather than .o
>
>       My module name is pw_module.c,  am using
>       gcc -c -Wall -O2 -DLINUX -DMODULE -D__KERNEL__
> pw_module.c -I/lib/modules/`uname -r`/build/include
>          will result in pw_module.o
>
>      Its working fine on kernel version 2.4.18-14.
>      If i tried to load the same module on kernel version 2.6.9-16.EL,
> resulting an  "error : Invalid module format."
>
>     Can any one suggest, how to build .ko file on kernel version
> 2.6.9-16.EL .

The module build and loading system has been changed from kernel 2.5
series so the old build system of kernel 2.4.xx series wont work on
kernel 2.6.xx series. So the Makefile or make command you are using
wont work for 2.6.xx kernel and you have to compile kernel with
command :

make -C /lib/modules/<kernel_version>/build M=<your_source_path>

And for more details do look at driver-porting from 2.4 to 2.6 kernel
articles from the link http://lwn.net/Articles/driver-porting/    and
more specifically for makefiles take a look at article this
(http://lwn.net/Articles/21823/).

Also make sure that your module (code) will be for kernel 2.6.xx
series and 2.4.xx series wont run (or at-least not successfully) !

--
Fawad Lateef

you can check the kbuild kernel documentation along with the articles pointed by Fawad
http://lxr.linux.no/source/Documentation/kbuild/
MHD.Tayseer


[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