How to build a Linux kernel module so that it is compatible with all kernel releases?
<p>I want to build a kernel module that will be compatible with all the kernel’s releases.
For example, if I build a kernel module on kernel 3.2.0-29 and try to load it on 3.2.0-86, I get the following error:</p>

<blockquote>
  <p>modprobe my_driver</p>
  
  <p>FATAL: Error inserting my_driver (/lib/modules/3.2.0-86-generic/kernel/fs/my_drv/my_drv.ko): Invalid module format</p>
  
  <p>[ In the log messeges: my_drv: disagrees about version of symbol module_layout ]</p>
</blockquote>

<p>How can I build a kernel module on 3.2.0-29 that will be good for all 3.2.0 releases.</p>