Hi, hope you are doing well, I'm using a custom board with imxrt1062 and Linux kernel version 4.5.0, the Linux distribution is working well, the board is very similar to the MIMXRT1060-EVK.
All the embedded interfaces on Linux distribution are working well, serial, i2c, Eth, USB, all of them are embedded, except the SPI that is a external module that should be inserted after kernel boot.
At circuit level:
- I added one SPI (LPSPI4) interface to manage a NOR SPI flash, the pins are not shared with any other thing.
At software level:
- I added support on linux kernel for external modules.
- The interface LPSPI4 and m25p80m device like is declared on "device tree".
- The pinctrl is set on iomux. .
I can build the module using:
make CFLAGS=-PIC /home/../linux (Linux kernel files) M=(source files).
The module structure (m25p80.ko) seems to be ok, using "file" and "modinfo" commands on Linux I can see the following:
m25p80.ko: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), Build[]..........., not stripped.
vermagic: 4.5.0 mod_unload ARMv7 thumb2
The information is ok, but when I try to insert the module using "insmod" command, I get the following error:
#insmod m25p80.ko
m25p80: unknown relocation: 161
insmod: can't insert 'm25p80.ko': invalid module format.
I found that the 161 number is in the library "elf.h", there is a line:
#define R_SH_PLT32 161
So, seems to be that could be an error on module's format, but "file" returns that the module is of type ELF 32.
I don't understand what is going on, is my first time compiling and using Linux kernel modules, I'm shure that I'm missing something.
I've read many things about kernel modules, but I can't find the solution for this.
Maybe you can help me.
Many thanks!