Re: .o and .ko file

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

 



Hi...

I could share something ... hopefully...

On Mon, Oct 27, 2008 at 4:13 PM, nidhi mittal <nidhimittal19@xxxxxxxxx> wrote:
> hi when i compiled a kernel module
> i get two files a.o and a.ko file

the .o file is individual object file, while the .ko is the result of
linking every .o files to form the final kernel modules.

> now my ques is ..
> what is difference between two files..
> why two object files are created and

actually makefile can be told to directly create the final .ko, but
that way if you change single .c file (the source code) you have to
repeat all the compilation process. That would slow down your
compilation into some degree.

But compiling each .c files into separate .o files, if you chance
single .c file,  only one .o file needs to be recompiled while the
rest stay still.


> then i read smwhere that when we do insmod all symbols used in code are
> linked with kernel symbol table....
correct....the external symbols.

> then 2nd place i read is insmod does loading of module linking is already
> done while making .ko file ...
resolving and linking symbols happens during the loading of kernel
module . It's the same when you run a binary that relies on dynamic
shared libraries.

> and last is i have learnt writing makefile for kernel module but dont
> understand why do they reuire first
>
> make -C <kernel makefile path>  M = <my module makefile path> modules
> i read abt it in LDD too but cd nt understand
> as to why do we make it first reach to kernel make file then to our makefile
> and what modules target specify...

AFAIK, it is done that way so you don't have to specify things like
library path, CFLAGS and so on. Everything is already defined in main
kernel source's Makefile. So, you get advantage that your Makefile
looks cleaner and more portable.

regards,

Mulyadi.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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