问题
I'm trying to edit one module from kernel source and compile it for kernel: 5.4.0-40-generic #44-Ubuntu
.
This is how i did it:
git clone git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/focal
git checkout -b temp Ubuntu-5.4.0-40.44
nano drivers/media/usb/siano/smsusb.c
make oldconfig
make prepare
make modules_prepare
make SUBDIRS=scripts/mod
make SUBDIRS=drivers/media/usb/siano modules
cd drivers/media/usb/siano/
insmod smsusb.ko
I got this error:
insmod: ERROR: could not insert module drivers/media/usb/siano/smsusb.ko: Invalid module format
My questions are:
- 'Invalid module format' suggest that the module is compiled to different version although i checked out the correct version, What is the problem?
- Why I need to compile the whole kernel, which consumes a lot of time, Is there a better method to compile only one module?
Update:
I copied the .ko to /lib/modules/... after that I've inserted the device that corresponds to the kernel module which results the following error in dmesg:
version magic '5.4.44+ SMP mod_unload ' should be '5.4.0-40-generic SMP mod_unload '
Thanks.
来源:https://stackoverflow.com/questions/64409182/edit-and-compile-a-kernel-module