Last updated on August 9, 2020 by Dan Nanni
The modern Linux kernel has been growing significantly over the years to support a wide variety of hardware devices, file systems and networking functions. During this time, "loadable kernel modules (LKM)" came into being in order to keep the kernel from getting bloated, while flexibly extending its capabilities and hardware support under different environments, without having to rebuild it.
The Linux kernel shipped with the latest Linux distributions comes with relatively a small number of "built-in modules", while the rest of hardware-specific drivers or custom capabilities exist as "loadable modules" which you can selectively load or unload.
The built-in modules are statically compiled into the kernel. Unlike loadable kernel modules which can be dynamically loaded, unloaded, looked up or listed using commands like
lsmod, built-in kernel modules are always loaded in the kernel upon boot-up, and cannot be managed with these commands.
To get a list of all built-in modules, run the following command.
$ cat /lib/modules/$(uname -r)/modules.builtin
You can also get a hint on what modules are built-in by running:
Each kernel module, whether it's built-in or loadable, comes with a set of parameters. For loadable kernel modules, the
modinfo command will show parameter information about them. However, this command will not work with built-in modules. You will simply get the following error.
modinfo: ERROR: Module XXXXXX not found.
If you want to check what parameters are available in a given built-in module, and what their values are, you can instead examine the content in
/sys/module directory, you will find sub-directories named after existing kernel modules (both built-in and loadable). Then in each module directory, there is a directory named
parameters, which lists all available parameters for the module.
For example, let's say you want to find out parameters of a built-in module called
tcp_cubic (the default TCP implementation of the kernel). Then you can do this:
$ ls /sys/module/tcp_cubic/parameters
And check the value of each parameter by reading a corresponding file.
$ cat /sys/module/tcp_cubic/parameters/tcp_friendliness
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.