To cross-compile latest kernel I just followed the instructions on
https://releases.linaro.org/96boards/dragonboard410c/linaro/debian/latest/
as I needed specific modules I choosen then using make menuconfig on host computer to customize .config
After loading the new kernel with fastboot, the make command correctly compiled the LKM generating object files:
$ make
make -C /lib/modules/4.14.0-qcomlt-arm64/build M=/home/linaro/Desktop modules
make[1]: Entering directory '/usr/src/linux-headers-4.14.0-qcomlt-arm64'
CC [M] /home/linaro/Desktop/mymodule.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/linaro/Desktop/mymodule.mod.o
LD [M] /home/linaro/Desktop/mymodule.ko
make[1]: Leaving directory '/usr/src/linux-headers-4.14.0-qcomlt-arm64'
But when trying to perform insmod, it is not working:
$ sudo insmod mymodule.ko
insmod: error inserting 'mymodule.ko': -1 Invalid module format
Using dmesg I found the issue:
[ 66.415846] mymodule: version magic '4.14.96 SMP preempt mod_unload aarch64' should be '4.14.0-qcomlt-arm64 SMP preempt mod_unload aarch64'
I tried to recompile Kernel modifying the KERNELRELEASE argument during make but did not work.
Please, someone has any idea on how to solve this issue ?