9

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?

2 Answers 2

10

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".

3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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