Distinction between internal and external kernel modules

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
gemera
Posts: 14
Joined: Fri 17 Feb 2012, 19:19

Distinction between internal and external kernel modules

#1 Post 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?

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#2 Post 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.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#3 Post 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
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#4 Post 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.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#5 Post 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/
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P

Post Reply