kernel_modules
This is an old revision of the document!
Table of Contents
Kernel Modules
List factory default kernel modules
You can list the factory default kernel modules with the command:
find /lib/modules/$(uname -r) -type f -name '*.ko'
Building
Tip: You can use Dockcross to cross-compile from a Docker container to the PM3. Use the dockcross/linux-armv7-lts container.
- Download the i.MX Linux kernel source code from the nxp-imx/linux-imx Github repo, selecting the git tag that matches your kernel version (e.g.
4.9.166for auname -rof4.9.166-fsl-imx-INIT-004). - Obtain the Linux kernel config from the PM3, located at
/proc/config.gz. Unzip this file to.configin the root of the kernel source. - In
.config, change the lineCONFIG_LOCALVERSION_AUTO=ytoCONFIG_LOCALVERSION_AUTO=n. - If you're trying to build kernel modules that are already in the Linux source code, set the appropriate config options to
m. For example, settingCONFIG_SLIP=menabled SLIP support to be compiled todrivers/net/slip/.ko. - In
Makefile, change the lineEXTRAVERSION =toEXTRAVERSION = -fsl-imx-INIT-004, or whatever comes after the PM3'suname -rfor you. - In
/scripts/dtc/dtc-lexer.lex.cand/scripts/dtc/dtc-lexer.lex.c_shipped, changeYYLTYPE yylloc;toextern YYLTYPE yylloc; - Run
git add .andgit commit. - Run
make LOCALVERSION= -C . modules scpyour new kernel module to the PM3 and load it withinsmod your_module.ko. If it fails, checkdmesgto see what's wrong.
Problems
If you fail to load a kernel module and dmesg shows something like the following:
version magic '4.9.166-fsl-imx-INIT-004+ preempt ARMv7 p2v8 ' should be '4.9.166-fsl-imx-INIT-004 preempt ARMv7 p2v8 '
version magic '4.9.166-fsl-imx-INIT-004-dirty preempt ARMv7 p2v8 ' should be '4.9.166-fsl-imx-INIT-004 preempt ARMv7 p2v8 '
Then double check:
- That
CONFIG_LOCALVERSION_AUTO=nis set in.config. - That your
makecommand has the optionLOCALVERSION=. - That you have no uncommitted changes according to git.
kernel_modules.1780901450.txt.gz · Last modified: by fredchan
