User Tools

Site Tools


kernel_modules

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
kernel_modules [2026-06-08 06:44 UTC (3 months ago)] – create kernel modules page fredchankernel_modules [2026-07-31 01:18 UTC (4 weeks ago)] (current) – [Building] fix missing filename fredchan
Line 12: Line 12:
   - 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.   - 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.
   - In ''.config'', change the line ''CONFIG_LOCALVERSION_AUTO=y'' to ''CONFIG_LOCALVERSION_AUTO=n''.   - In ''.config'', change the line ''CONFIG_LOCALVERSION_AUTO=y'' to ''CONFIG_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, setting ''CONFIG_SLIP=m'' enabled SLIP support to be compiled to ''drivers/net/slip/.ko''.+  - 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/slip.ko''.
   - In ''Makefile'', change the line ''EXTRAVERSION ='' to ''EXTRAVERSION = -fsl-imx-INIT-004'', or whatever comes after the PM3's ''uname -r'' for you.   - In ''Makefile'', change the line ''EXTRAVERSION ='' to ''EXTRAVERSION = -fsl-imx-INIT-004'', or whatever comes after the PM3's ''uname -r'' for you.
   - In ''/scripts/dtc/dtc-lexer.lex.c'' and ''/scripts/dtc/dtc-lexer.lex.c_shipped'', change ''YYLTYPE yylloc;'' to ''extern YYLTYPE yylloc;''   - In ''/scripts/dtc/dtc-lexer.lex.c'' and ''/scripts/dtc/dtc-lexer.lex.c_shipped'', change ''YYLTYPE yylloc;'' to ''extern YYLTYPE yylloc;''
   - Run ''git add .'' and ''git commit''.   - Run ''git add .'' and ''git commit''.
-  - Run ''make LOCALVERSION= -C . modules''+  - Run ''make LOCALVERSION= -C . modules''
 +    * If you are using Dockcross and you are in a bash environment inside the container, you may need to run ''sudo make'' instead of just ''make''.
   - ''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.   - ''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.
  
 +==== Problems ==== 
 +If you fail to load a kernel module and dmesg shows something like the following: 
 +<code> 
 +version magic '4.9.166-fsl-imx-INIT-004+ preempt ARMv7 p2v8 ' should be '4.9.166-fsl-imx-INIT-004 preempt ARMv7 p2v8 ' 
 +</code> 
 +<code> 
 +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 ' 
 +</code> 
 +Then double check: 
 +  * That ''CONFIG_LOCALVERSION_AUTO=n'' is set in ''.config''
 +  * That your ''make'' command has the option ''LOCALVERSION= ''
 +  * That you have no uncommitted changes according to git.
kernel_modules.1780901053.txt.gz · Last modified: by fredchan