Error compiling SPI Kernelmodule

Hi,

I am trying to compile the spisvc kernelmodule like explained in the legato docs:
http://legato.io/legato-docs/latest/yoctoOutofTreeKernelModule.html#howToAddKernelDriver_makeKernel

But the problem is, I always get the following output:

legato-16.10.3/drivers/spisvc$ make
make -C /home/kilian/Downloads/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi/usr/src/kernel M=/home/kilian/Downloads/legato-16.10.3/drivers/spisvc modules
make[1]: Verzeichnis „/home/kilian/Downloads/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi/usr/src/kernel“ wird betreten
CC [M] /home/kilian/Downloads/legato-16.10.3/drivers/spisvc/spisvc.o
/home/kilian/Downloads/legato-16.10.3/drivers/spisvc/spisvc.c:1:0: error: code model kernel does not support PIC mode
/*

scripts/Makefile.build:314: die Regel für Ziel „/home/kilian/Downloads/legato-16.10.3/drivers/spisvc/spisvc.o“ scheiterte
make[2]: *** [/home/kilian/Downloads/legato-16.10.3/drivers/spisvc/spisvc.o] Fehler 1
Makefile:1276: die Regel für Ziel „module/home/kilian/Downloads/legato-16.10.3/drivers/spisvc“ scheiterte
make[1]: *** [module/home/kilian/Downloads/legato-16.10.3/drivers/spisvc] Fehler 2
make[1]: Verzeichnis „/home/kilian/Downloads/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi/usr/src/kernel“ wird verlassen
Makefile:11: die Regel für Ziel „all“ scheiterte
make: *** [all] Fehler 2

Anybody got an idea what I am doing wrong?

Thanks!

New GCC added -fPIC flag by default. Try adding -fno-pic to compiler flags in Makefile.

1 Like

Ah great!
Just as info: In Ubuntu 14.04 it is working without modifying the makefile, just if someone else has the problem. :wink: