Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

It seems that files containing kernel modules are called .o, at least that's what I figure when looking at a tutorial like this one. However, on my debian squeeze box, these files seem to be called .ko.

Does it depend on the distribution (or verison thereof) whether the files are called .o or .ko, and are they more or less the same, otherwise?

share|improve this question
add comment

2 Answers 2

up vote 6 down vote accepted

I found the following answer here:

The short answer is that the .ko file is your object file linked with some kernel automatically generated data structures that are needed by the kernel.

The .o file is the object file of your modules - the result of compiling your c files. The kernel build system then automatically creates another C file with some data structures describing the kernel module (named your_module_kmod.c), compile this C file into another object file and links your object file and the object file it built together to create the .ko file.

The dynamic linker in the kernel that is in charge of loading kernel modules, expects to find the data structure the kernel put in the kmod object in the .ko file and will not be able to load your kernel module without them.

Also from that source, citing tldp: Up to 2.4 kernel versions, it was ".o", and since 2.6, it's ".ko".

share|improve this answer
add comment

It seems an old howto (tutorial), in facts it was written in 2005. When the Linux kernel was 2.4.x the modules had .o extension, while in 2.6 they became .ko

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.