Building a driver for i.MX 8M Nano DDR4 EVK with Linux NXP i.MX Release Distro 5.10-gatesgarth (gate

cancel
Showing results for 
Search instead for 
Did you mean: 

Building a driver for i.MX 8M Nano DDR4 EVK with Linux NXP i.MX Release Distro 5.10-gatesgarth (gate

102 Views
jasonpowell_2
Contributor III

I am trying to compile panel-ilitek-ili9881c.c driver on the i.MX 8M Nano DDR4 EVK board, however I do not see kernel headers for:

5.10.9-1.0.0+g32513c25d8c7   <----- obtained by running $ uname -r

The Linux installed on the board is:

ID=fsl-imx-xwayland
NAME="NXP i.MX Release Distro"
VERSION="5.10-gatesgarth (gatesgarth)"
VERSION_ID=5.10-gatesgarth
PRETTY_NAME="NXP i.MX Release Distro 5.10-gatesgarth (gatesgarth)"

I need to compile only this (one) kernel module (driver).

I cross-compiled it on another dedicated Linux machine (x86_64) but when tried to load in 5.10.9-1.0.0+g32513c25d8c I was getting 'module format error' because the module is compiled against different kernel.

What are the exact steps to build (compile) and load one module, driver for this Linux kernel 5.10.9-1.0.0+g32513c25d8c7 present on the board?

 

Labels (1)
0 Kudos
4 Replies

93 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello jasonpowell_2,

 

The driver is included in the 4.14.98 BSP of part of the Mini,

https://github.com/TechNexion-customization/linux-imx-tn/blob/tn-imx_4.14.98_2.0.0_ga-wip-mipi2lvds/...

However if you want to create a module:

  1. Installing the Linux Headers. you have to download the linux header of kernel 5.10.9v
  2. Hello World Module Source Code. ...
  3. Create Makefile to Compile Kernel Module
  4. Insert or remove the kernel module

Regards

0 Kudos

86 Views
jasonpowell_2
Contributor III

Thanks. Can you please provide the location where I can download kernel 5.10.9v from?

0 Kudos

83 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hi

You can download it from kernel.org, if you want the kernel supported by nxp you can download the 5.10.35v from codeaurora

Regards

0 Kudos

69 Views
jasonpowell_2
Contributor III

Thanks, Bio_TICFSL, for your answer.

My goal is to cross-compile “panel-ilitek-ili9881c” driver against kernel “5.10.9-1.0.0+g32513c25d8c7 ” provided by NXP with “NXP i.MX Release Distro 5.10-gatesgarth (gatesgarth)” on another dedicated Linux machine, not on i.MX 8M Nano EVK. My goal is to build this kernel on this dedicated machine.

As I understand, I need to exactly match vermagic for this module to match the following string (obtained from other modules on i.MX 8M Nano running modinfo):

vermagic=5.10.9-1.0.0+g32513c25d8c7 SMP preempt mod_unload modversions aarch64”.

From your answer the “5.10.35v from codeaurora” will not serve the purpose because vermagic right away will not match. So, I have to target kernel “5.10.9-1.0.0+g32513c25d8c7“.

1.   Will it be correct to use and build kernel 5.10.9v to compile the module against and then load it to the “5.10.9-1.0.0+g32513c25d8c7 ” kernel? I built 5.10.y kernel but it did not give correct vermagic for the module. Can you please provide link to page where I can download 5.10.9v kernel? I tried kernel.org and https://lore.kernel.org/stable/?q=5.10.9v but search returned no results.

2.    In order to build the module and then load it, all the kernel settings must be the same so I copied /proc/config.gz from kernel “5.10.9-1.0.0+g32513c25d8c7 ” from Nano EVK and used it on my Linux machine for cross-compile it with 5.10.y kernel, but getting “disagrees about version of symbol module_layout” and “Exec format error” errors. What is the correct approach?

3.    As I understand, to avoid the “disagrees about version of symbol module_layout” and “Exec format error” errors my vermagic must exactly match “5.10.9-1.0.0+g32513c25d8c7 SMP preempt mod_unload modversions aarch64”, so how “5.10.9v” will match, as you suggested?

I hacked .ko binary file by inserting missing strings in vermagic but still getting these errors when trying to load module using insmod and modprobe. In another attempt I modified top level Makefile to include 5.10.9-1.0.0+g32513c25d8c7 and vermagic showed that string (when running modinfo on module) after build, but still getting the same errors.

4.    Where I can download kernel source “5.10.9-1.0.0+g32513c25d8c7“ from?

Thanks again.

JP

0 Kudos