User Tools

Site Tools


kernel_modules

This is an old revision of the document!


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.

  1. 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.166 for a uname -r of 4.9.166-fsl-imx-INIT-004).
  2. Obtain the Linux kernel config from the PM3, located at /proc/config.gz. Unzip this file to .config in the root of the kernel source.
  3. In .config, change the line CONFIG_LOCALVERSION_AUTO=y to CONFIG_LOCALVERSION_AUTO=n.
  4. 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, setting CONFIG_SLIP=m enabled SLIP support to be compiled to drivers/net/slip/.ko.
  5. In Makefile, change the line EXTRAVERSION = to EXTRAVERSION = -fsl-imx-INIT-004, or whatever comes after the PM3's uname -r for you.
  6. In /scripts/dtc/dtc-lexer.lex.c and /scripts/dtc/dtc-lexer.lex.c_shipped, change YYLTYPE yylloc; to extern YYLTYPE yylloc;
  7. Run git add . and git commit.
  8. Run make LOCALVERSION= -C . modules
  9. scp your new kernel module to the PM3 and load it with insmod your_module.ko. If it fails, check dmesg to see what's wrong.
kernel_modules.1780901053.txt.gz · Last modified: by fredchan