Page 1 of 1

Distinction between internal and external kernel modules

Posted: Tue 08 Apr 2014, 20:17
by gemera
Hi,

I'm currently going through the usual beginner "Hello World" type loadable kernel module tutorials.

What I'm unsure of is the distinction between this type of kernel module and what they encompass - which is described as out-of-tree - and in-tree modules which are also described as internal modules.

Am I right in thinking internal modules are the type compiled using obj-y in the Makefile and require re-compiling the kernel as opposed to the external which are compiled with obj-m and which are loadable and unloadable.

Also I'm unsure when the one would be used rather than the other.

e.g. in Puppy are the Device Drivers external and loaded at boot or are they compiled with the kernel?

Posted: Wed 09 Apr 2014, 04:35
by amigo
In kernel simply means that the sources are part of the normal linux kernel sources. out-of-tree means any module whose sources are not part of the normal kernel sources.

Posted: Thu 10 Apr 2014, 15:22
by technosaurus
CONFIG_XXX=M ... module is built as a dynamically loadable XXX.ko (may have .ko.gz if compressed)
CONFIG_XXX=Y ... "module" is builtin to the kernel image => no need to modprobe it.
By design each out of tree builds is built as if it were CONFIG_XXX=M because it is built for the existing kernel image

Posted: Thu 10 Apr 2014, 18:36
by amigo
The OP specifically mentions 'out-of-tree', so this is not about the difference between code fragments which are built as 'kernel modules' which can be dynamically inserted and removed, or alternately, 'hard-linked' into the kernel so they are always available. Rather, he asks about kernel modules which are not included in the un-patched original kernel sources.

Posted: Wed 07 May 2014, 00:10
by Karl Godt
Since around kernel 2.6.34 the
# depmod
command line utility creates a modules.builtin file in the /lib/modules/`uname -r` directory.

Device drivers are usually compiled into the kernel , since device drivers are hard disk drivers .
Same with common file system drivers ie ext2-4, reiserfs .

In a full installation it is neccessary to compile such drivers into the kernel,
since PUPPY does not use an initrd for full installs that could load the drivers .

I for myself compile even the IDE and SCSI drivers into the kernel .
That gave problems with some scripts back then I remember, but Barry or I fixed these .
My kernels are around 7-10 MB instead of 2-5 MB .
I even compile AUFS into it - if I feel for adding the AUFS driver .
Same with the SQUASHFS driver .

For other information about kernel features, I visit http://kernelnewbies.org/