xref: /aosp_15_r20/external/kmod/README.md (revision cc4ad7da8cefe208cb129ac2aa9a357c7c72deb2)
1*cc4ad7daSAndroid Build Coastguard Worker## kmod - Linux kernel module handling
2*cc4ad7daSAndroid Build Coastguard Worker
3*cc4ad7daSAndroid Build Coastguard Worker[![Coverity Scan Status](https://scan.coverity.com/projects/2096/badge.svg)](https://scan.coverity.com/projects/2096)
4*cc4ad7daSAndroid Build Coastguard Worker
5*cc4ad7daSAndroid Build Coastguard Worker
6*cc4ad7daSAndroid Build Coastguard WorkerInformation
7*cc4ad7daSAndroid Build Coastguard Worker===========
8*cc4ad7daSAndroid Build Coastguard Worker
9*cc4ad7daSAndroid Build Coastguard WorkerMailing list:
10*cc4ad7daSAndroid Build Coastguard Worker	[email protected] (no subscription needed)
11*cc4ad7daSAndroid Build Coastguard Worker	https://lore.kernel.org/linux-modules/
12*cc4ad7daSAndroid Build Coastguard Worker
13*cc4ad7daSAndroid Build Coastguard WorkerSigned packages:
14*cc4ad7daSAndroid Build Coastguard Worker	http://www.kernel.org/pub/linux/utils/kernel/kmod/
15*cc4ad7daSAndroid Build Coastguard Worker
16*cc4ad7daSAndroid Build Coastguard WorkerGit:
17*cc4ad7daSAndroid Build Coastguard Worker	git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git
18*cc4ad7daSAndroid Build Coastguard Worker	http://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git
19*cc4ad7daSAndroid Build Coastguard Worker	https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git
20*cc4ad7daSAndroid Build Coastguard Worker
21*cc4ad7daSAndroid Build Coastguard WorkerGitweb:
22*cc4ad7daSAndroid Build Coastguard Worker	http://git.kernel.org/?p=utils/kernel/kmod/kmod.git
23*cc4ad7daSAndroid Build Coastguard Worker	https://github.com/kmod-project/kmod
24*cc4ad7daSAndroid Build Coastguard Worker
25*cc4ad7daSAndroid Build Coastguard WorkerIrc:
26*cc4ad7daSAndroid Build Coastguard Worker	#kmod on irc.freenode.org
27*cc4ad7daSAndroid Build Coastguard Worker
28*cc4ad7daSAndroid Build Coastguard WorkerLicense:
29*cc4ad7daSAndroid Build Coastguard Worker	LGPLv2.1+ for libkmod, testsuite and helper libraries
30*cc4ad7daSAndroid Build Coastguard Worker	GPLv2+ for tools/*
31*cc4ad7daSAndroid Build Coastguard Worker
32*cc4ad7daSAndroid Build Coastguard Worker
33*cc4ad7daSAndroid Build Coastguard WorkerOVERVIEW
34*cc4ad7daSAndroid Build Coastguard Worker========
35*cc4ad7daSAndroid Build Coastguard Worker
36*cc4ad7daSAndroid Build Coastguard Workerkmod is a set of tools to handle common tasks with Linux kernel modules like
37*cc4ad7daSAndroid Build Coastguard Workerinsert, remove, list, check properties, resolve dependencies and aliases.
38*cc4ad7daSAndroid Build Coastguard Worker
39*cc4ad7daSAndroid Build Coastguard WorkerThese tools are designed on top of libkmod, a library that is shipped with
40*cc4ad7daSAndroid Build Coastguard Workerkmod. See libkmod/README for more details on this library and how to use it.
41*cc4ad7daSAndroid Build Coastguard WorkerThe aim is to be compatible with tools, configurations and indexes from
42*cc4ad7daSAndroid Build Coastguard Workermodule-init-tools project.
43*cc4ad7daSAndroid Build Coastguard Worker
44*cc4ad7daSAndroid Build Coastguard WorkerCompilation and installation
45*cc4ad7daSAndroid Build Coastguard Worker============================
46*cc4ad7daSAndroid Build Coastguard Worker
47*cc4ad7daSAndroid Build Coastguard WorkerIn order to compiler the source code you need following software packages:
48*cc4ad7daSAndroid Build Coastguard Worker	- GCC compiler
49*cc4ad7daSAndroid Build Coastguard Worker	- GNU C library
50*cc4ad7daSAndroid Build Coastguard Worker
51*cc4ad7daSAndroid Build Coastguard WorkerOptional dependencies:
52*cc4ad7daSAndroid Build Coastguard Worker	- ZLIB library
53*cc4ad7daSAndroid Build Coastguard Worker	- LZMA library
54*cc4ad7daSAndroid Build Coastguard Worker	- ZSTD library
55*cc4ad7daSAndroid Build Coastguard Worker	- OPENSSL library (signature handling in modinfo)
56*cc4ad7daSAndroid Build Coastguard Worker
57*cc4ad7daSAndroid Build Coastguard WorkerTypical configuration:
58*cc4ad7daSAndroid Build Coastguard Worker	./configure CFLAGS="-g -O2" --prefix=/usr \
59*cc4ad7daSAndroid Build Coastguard Worker			--sysconfdir=/etc --libdir=/usr/lib
60*cc4ad7daSAndroid Build Coastguard Worker
61*cc4ad7daSAndroid Build Coastguard WorkerConfigure automatically searches for all required components and packages.
62*cc4ad7daSAndroid Build Coastguard Worker
63*cc4ad7daSAndroid Build Coastguard WorkerTo compile and install run:
64*cc4ad7daSAndroid Build Coastguard Worker	make && make install
65*cc4ad7daSAndroid Build Coastguard Worker
66*cc4ad7daSAndroid Build Coastguard WorkerHacking
67*cc4ad7daSAndroid Build Coastguard Worker=======
68*cc4ad7daSAndroid Build Coastguard Worker
69*cc4ad7daSAndroid Build Coastguard WorkerRun 'autogen.sh' script before configure. If you want to accept the recommended
70*cc4ad7daSAndroid Build Coastguard Workerflags, you just need to run 'autogen.sh c'.
71*cc4ad7daSAndroid Build Coastguard Worker
72*cc4ad7daSAndroid Build Coastguard WorkerMake sure to read the CODING-STYLE file and the other READMEs: libkmod/README
73*cc4ad7daSAndroid Build Coastguard Workerand testsuite/README.
74*cc4ad7daSAndroid Build Coastguard Worker
75*cc4ad7daSAndroid Build Coastguard WorkerCompatibility with module-init-tools
76*cc4ad7daSAndroid Build Coastguard Worker====================================
77*cc4ad7daSAndroid Build Coastguard Worker
78*cc4ad7daSAndroid Build Coastguard Workerkmod replaces module-init-tools, which is end-of-life. Most of its tools are
79*cc4ad7daSAndroid Build Coastguard Workerrewritten on top of libkmod so it can be used as a drop in replacements.
80*cc4ad7daSAndroid Build Coastguard WorkerSomethings however were changed. Reasons vary from "the feature was already
81*cc4ad7daSAndroid Build Coastguard Workerlong deprecated on module-init-tools" to "it would be too much trouble to
82*cc4ad7daSAndroid Build Coastguard Workersupport it".
83*cc4ad7daSAndroid Build Coastguard Worker
84*cc4ad7daSAndroid Build Coastguard WorkerThere are several features that are being added in kmod, but we don't
85*cc4ad7daSAndroid Build Coastguard Workerkeep track of them here.
86*cc4ad7daSAndroid Build Coastguard Worker
87*cc4ad7daSAndroid Build Coastguard Workermodprobe
88*cc4ad7daSAndroid Build Coastguard Worker--------
89*cc4ad7daSAndroid Build Coastguard Worker
90*cc4ad7daSAndroid Build Coastguard Worker* 'modprobe -l' was marked as deprecated and does not exist anymore
91*cc4ad7daSAndroid Build Coastguard Worker
92*cc4ad7daSAndroid Build Coastguard Worker* 'modprobe -t' is gone, together with 'modprobe -l'
93*cc4ad7daSAndroid Build Coastguard Worker
94*cc4ad7daSAndroid Build Coastguard Worker* modprobe doesn't parse configuration files with names not ending in
95*cc4ad7daSAndroid Build Coastguard Worker  '.alias' or '.conf'. modprobe used to warn about these files.
96*cc4ad7daSAndroid Build Coastguard Worker
97*cc4ad7daSAndroid Build Coastguard Worker* modprobe doesn't parse 'config' and 'include' commands in configuration
98*cc4ad7daSAndroid Build Coastguard Worker  files.
99*cc4ad7daSAndroid Build Coastguard Worker
100*cc4ad7daSAndroid Build Coastguard Worker* modprobe from m-i-t does not honour softdeps for install commands. E.g.:
101*cc4ad7daSAndroid Build Coastguard Worker  config:
102*cc4ad7daSAndroid Build Coastguard Worker
103*cc4ad7daSAndroid Build Coastguard Worker        install bli "echo bli"
104*cc4ad7daSAndroid Build Coastguard Worker	install bla "echo bla"
105*cc4ad7daSAndroid Build Coastguard Worker	softdep bla pre: bli
106*cc4ad7daSAndroid Build Coastguard Worker
107*cc4ad7daSAndroid Build Coastguard Worker  With m-i-t, the output of 'modprobe --show-depends bla' will be:
108*cc4ad7daSAndroid Build Coastguard Worker        install "echo bla"
109*cc4ad7daSAndroid Build Coastguard Worker
110*cc4ad7daSAndroid Build Coastguard Worker  While with kmod:
111*cc4ad7daSAndroid Build Coastguard Worker        install "echo bli"
112*cc4ad7daSAndroid Build Coastguard Worker        install "echo bla"
113*cc4ad7daSAndroid Build Coastguard Worker
114*cc4ad7daSAndroid Build Coastguard Worker* kmod doesn't dump the configuration as is in the config files. Instead it
115*cc4ad7daSAndroid Build Coastguard Worker  dumps the configuration as it was parsed. Therefore, comments and file names
116*cc4ad7daSAndroid Build Coastguard Worker  are not dumped, but on the good side we know what the exact configuration
117*cc4ad7daSAndroid Build Coastguard Worker  kmod is using. We did this because if we only want to know the entire content
118*cc4ad7daSAndroid Build Coastguard Worker  of configuration files, it's enough to use find(1) in modprobe.d directories
119*cc4ad7daSAndroid Build Coastguard Worker
120*cc4ad7daSAndroid Build Coastguard Workerdepmod
121*cc4ad7daSAndroid Build Coastguard Worker------
122*cc4ad7daSAndroid Build Coastguard Worker
123*cc4ad7daSAndroid Build Coastguard Worker* there's no 'depmod -m' option: legacy modules.*map files are gone
124*cc4ad7daSAndroid Build Coastguard Worker
125*cc4ad7daSAndroid Build Coastguard Workerlsmod
126*cc4ad7daSAndroid Build Coastguard Worker-----
127*cc4ad7daSAndroid Build Coastguard Worker
128*cc4ad7daSAndroid Build Coastguard Worker* module-init-tools used /proc/modules to parse module info. kmod uses
129*cc4ad7daSAndroid Build Coastguard Worker  /sys/module/*, but there's a fallback to /proc/modules if the latter isn't
130*cc4ad7daSAndroid Build Coastguard Worker  available
131