I'm trying to build and install a linux kernel driver for the mcp251xfd. The build appears to be successful (I get the .ko file), but when I call insmod to install it, I get:
insmod: ERROR: could not insert module mcp251xfd.ko: Invalid module format
In googling around, it appears the most common suggestion is to use the exact same source code for the exact kernel version you are trying to build towards. So a uname -a returns:
Linux fedora 5.11.3-300.fc34.x86_64 #1 SMP Thu Mar 4 19:03:18 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux.
So I then downloaded the kernel source for version 5.11.3, ran make oldconfig, edited the .config file to include the driver, ran make prepare, then went into the driver source code directory and called:
make -C ~/linux-5.11.3 -M=`pwd` modules
and this was successful in that it generates the file mcp251xfd.ko. insmod right after this, and I get the error. I call dmesg, and it returns:
mcp251xfd: version magic '5.11.3 SMP mod_unload ' should be '5.11.3-300.fc34.x86_64 SMP mod_unload '
So I'm not sure what to do next. Was 5.11.3 not the correct version after all?
I notice in my .config file, I see "CONFIG_BUILD_SALT="5.11.3-300.fc34.x86_64". so it looks like that matches my system version number. Is there an extra command line option during "make modules" that instructs to utilize the "salt" version number?