11-09-2015 08:33 PM
With PetaLinux 2014.4, I'm trying to write an ALSA soundcard driver module for a picozed based platform but I haven't been able to get it to load.
I created a module within my project in components/modules with:
petalinux-create -t modules -n riu_card --enable
As I added the following to the install target of the generated Makefile:
$(TARGETINST) -d -a "riu_card" /etc/modules;
I replaced the generated riu_card.c with the soundcard driver I'm writing, which is still fairly basic, being still under development. The project builds successfully and puts the built module riu_card.ko into /lib/modules/3.17.0-xilinx/extra and the module name is placed into /etc/modules for loading.
When loaded on SD card and booted on the target, the module hasn't loaded, while the Dummy and Loopback ALSA soundcard drivers have.
I tried to manually load it with:
modprobe riu_card
but it fails with the following error output:
riu_card: Unknown symbol snd_soc_register_card (err 0)
riu_card: Unknown symbol platform_driver_unregister (err 0)
riu_card: Unknown symbol snd_soc_dai_set_fmt (err 0)
riu_card: Unknown symbol snd_soc_dai_set_sysclk (err 0)
riu_card: Unknown symbol soc_dai_hw_params (err 0)
riu_card: Unknown symbol snd_soc_unregister_card (err 0)
riu_card: Unknown symbol __platform_driver_register (err 0)
riu_card: Unknown symbol snd_soc_pm_ops (err 0)
modprobe: can't load module riu_card (extra/riu_card.ko): unknown symbol in module, or unknown parameter
So I've hit a roadblock here and don't know what to do next. Does anyone have any ideas?
11-11-2015 05:35 PM
The problem I've found (for all but one of the symbols listed in the errors) was because I didn't include:
MODULE_LICENSE("GPL");
in my module.
The annoying thing about this is that this is specifically tested for (in kernel/module.c) to fail when resolving symbols on loading modules, but no indication is given that this is the reason for failure. Result: much wasted debugging time!!!
11-11-2015 04:45 AM
11-11-2015 05:35 PM
The problem I've found (for all but one of the symbols listed in the errors) was because I didn't include:
MODULE_LICENSE("GPL");
in my module.
The annoying thing about this is that this is specifically tested for (in kernel/module.c) to fail when resolving symbols on loading modules, but no indication is given that this is the reason for failure. Result: much wasted debugging time!!!
11-11-2015 05:41 PM
Thanks John.
The reason for the added line in the Makefile is to put the module name into /etc/modules so that it *will* be automatically loaded.
It turns out that the symbol "soc_dai_hw_params" isn't exported by the kernel, but all the other symbols are. Resolving the symbols was refused because of the lack of "MODULE_LICENSE("GPL");" in my module. I just wish the error message told me that was why.