02-25-2016 03:40 PM
If I build a new version of an existing custom module that has kernel dependencies with the command line “petalinux-build –c rootfs/MyMod” and then copy the resulting MyMod.ko file from the build/linux/rootfs/modules/MyMod directory to the /lib/modules/4.0.0-xilinx/extra of a running Petalinux v2015.4 system, replacing the old version of the module, and then attempt the command “modprobe MyMod”, the only result is the message “modprobe: can't load module MyMod (extra/MyMod.ko): Invalid argument”. The command “dmesg” shows, for each kernel symbol referenced by MyMod, the following lines:
MyMod: no symbol version for <symbol>
MyMod: Unknown symbol <symbol>(err -22)
The MyMod.ko produced by this procedure is ~ 1 KB smaller than the original file built into the image by “petalinux-build” and apparently lacks symbol version information. How can I update my loadable module without rebuilding the entire image?
02-26-2016 08:38 PM
Fortunately or unfortunately, I've avoided the petalinux build system. When you build an "out of tree" module, your custom module's makefile needs to reference the built kernel tree. Your should see something command like this:
make ARCH=ARM CROSS_COMPILE=arm-xilinx-linux-gnueabi- -C YOUR_BUILT_LINUX_KERNEL_DIR M=MY_MODE_DIR modules
You might be able to work-around by doing a "depmod -a" on the target to rebuild the symbol list. That's all I got. Hopefully someone more familar with petalinux can comment.
02-29-2016 03:33 AM - edited 02-29-2016 03:33 AM
By default, the kernel is built with CONFIG_MODVERSIONS=y. The intention is to ensure that the module is compiled against the exact same kernel source code that you're running, to avoid ABI incompatability issues. This is somewhat similar to C++ function name mangling, although it is implemented differently.
Of course, if you are just rebuilding the same module during development, this can be inconvenient. So you may want to turn off CONFIG_MODVERSIONS. This will require a full rebuild of the kernel of course.
For details please see Documentation/kbuild/modules.txt (in particular, section 6) in the kernel source code.
03-07-2016 03:59 PM
I had read section 6 of module.txt, and I can see that the kernel's "Module.symvers" file is preserved in build/linux/kernel/xlnx-4.0, so I expect PetaLinux to make that file available when building my modules, but I apparently cannot control that (e.g., defining KBUILD_EXTRA_SYMBOLS in my module's Makefile has no effect). I'd like to work with PetaLinux, not around it, and I'd like to keep MODVERSIONS.
03-08-2016 08:13 AM
What happens if you try "modprobe -f <module_name>"?
If -f is not available, make sure to enable CONFIG_MODULE_FORCE_LOAD in your kernel config.
04-11-2016 03:10 PM
The driver fails to load in the same manner if I create a new "image.ub" by executing the commands "petalinux-build -c rootfs/MyMod" followed by "petalinux-build -x package".