How to compile my own modules & DTS files along with kernel

I compiled the linux kernel for iMX6 Sabre lite as per the steps mentioned here:

Now in the iMX6 board, when I do module insert of my module, I get this error.
[ 4602.261657] myModule: disagrees about version of symbol module_layout
insmod: ERROR: could not insert module myModule.ko: Invalid module format

Why could this error be?

Now I thought of compiling the module along with the Kernel and also modify the device tree file. How can I do this?
I noticed that when I run ./ (as per above link), the dts files modified by me gets overwritten. How do I modify dts files to add my device and compile my modules along with kernel? Please help. Thanks.

Did you build with the same kernel source and toolchain?

First make sure you start out fresh with:


Afterwards, you can just run this command to rebuild you modified tree under ./KERNEL/



Hi Robert,
Thanks. Now I am able to modify the DTS and recompile the Kernel with ./tools/