cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
15,758 Views
Registered: ‎06-08-2015

modprobe: can't load module

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?

 

 

Tags (2)
0 Kudos
7 Replies
Highlighted
Scholar
Scholar
15,704 Views
Registered: ‎05-28-2012

Re: modprobe: can't load module

The modprobe utility does a lot of checking that you might not need. Suggest try using insmod instead.

0 Kudos
Highlighted
Adventurer
Adventurer
15,694 Views
Registered: ‎06-08-2015

Re: modprobe: can't load module

No, I tried insmod, with the same result. But thank you.

0 Kudos
Highlighted
Scholar
Scholar
15,676 Views
Registered: ‎05-28-2012

Re: modprobe: can't load module

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.

0 Kudos
Highlighted
Scholar
Scholar
15,565 Views
Registered: ‎05-28-2013

Re: modprobe: can't load module

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.

0 Kudos
Highlighted
Adventurer
Adventurer
15,246 Views
Registered: ‎06-08-2015

Re: modprobe: can't load module

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.

0 Kudos
Highlighted
Visitor
Visitor
15,206 Views
Registered: ‎12-15-2015

Re: modprobe: can't load module

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.

0 Kudos
Highlighted
Adventurer
Adventurer
13,840 Views
Registered: ‎06-08-2015

Re: modprobe: can't load module

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".

0 Kudos