Joe, Ubuntu (3.2) may use the xyz kernel version, but Ubuntu (3.9) may use the xyz1 kernel version. If the kernel versions are different from each other, you need to build / compile your driver with this particular kernel version. If the kernel versions are the same, you do not need to create a driver. The important point is that each driver module is compiled or built using the version.ko module (which actually enters information about the kernel version built using the driver module), and when loading the kernel module, it checks this information and the kernel version if it differs then throws "- 1 Invalid module format" or if it matches, then the module of the module loads successfully. To develop a kernel module that is future or backward compatible, you need to know on which version of the kernel the API or functions signature for ex has been changed : the ioctl signature has been changed from kernel version 2.3.36 onwards , so your code should be lower
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) static long minor_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) #else static int minor_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) #endif
If you designed in this way, your kernel module will be compatible with the future or vice versa. Compatibility is just an adaptation of an API signature or functions, etc. changes to the kernel version, retaining the old API or function signature, etc. in your kernel module, as in the example above, but still you need to build / compile the kernel module against the version of the kernel you are trying to load onto.
source share