Error Compiling PCIe Driver

I found and corrected the problem with the “insmod: ERROR: could not insert module ./altera_dma.ko: Invalid module format” error. The /usr/src/linux-headers-3.10.96+/ directory is an exact copy of the original /usr/src/linux-headers-3.10.96-tegra/ directory and the Makefile contains the line

EXTRAVERSION = -tegra

which should be

EXTRAVERSION = +

This was causing a version magic mismatch.

I’m now past that, but still not out of the woods. Now I get

insmod: ERROR: could not insert module ./altera_dma.ko: Unknown symbol in module

with driver messages

[ 1383.130947] altera_dma: Unknown symbol copy_from_user (err 0)
[ 1383.130978] altera_dma: Unknown symbol kzalloc (err 0)
[ 1383.130995] altera_dma: Unknown symbol copy_to_user (err 0)

References to these functions show up throughout the Linux headers in /usr/src/linux-headers-3.10.96+/. Any thoughts on making these known to insmod?

Symbols are created any time features are enabled in a kernel. One symbol may depend on another, e.g., perhaps you need a block device feature before a loopback encryption feature can work. The missing symbol is likely due to needing to enable some other feature which your module depends on. If the altera_dma module was enabled via the “make menuconfig” or “make nconfig” type editor, then dependencies such as this should have also been enabled…but if you build modules outside of the main kernel source you will need to manually determine which config provides the missing symbol and build that module as well…followed by inserting the dependency module prior to the altera_dma module.

The trick is to find the feature name (“CONFIG_something”) providing that symbol :P

hello man
i encounter the same question when i build the driver of “riffa”[url]http://riffa.ucsd.edu/[/url]
error:
scripts/basic/fixdep: 1: scripts/basic/fixdep: Syntax error: “(” unexpected
why?
but i can’t solve this question?
can you tell me the solution !
is this question connected with rebiulding kernel?
how can i should rebiuld the kernel?
i use
[url]http://developer.ridgerun.com/wiki/index.php?title=Compiling_Tegra_X1_source_code[/url]

You need to run make modules_prepare. See nvl4t_docs/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide/l4t_getting_started.html#wwpID0E0DE0HA in the Tegra Linux Driver Package Development Guide for more information.

I had given part of the answer to @??? in another thread…I had completely forgotten to mention “make modules_prepare”. Good catch!

thankyou linuxdev and jeffhoffmanor very much
when I make modules_prepare ,i run into a new question!

when make , riffa[url]http://riffa.ucsd.edu/[/url]
error :

LD [M] /home/ubuntu/riffa_2.2.2/riffa_2.2.2/source/driver/linux/riffa.o
scripts/mod/modpost: 1: scripts/mod/modpost: Syntax error: “(” unexpected

I replied to this in the other thread…it’s difficult when the same question is in more than one place.