Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`./scripts/recordmcount: Syntax error: "(" unexpected` is reported when I compile driver module on Raspberry Pi

I recompiled my Raspberry Pi's Linux Kernel to enable some debug features. The new kernel is compiled on my X86 desktop PC by the tools that are supplied by https://github.com/raspberrypi/tools. The new kernel seems working fine until that I compile my hello-world driver module on it, and the info below is printed:

make -C /lib/modules/3.18.10-d0u9/build M=/home/pi/Linux-Device-Driver-3.18/1_Hello-World modules
make[1]: Entering directory '/usr/src/linux-source-3.18'
    CC [M]  /home/pi/Linux-Device-Driver-3.18/1_Hello-World/main.o
./scripts/recordmcount: 1: ./scripts/recordmcount: Syntax error: "(" unexpected
scripts/Makefile.build:257: recipe for target '/home/pi/Linux-Device-Driver-3.18/1_Hello-World/main.o' failed
make[2]: *** [/home/pi/Linux-Device-Driver-3.18/1_Hello-World/main.o] Error 2
Makefile:1398: recipe for target '_module_/home/pi/Linux-Device-Driver-3.18/1_Hello-World' failed
make[1]: *** [_module_/home/pi/Linux-Device-Driver-3.18/1_Hello-World] Error 2
make[1]: Leaving directory '/usr/src/linux-source-3.18'
Makefile:19: recipe for target 'modules' failed
make: *** [modules] Error 2

The hello-world module is fairly simple, and it is compiled correctly on my X86 PC.

I think that maybe the way I compile Linux Kernel is wrong...

Has any one meet this problem?

BTW, how to correctly cross-compile kernel for raspberry Pi for driver development?

like image 998
Douglas Su Avatar asked Jul 06 '15 06:07

Douglas Su


1 Answers

Without knowing more specifics about the version of the kernel that was recompiled, which os version, etc it would be difficult to be certain what exactly is going on.

Based on personal experience installing Raspbian is a much more forgiving way to get things running on the pi. It is "Debian enough" that making things work on it is somewhat similar to most Linux environments.

Sparkfun has a great guide on installing Raspbian and the Raspbian website has a lot of documentation available and seems to be a pretty active community. Sorry I can't be more helpful but without more details about how the kernel was recompiled, what debug features were enabled, etc it is hard to be more specific about a solution.

like image 196
Matt Avatar answered Jan 04 '23 13:01

Matt